Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI

Former Member
0 Likes
252

how to upload material master data using bapi.

as i was new to bapi, can anyone explain step by step process to upload material using bapi

1 REPLY 1
Read only

Former Member
0 Likes
219

Hi,

Welcome to SDN.............

here is the sample program which excepts the material plant and the ABC indictor value and updates the material master using the BAPI.

code

report zrich_0001 .

data: headdata type bapimathead.

data: plantdata type bapi_marc.

data: plantdatax type bapi_marcx.

data: return type bapiret2 .

data: returnm type table of bapi_matreturn2 with header line.

data: xmara type mara.

parameters: p_matnr type marc-matnr,

p_werks type marc-werks,

p_maabc type marc-maabc.

select single * from mara into xmara

where matnr = p_matnr.

headdata-material = xmara-matnr.

headdata-ind_sector = xmara-mbrsh.

headdata-matl_type = xmara-mtart.

headdata-mrp_view = 'X'.

plantdata-plant = p_werks.

plantdata-abc_id = p_maabc.

plantdatax-plant = p_werks.

plantdatax-abc_id = 'X'.

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

headdata = headdata

plantdata = plantdata

plantdatax = plantdatax

importing

return = return

tables

returnmessages = returnm.

check sy-subrc = 0.

[/code]