Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Issuse in BAPI_MATERIAL_SAVEDATA Update

Hi,

I am trying to update multiple material plant combination to BAPI BAPI_MATERIAL_SAVEDATA and but everytime I pass one material plant it is updating correctly but whenever i send multiple records of material plan combination , it is not updating. I am updating MARC custom field which I have already extended in the respective BAPI structure.

I have pasted code below for reference, please suggest.

Ankesh

WA_DCS-MATNR 'XX311PBF'.

WA_DCS-WERKS =   '1040'.

WA_DCS-ZZDCBNR = '51102103'.

APPEND WA_DCS TO IT_DCS.

WA_DCS-MATNR 'XXF7311PBF'.

WA_DCS-WERKS =   '1000'.

WA_DCS-ZZDCBNR = '51102103'.

APPEND WA_DCS TO IT_DCS.

WA_DCS-MATNR 'XXF7311PBF'.

WA_DCS-WERKS =   '1030'.

WA_DCS-ZZDCBNR = '51102103'.

APPEND WA_DCS TO IT_DCS.

LOOP AT IT_DCS INTO WA_DCS.

   CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'

     EXPORTING

       INPUT  = WA_DCS-MATNR

     IMPORTING

       OUTPUT = WA_DCS-MATNR.

   WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MARC'.

   WA_EXTENSIONIN-VALUEPART1+0(4) = WA_DCS-WERKS.

   WA_EXTENSIONIN-VALUEPART1+4(8) = WA_DCS-ZZDCBNR.

   APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.

   WA_EXTENSIONINX-STRUCTURE = 'BAPI_TE_MARCX'.

   WA_EXTENSIONINX-VALUEPART1+0(4) = WA_DCS-WERKS.

   WA_EXTENSIONINX-VALUEPART1+4(1) = 'X'.

   APPEND WA_EXTENSIONINX TO IT_EXTENSIONINX.

   WA_HEADDATA-MATERIAL = WA_DCS-MATNR.

   WA_HEADDATA-PURCHASE_VIEW = 'X'.

   AT END OF MATNR.

     CLEAR : WA_RETURN, WA_RETURN1, GV_STRING, GV_STRING1, GV_X.

     CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

       EXPORTING

         HEADDATA     = WA_HEADDATA

       IMPORTING

         RETURN       = WA_RETURN

       TABLES

         EXTENSIONIN  = IT_EXTENSIONIN

         EXTENSIONINX = IT_EXTENSIONINX.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       IMPORTING

         RETURN = WA_RETURN1.

ENDAT.

Former Member
Not what you were looking for? View more on this topic or Ask a question