HowTo BAPI
HowTo BAPI
material master
1 Contents
1 Contents.........................................................................................................................................1
2 Changes..........................................................................................................................................1
3 System............................................................................................................................................1
4 Description.....................................................................................................................................1
2 Changes
13.06.2020 Version 1.0 Daniel Knapp Basis-Version
3 System
SAP ERP
4 Description
1. It is important to add a field group to the customer field. Without a field group the
BAPI will ignore field changes. Also, a Maintenance Status must be set.
a. Go to Field selection through transaction SPRO: Logistics General -> Material
Master -> Field Selection -> Assign Fields to Field Selection Groups
) or add it ( ).
c. Set a suitable Maintenance Status. Use F1 help for a list of all allowed values.
Example implementation:
REPORT zdk_test.
ls_headdata-material = '1236540001'.
ls_plantdata-plant = 'CN01'.
ls_plantdatax-plant = 'CN01'.
ls_bapi_te_marc-plant = ls_plantdata-plant.
ls_bapi_te_marcx-plant = ls_plantdata-plant.
ls_bapi_te_marc-zz_ameversion = '05'.
ls_bapi_te_marcx-zz_ameversion = abap_true.
ls_extensionin-valuepart1 = ls_bapi_te_marc.
ls_extensionin-structure = 'BAPI_TE_MARC'.
ls_extensioninx-valuepart1 = ls_bapi_te_marcx.
ls_extensioninx-structure = 'BAPI_TE_MARCX'.
IF ls_return-type CA 'EA'.
ROLLBACK WORK.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
For each material master table, a “BAPI_TE_*” structure exists (e.g. BAPI_TE_MARA,
BAPI_TE_MARC, …). This also applies to the X-Structures.
Fill the structures as shown in the example code above, supply the
EXTENSIONIN/EXTENSIONINX tables and execute the BAPI.