1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
DATA lt_methods TYPE TABLE OF bapi_alm_order_method. APPEND VALUE bapi_alm_order_method( refnumber = '000000' method = 'SAVE' ) TO lt_methods. LOOP AT lt_data INTO DATA(ls_data_item). APPEND VALUE bapi_alm_order_method( refnumber = 1 objecttype = 'USERSTATUS' method = 'CHANGE' objectkey = ls_data_item-aufnr ) TO lt_methods. ENDLOOP. DATA lt_userstatus TYPE TABLE OF bapi_alm_order_usrstat. lt_userstatus = VALUE #( ( user_st_text = lv_status langu = sy-langu change_event = '01' ) ). DATA lt_numbers TYPE TABLE OF bapi_alm_numbers. lt_numbers = VALUE #( FOR ls_data IN lt_data ( aufnr_in = ls_data-aufnr ) ). DATA(lt_return) = VALUE bapirettab( ). CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN' TABLES it_methods = lt_methods it_userstatus = lt_userstatus et_numbers = lt_numbers return = lt_return. IF NOT line_exists( lt_return[ type = 'E' ] ). COMMIT WORK. ENDIF. |