2008 Feb 04 9:59 PM
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
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]
2008 Feb 04 10:15 PM
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]
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |