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 program for uploading Material

Former Member
0 Likes
956

hi,

I am new to SAP . Can any one tell me steps involved in uploading Material data using BAPI.

Thanks

5 REPLIES 5
Read only

nirajgadre
Active Contributor
0 Likes
851

Hi,

To upload the material using BAPI try to use BAPI_MATERIAL_SAVEDATA

In this BAPI you need to pass the data into required fields and also need to populate the update structure for the same filed with indicator 'X'.

check the BAPI documentation for more details.

after the BAPI call. use the function mmodule 'BAPI_TRANSACTION_COMMIT*

Read only

nirajgadre
Active Contributor
0 Likes
851

Hi,

To upload the material using BAPI try to use BAPI_MATERIAL_SAVEDATA

In this BAPI you need to pass the data into required fields and also need to populate the update structure for the same filed with indicator 'X'.

check the BAPI documentation for more details.

after the BAPI call. use the function module 'BAPI_TRANSACTION_COMMIT*

Read only

Former Member
0 Likes
851

Hi , refer the bellow sample pice of code

  • Header

BAPI_HEAD-MATERIAL = wa_data-MATNR.

BAPI_HEAD-IND_SECTOR = wa_data-MBRSH.

BAPI_HEAD-MATL_TYPE = wa_data-MTART.

BAPI_HEAD-BASIC_VIEW = 'X'.

BAPI_HEAD-PURCHASE_VIEW = 'X'.

BAPI_HEAD-MRP_VIEW = 'X'.

BAPI_HEAD-STORAGE_VIEW = 'X'.

BAPI_HEAD-ACCOUNT_VIEW = 'X'.

BAPI_HEAD-COST_VIEW = 'X'.

BAPI_MARC1-plant = wa_data-WERKS .

BAPI_MARD1-STGE_LOC = wa_data-LGORT.

BAPI_MARD1-plant = wa_data-WERKS .

BAPI_MARDX-plant = wa_data-WERKS .

BAPI_MARCX-plant = wa_data-WERKS .

BAPI_MARDX-STGE_LOC = wa_data-LGORT.

BAPI_MARA1-OLD_MAT_NO = wa_data-bismt.

BAPI_MARA1-EXTMATLGRP = wa_data-EXTWG.

BAPI_MARA1-DIVISION = wa_data-SPART.

BAPI_MARA1-MAT_GRP_SM = wa_data-MAGRV.

BAPI_MARAX-MATL_GROUP = 'X'.

BAPI_MARAX-BASE_UOM = 'X'.

BAPI_MARAX-OLD_MAT_NO = 'X'.

BAPI_MARAX-EXTMATLGRP = 'X'.

BAPI_MARAX-DIVISION = 'X'.

BAPI_MARAX-MAT_GRP_SM = 'X'.

*MRP 1

BAPI_MARC1-MRP_TYPE = wa_data-DISMM.

BAPI_MARC1-REORDER_PT = wa_data-MINBE.

BAPI_MARC1-MRP_CTRLER = wa_data-DISPO.

BAPI_MARC1-LOTSIZEKEY = wa_data-DISLS.

BAPI_MARC1-MAX_STOCK = wa_data-MABST.

BAPI_MARCX-MRP_TYPE = 'X'.

BAPI_MARCX-REORDER_PT = 'X'.

BAPI_MARCX-MRP_CTRLER = 'X'.

BAPI_MARCX-LOTSIZEKEY = 'X'.

BAPI_MARCX-MAX_STOCK = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = BAPI_HEAD

CLIENTDATA = BAPI_MARA1

CLIENTDATAX = BAPI_MARAX

PLANTDATA = BAPI_MARC1

PLANTDATAX = BAPI_MARCX

STORAGELOCATIONDATA = BAPI_MARD1

IMPORTING

RETURN = BAPI_RETURN

TABLES

MATERIALDESCRIPTION = IT_MAKT

UNITSOFMEASURE = IT_MARM

UNITSOFMEASUREX = IT_MARMX

MATERIALLONGTEXT = IT_MLTX

TAXCLASSIFICATIONS = IT_MLAN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Regards

Read only

Former Member
0 Likes
851

use function module BAPI_MATERIAL_SAVEDATA

and if you hav eto us internal number range use FM BAPI_STDMATERIAL_GETINTNUMBER

if you want to know the procedure how to work with BAPI to upload materian then follow as below

1. go to MM01 and try to create a material and note down the mandatory fields and then go to display mode and check for the other fileds that have data other that what u have given because screen will automatically flow related data based on the data that you have given inputs in the previous screen but for BAPI you have to pass all the field. this is the place where u will find problem

2. no you have all the fields go to BAPI FM and check for mandatory structures

3. now read the documentation of the FM and check for precious information

4. go to FM and open the structures and check for the fields

now you pass to the FM

regards,

venkat suman.

Read only

Former Member
0 Likes
851

Thanks