Code: Alles auswählen.
report test.
parameter: p_werks type mast-werks obligatory,
p_nmeins type stpo-meins obligatory,
p_matnr type mara-matnr.
start-of-selection.
data: HEADDATA LIKE BAPIMATHEAD,
ls_PLANTDATA type BAPI_MARC,
lt_PLANTDATA like table of ls_PLANTDATA,
ls_PLANTDATAX type BAPI_MARCX,
lt_PLANTDATAX like table of ls_PLANTDATAX,
ls_return type BAPIRET2.
HEADDATA-material = p_matnr.
HEADDATA-STORAGE_VIEW = 'X'.
ls_PLANTDATA-issue_unit = p_nmeins.
ls_PLANTDATA-plant = p_werks.
append ls_PLANTDATA to lt_PLANTDATA.
ls_PLANTDATAX-issue_unit = 'X'.
ls_PLANTDATAX-plant = p_werks.
append ls_PLANTDATAX to lt_PLANTDATAX.
clear: ls_RETURN.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = HEADDATA
IMPORTING
RETURN = ls_RETURN
TABLES
PLANTDATA = lt_PLANTDATA
PLANTDATAX = lt_PLANTDATAX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
write: ls_return-type , ls_return-message.
Code: Alles auswählen.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = HEADDATA
PLANTDATA = lt_PLANTDATA
PLANTDATAX = lt_PLANTDATAX
IMPORTING
RETURN = ls_RETURN.
" TABLES.