0% found this document useful (0 votes)
950 views3 pages

Bapi Material Extension

This document provides steps to update custom fields in the MARA table using the BAPI_MATERIAL_SAVEDATA function in SAP. It explains appending a structure to include custom fields, then passing this structure in the BAPI call along with other material data.

Uploaded by

anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
950 views3 pages

Bapi Material Extension

This document provides steps to update custom fields in the MARA table using the BAPI_MATERIAL_SAVEDATA function in SAP. It explains appending a structure to include custom fields, then passing this structure in the BAPI call along with other material data.

Uploaded by

anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

SAPNuts.

com
SAP Courses
SAP Tutorials
SAP Certification
FAQ
Docs
My Account
You are here ? SAPNuts

Tutorials

Update custom fields using BAPI extension

Tutorial Name
Update custom fields using BAPI extension
Tutorial Description
Update material custom fields using BAPI extension parameter in SAP, update mate
rial custom fields using BAPI_MATERIAL_SAVDATA
Tutorial Area Advanced ABAP
Prerequisites ABAP
Learning Level Intermediate
Estimated Time to learn 30
Save to Learning List
Save to your Learning List
+ Step1 : Requirement and basic explanation
Step2 : Append structure BAPI_TE_MARA
Step3 : Using extension in BAPI_MATERIAL_SAVEDATA
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 n
eed 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 requiremen
t 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.
Author | Ashok Kumar Reddy Last Updated| 03 Feb 2014 | 2 Comments | F Share
? Previous Tutorial Next Tutorial ?
Tutorial Comments
Total Comments: Add your Comment
indrojit mandal
07 Apr 2014
Good tutorial with step by step Update MARA custom fields using material BAPI_MA
TERIAL_SAVEDATA.realy helpful.good work.
Narendra Pal
27 May 2015
This is really a good solution.the way you have provided..thank u so much
Leave a Comment
Your Name:
Your Email :
Comment Text :
Enter Comment Text
Submit Comment
2015 SAPNuts.com Contribute Terms About Contact Feedback Facebook Twitter Googl
ecc

You might also like