1 TYPES:BEGIN OF ty_data , 2 checkbox(1), 3 prueflos TYPE qals-prueflos, 4 werk TYPE qals-werk, 5 matnr TYPE qals-matnr, 6 ktextmat TYPE qals-ktextmat, 7 vcodegrp TYPE rqeva-vcodegrp, 8 vcode TYPE rqeva-vcode, 9 END OF ty_data . 10 11 DATA:gt_data TYPE TABLE OF ty_data . 12 13 DATA:ls_data TYPE bapi2045ud, 14 ls_return TYPE bapireturn1, 15 ls_stock TYPE bapi2045d_il2, 16 ls_ud_re TYPE bapi2045ud_return. 17 18 LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<fs_add>) WHERE checkbox = 'X' . 19 20 CLEAR ls_data . 21 CLEAR ls_return . 22 CLEAR ls_stock . 23 CLEAR ls_ud_re . 24 25 ls_data-insplot = <fs_add>-prueflos . 26 ls_data-ud_selected_set = <fs_add>-vcodegrp . 27 ls_data-ud_plant = <fs_add>-werk . 28 ls_data-ud_code_group = <fs_add>-vcodegrp . 29 ls_data-ud_code = <fs_add>-vcode . 30 "要过账的把下面的字段赋值X 31 "ls_data-ud_stock_posting = 'X'. "是否进行过帐 32 33 CALL FUNCTION 'BAPI_INSPLOT_SETUSAGEDECISION' 34 EXPORTING 35 number = <fs_add>-prueflos 36 ud_data = ls_data 37 * LANGUAGE = 38 * UD_MULTSPEC = 39 * UD_MODE = 'D' 40 IMPORTING 41 ud_return_data = ls_ud_re 42 stock_data = ls_stock 43 return = ls_return 44 * /CWM/STOCK_DATA = 45 * TABLES 46 * SYSTEM_STATUS = 47 * USER_STATUS = 48 . 49 50 IF ls_return-type = 'E' . 51 52 CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. 53 54 ELSE . 55 56 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' 57 EXPORTING 58 wait = 'X'. 59 60 ENDIF . 61 62 ENDLOOP .标签:QA11,return,批量,data,ABAP,ls,ud,TYPE,stock From: https://www.cnblogs.com/TigerMan/p/16661664.html