DATA:lt_purch TYPE TABLE OF bapieine, lt_return TYPE TABLE OF bapireturn. FIELD-SYMBOLS:<fs_return> TYPE bapireturn, <fs_purch> TYPE bapieine. CALL FUNCTION 'BAPI_INFORECORD_GETLIST' EXPORTING vendor = c_upload-lifnr material = c_upload-matnr * MAT_GRP = * VEND_MAT = * VEND_PART = * VEND_MATG = purch_org = c_upload-ekorg info_type = '0' plant = c_upload-werks pur_group = c_upload-ekgrp * PURCHASINGINFOREC = deleted_inforecords = '' purchorg_data = 'X' * GENERAL_DATA = 'X' * MATERIAL_EVG = * PURCHORG_VEND = ' ' TABLES * INFORECORD_GENERAL = inforecord_purchorg = lt_purch return = lt_return. READ TABLE lt_return ASSIGNING <fs_return> WITH KEY type = 'E'. IF sy-subrc NE 0. READ TABLE lt_purch ASSIGNING <fs_purch> WITH KEY info_type = '0' plant = c_upload-werks. IF sy-subrc = 0. IF <fs_purch>-price_unit <> 0. *ALV价格等于采购信息记录单价 * 数量 /价格单位 * c_upload-netpr = <fs_purch>-net_price * c_upload-menge / <fs_purch>-price_unit. c_upload-netpr = <fs_purch>-net_price / <fs_purch>-price_unit. c_upload-netpr_n = <fs_purch>-net_price. c_upload-peinh = <fs_purch>-price_unit. c_upload-waers = <fs_purch>-currency. ENDIF. IF <fs_purch>-net_price = 0. MOVE-CORRESPONDING c_upload TO gs_error. gs_error-msg = gs_error-msg && '/' && '没有获取到采购信息记录价格'. ENDIF. IF gs_error-msg IS NOT INITIAL. APPEND gs_error TO gt_error. CLEAR:gs_error. gv_flag = 'X'. ENDIF. ELSE."取不到采购信息记录价格的也放在报错数据 MOVE-CORRESPONDING c_upload TO gs_error. gs_error-msg = gs_error-msg && '/' && '没有获取到采购信息记录价格'. IF gs_error-msg IS NOT INITIAL. APPEND gs_error TO gt_error. CLEAR:gs_error. gv_flag = 'X'. ENDIF. ENDIF. ELSE. MOVE-CORRESPONDING c_upload TO gs_error. gs_error-msg = gs_error-msg && '/' && '没有获取到采购信息记录价格'. IF gs_error-msg IS NOT INITIAL. APPEND gs_error TO gt_error. CLEAR:gs_error. gv_flag = 'X'. ENDIF. ENDIF.
标签:BAPI,gs,INFORECORD,price,GETLIST,upload,error,msg,ENDIF From: https://www.cnblogs.com/Anyohh233/p/17388811.html