We have moved our domain from sapnuts.com to zapnuts.com, please bookmark and share.

Update custom fields using BAPI extension

Author | Last Updated| | 10 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.

01 Feb 2022

albuterol 108 mcg albuterol inhaler side effects salbutamol inhaler akins health food store

27 Apr 2022

viagra without prescription better than viagra

29 Apr 2022

low cost kamagra kamagra oral jelly

30 Apr 2022

what does viagra do for women viagra pills

10 May 2022

ivermectin for humans ivermectin

Leave a Comment

Enter Comment Text