调用xslt_tool转换将EXCEL的XML转换成内表时发生异常CX_SY_CONVERSION_DATA_LOSS,dump具体信息如下:
1 2 3 4 5 6 7 |
An exception has occurred which is explained in more detail below. The exception, which is assigned to class 'CX_SY_CONVERSION_DATA_LOSS' was not caught and therefore caused a runtime error. The reason for the exception is: Value "ATTENTION ONLY USE TYPE I OIL REFER TO AMM 12-13-04" was allocated in a field which is not long enough. The target field was therefore not able to store all information. |
ST22中dump信息截图:
看dump信息是因为excel字段中的内容长度比内表中定义的要长,所以导致dump。
解决方法很简单,就是在调用CALL TRANSFORMATION时加上options “accept_data_loss”,例子代码如下:
1 2 3 4 5 6 7 |
* 使用xlst_tool转换工具将Excel xml转换到内表中 CALL TRANSFORMATION yxml_it_ipc_xls PARAMETERS p_shared_string = lo_shared_str_nodeset OPTIONS value_handling = 'accept_data_loss' SOURCE XML lv_sheet_xstr RESULT lt_data = lt_vbak[]. |
accept_data_loss含义就是可以截断excel单元格中的字符,然后保存到内表对应的字段中。
以上。
发表评论