Update custom fields using BAPI extension

Author | Last Updated| | 24 Comments Facebook Share Twitter Share Google Plus Share A+ A-


Update material custom fields using BAPI extension parameter in SAP, update material custom fields using BAPI_MATERIAL_SAVDATA

Step1:Requirement and basic explanation Important Top^

Requirement:Update MARA custom fields using material BAPI BAPI_MATERIAL_SAVEDATA.

We have some custom fields in MARA table, while creating/updating a material I need update them along with material.

To achieve this, we need to follow below steps:

1.Check for the available structure BAPI_TE_<TABLENAME>, here in this requirement BAPI_TE_MARA, and append custom fields using append structure.

2.Pass the structure and values to material BAPI, BAPI_MATERIAL_SAVEDATA.

Step2:Append structure BAPI_TE_MARA Important Top^

Go to SE11, provide name as BAPI_TE_MARA, display

using BAPI extension for MARA

Click on append structure.

BAPI extension for MARA

A pop up will come, provide a append structure name ex: ZBAPI_MARA_EX, enter

Provide custom fields available in MARA to ZBAPI_MARA_EX.

BAPI extension for MARA

Save and Activate.

Step3:Using extension in BAPI_MATERIAL_SAVEDATA Important Top^

Use the below code to use BAPI extension

  DATA : ls_headdata  TYPE bapimathead,
  ls_clientdata  TYPE bapi_mara,
  ls_clientdatax  TYPE bapi_marax.
  DATA materialdescriptions TYPE TABLE OF bapi_makt .
  DATA : lt_mara TYPE STANDARD TABLE OF bapi_te_mara WITH HEADER LINE,
  lt_marax TYPE STANDARD TABLE OF bapi_te_marax WITH HEADER LINE,
  lt_extensionin TYPE STANDARD TABLE OF  bapiparex WITH HEADER LINE,
  lt_extensioninx TYPE STANDARD TABLE OF bapiparexx WITH HEADER LINE .
  headdata-material = 'TEST_MAT001'.
  headdata-ind_sector = 'M'.
  headdata-matl_type = 'FERT'.
  headdata-basic_view = 'X'.
  clientdata-base_uom = 'EA'.
  clientdatax-base_uom = 'X'.

  wa_mat_desc-langu = 'E'.
  wa_mat_desc-matl_desc = 'Test material description'.
  APPEND wa_mat_desc TO materialdescriptions.
**extension structure
  MOVE 'BAPI_TE_MARA' TO lt_extensionin-structure.
  MOVE headdata-material TO lt_mara-material.
  MOVE 'CUSTOM VALUE' TO lt_mara-ZCUSTOM.
  MOVE lt_mara TO lt_extensionin-valuepart1.
  APPEND lt_extensionin.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
  headdata  = headdata
  clientdata  = clientdata
  clientdatax  = clientdatax
*  PLANTDATA  = PLANTDATA
*  PLANTDATAX  = PLANTDATAX
*  FORECASTPARAMETERS  = FORECASTPARAMETERS
*  FORECASTPARAMETERSX  = FORECASTPARAMETERSX
*  PLANNINGDATA  = PLANNINGDATA
*  PLANNINGDATAX  = PLANNINGDATAX
*  STORAGELOCATIONDATA  = STORAGELOCATIONDATA
*  STORAGELOCATIONDATAX = STORAGELOCATIONDATAX
*  VALUATIONDATA  = VALUATIONDATA
*  VALUATIONDATAX  = VALUATIONDATAX
*  WAREHOUSENUMBERDATA  = WAREHOUSENUMBERDATA
*  WAREHOUSENUMBERDATAX = WAREHOUSENUMBERDATAX
*  SALESDATA  = SALESDATA
*  SALESDATAX  = SALESDATAX
*  STORAGETYPEDATA  = STORAGETYPEDATA
*  STORAGETYPEDATAX  = STORAGETYPEDATAX
*  FLAG_ONLINE  = ' '
*  FLAG_CAD_CALL  = ' '
*  NO_DEQUEUE  = ' '
*  NO_ROLLBACK_WORK  = ' '
  IMPORTING
  return  = ls_return
  TABLES
  materialdescription  = materialdescriptions
*  UNITSOFMEASURE  = UNITSOFMEASURE
*  UNITSOFMEASUREX  = UNITSOFMEASUREX
*  INTERNATIONALARTNOS  = INTERNATIONALARTNOS
*  MATERIALLONGTEXT  = MATERIALLONGTEXT
*  TAXCLASSIFICATIONS  = TAXCLASSIFICATIONS
*  RETURNMESSAGES  = RETURNMESSAGES
*  PRTDATA  = PRTDATA
*  PRTDATAX  = PRTDATAX
  extensionin  = lt_extensionin
  extensioninx  = lt_extensioninx.

Tutorial Comments

Total Comments: Add your Comment
29 Mar 2018

Good tutorial with step by step Update MARA custom fields using material BAPI_MATERIAL_SAVEDATA.realy helpful.good work.

29 Mar 2018

This is really a good solution.the way you have provided..thank u so much

29 Mar 2018

THE ABOVE CODE IS RESULTING DUMP

29 Mar 2018

THE ABOVE CODE IS RESULTING DUMP

29 Mar 2018

GOOD EXPLANATION. BUT THERE WAS A PROBLEM IN CODING PART FIRST OF ALL SYNTACTICAL ISSUES. BUT THE WAY OF YOUR EXPLANATION IS VERY GOOD.

04 May 2021

how was viagra discovered https://loxviagra.com/ will a walk-in clinic prescribe viagra

10 May 2021

trial pack cialis viagra levitro http://cialisee.com/ buy generic cialis generic cialis

10 May 2021

trial pack cialis viagra levitro http://cialisee.com/ buy generic cialis generic cialis

10 May 2021

is cheap viagra safe https://llviagra.com/ - foods that work as viagra can i take viagra after drinking

10 May 2021

is cheap viagra safe https://llviagra.com/ - foods that work as viagra can i take viagra after drinking

11 May 2021

pfizer viagra https://loxviagra.com/ what would happen if a woman takes viagra

11 May 2021

pfizer viagra https://loxviagra.com/ what would happen if a woman takes viagra

13 May 2021

genaric cialis http://rcialisgl.com/ - cialis no consultation online cialis florida delivery

13 May 2021

genaric cialis http://rcialisgl.com/ - cialis no consultation online cialis florida delivery

14 May 2021

alternative for viagra https://jokviagra.com/ - what exactly does viagra do? buy viagra online canadian

14 May 2021

alternative for viagra https://jokviagra.com/ - what exactly does viagra do? buy viagra online canadian

14 May 2021

Nimotop trusted canadian pharmacy Celebrex

14 May 2021

Nimotop trusted canadian pharmacy Celebrex

15 May 2021

buy cialis from india http://ucialisdas.com/ - cialis for cheap cialis dosage

15 May 2021

buy cialis from india http://ucialisdas.com/ - cialis for cheap cialis dosage

17 May 2021

Ampicillin http://xlnpharmacy.com/ canadian pharmacy online viagra

17 May 2021

Ampicillin http://xlnpharmacy.com/ canadian pharmacy online viagra

17 May 2021

genuine cialis no prescription http://cialisee.com/ - cialis black 800 mg pill house cheap cialis

17 May 2021

genuine cialis no prescription http://cialisee.com/ - cialis black 800 mg pill house cheap cialis

Leave a Comment

Enter Comment Text