Code: Alles auswählen.
METHOD set_data2.
DATA: lt_return TYPE TABLE OF bapi_matreturn2,
ls_return TYPE bapiret2,
ls_mlgt TYPE bapi_mlgt,
ls_mlgtx TYPE bapi_mlgtx,
mt_message TYPE TABLE OF bapiret2.
go_grid->check_changed_data( ).
LOOP AT gt_stock ASSIGNING FIELD-SYMBOL(<ls_stock>).
DATA(ls_header) = VALUE bapimathead( material_long = <ls_stock>-matnr
).
ls_mlgtx = VALUE #( whse_no = <ls_stock>-lgnum
stge_type = <ls_stock>-lgtyp
max_sb_qty = abap_true
min_sb_qty = abap_true
replen_qty = abap_true ).
ls_mlgt = VALUE #( whse_no = <ls_stock>-lgnum
stge_type = <ls_stock>-lgtyp
max_sb_qty = <ls_stock>-lpmax
min_sb_qty = <ls_stock>-lpmin
replen_qty = <ls_stock>-nsmng ).
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = ls_header
storagetypedata = ls_mlgt
storagetypedatax = ls_mlgtx
flag_online = abap_false
IMPORTING
return = ls_return
TABLES
returnmessages = lt_return.
ENDLOOP.
CASE ls_return-type.
WHEN 'E' OR 'A' OR 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WHEN OTHERS.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDCASE.
LOOP AT lt_return ASSIGNING FIELD-SYMBOL(<ls_mrdat>).
APPEND INITIAL LINE TO mt_message ASSIGNING FIELD-SYMBOL(<ls_message>).
IF <ls_mrdat>-type NA 'WSIE'.
<ls_message>-type = 'S'.
ELSE.
<ls_message>-type = <ls_mrdat>-type.
ENDIF.
<ls_message>-id = <ls_mrdat>-id.
<ls_message>-number = <ls_mrdat>-number.
<ls_message>-message_v1 = <ls_mrdat>-message_v1.
<ls_message>-message_v2 = <ls_mrdat>-message_v2.
<ls_message>-message_v3 = <ls_mrdat>-message_v3.
<ls_message>-message_v4 = <ls_mrdat>-message_v4.
MESSAGE ID <ls_message>-id
TYPE <ls_message>-type
NUMBER <ls_message>-number
WITH <ls_message>-message_v1
<ls_message>-message_v2
<ls_message>-message_v3
<ls_message>-message_v4
INTO <ls_message>-message.
ENDLOOP.
CALL FUNCTION 'SUSR_DISPLAY_LOG'
TABLES
it_log_bapiret2 = mt_message " Returnparameter
EXCEPTIONS
parameter_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD.
Hier sollte eigentlich nur der Änderungsprozess stehen.Versuche anzulegen: 55______________________001 001
Material kann nicht gepflegt werden, da keine pflegbaren Daten übergeben
Material kann nicht gepflegt werden, da keine pflegbaren Daten übergeben
Versuche zu ändern: 55______________________001 001
Das Material 55 wird geändert
Versuche anzulegen: 8105000032______________200 TST
Material kann nicht gepflegt werden, da keine pflegbaren Daten übergeben
Material kann nicht gepflegt werden, da keine pflegbaren Daten übergeben
Versuche zu ändern: 8105000032______________200 TST
Es wurden keine Änderungen durchgeführt