Code: Alles auswählen.
DATA: ls_ret_commit TYPE bapiret2,
ls_ret_bapi TYPE bapiret2,
lt_ret_matbapi TYPE STANDARD TABLE OF bapi_matreturn2,
ls_headdata TYPE bapimathead,
ls_plantdata TYPE bapi_marc,
ls_plantdatax TYPE bapi_marcx.
"Kopfdaten
ls_headdata-material = '000000000000001234'.
ls_headdata-basic_view = 'X'. "Sicht auf Grunddaten
ls_headdata-cost_view = 'X'. "Sicht auf Kalkulation
ls_headdata-mrp_view = 'X'. "Sicht auf Disposition
ls_headdata-prt_view = 'X'. "Sicht auf Fertigungshilfsmittel
"Werks-Daten setzen
ls_plantdata-plant = '1234'.
ls_plantdatax-plant = '1234'.
"Werksspez. Materialstatus
ls_plantdata-pur_status = '02'.
ls_plantdatax-pur_status = 'X'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = ls_headdata
plantdata = ls_plantdata
plantdatax = ls_plantdatax
IMPORTING
return = ls_ret_bapi
TABLES
returnmessages = lt_ret_matbapi.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ls_ret_commit.