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

Method to Upload the Materials Master.

Former Member
0 Likes
7,796

Hi,

I am writing the code to upload the Materials Master. I know of a fe methodology.

1. LSMW.

2. Custom Program.

3. BAPI.

Recording/BDC might be used. But I want to Evaluate the Pros and cons, Because depending upon the material type ( MTART ) the views will be different and I may not be able to record the screens in BDC since it changes based on the Material type. I alos have the requirement for QM View and also the Altrenate UOM Screen.

I tried checking the BAPI but there is none for the MM upload. What reamains is the Custom program again in which I will have to write the BDC only.

The BAPI I tried finsing out are 'BAPI_STANDARDMATERIAL_CREATE' and BAPI_RETAILMATERIAL_CREATE but they do not have enough parameters to put in the data for all the view. Also it uses the CALL TRANSACTION MM01  Internally.

We fianlly decided to write a custom program.

Can any one tell me the best Method for the uplaod of the MM master and also how should I select the views based on the Material type.

Regards,

Deepak.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,310

Hi Deepak,

You have to do BDC recording for each Material type and handle the screen sequence in your program accordingly.

Regards

Praveen

23 REPLIES 23
Read only

Former Member
0 Likes
6,311

Hi Deepak,

You have to do BDC recording for each Material type and handle the screen sequence in your program accordingly.

Regards

Praveen

Read only

matt
Active Contributor
0 Likes
6,310

BDC is the last alternative when nothing else works. As it is reliant on the screen's not changing, it is not a stable solution. I've been using MAINTAIN_MATERIAL_DARK and the BAPIs for material maintenance for over 10 years.

If you are doing a data migration program, then use LMSW, and the material direct input procedure. To use anything else is re-inventing the wheel and a waste of time.

I repeat. Do not use BDC.

Read only

Former Member
0 Likes
6,310

hi,

Use a BDC and nothing else.

Burzes

Read only

matt
Active Contributor
0 Likes
6,310

BDC is the worst solution. This is bad advice.

Read only

Former Member
0 Likes
6,310

This message was moderated.

Read only

former_member188827
Active Contributor
0 Likes
6,310

check "BAPI_MATERIAL_SAVEDATA"

Regards

Read only

RaymondGiuseppi
Active Contributor
6,310

In recent years I usually use BAPI_MATERIAL_SAVEDATA (with BAPI_STDMATERIAL_GETINTNUMBER).

Before I used report RMDATIND (LSWM 0020 Material Master, Direct Input) but only for initial loading or big batches of material.

Since 4.6C I don't use BDC when I can, I dislike upgrade projects with BDC to rewrite...

Regards,

Raymond

Read only

Former Member
0 Likes
6,310

Hi Deepak,

Material Master Upload is very basic requirement and you should never ever go for BDC.

SAP has given amazing BAPIs for it.

I will give you two BAPIs/Cases

Case 1 :- Upload 1 material at a time

BAPI_MATERIAL_SAVEDATA

Pros - Good Error handling.

Cons - Comparatively poor performance

Case 2 :- Upload multiple materials at a time

BAPI_MATERIAL_SAVEREPLICA

Pros - Better Performance

Cons - For error handling you need to loop at the return table and segregate the error causes for every material.

Eg :-

Sample Snippet

*-- Head data

ls_headdata_s-function   = 'INS'/'UPD' " use INS for new record, UPD for changing record.

      ls_headdata_s-material   = <uploaded file work area>-matnr.

      ls_headdata_s-matl_type  = <uploaded file work area>-mtart.

      ls_headdata_s-ind_sector = <uploaded file work area>-mbrsh.

.......

      APPEND ls_headdata_s TO lt_headdata_s.

*-- Client Data

ls_clientdata_s-function                     = 'INS'/'UPD' " use INS for new record, UPD for changing record.

      ls_clientdata_s-material                     = <uploaded file work area>-matnr.

      ls_clientdata_s-base_uom                     = <uploaded file work area>-meins.

.......

append ls_clientdata_s to lt_clientdata_s

*-- Similarly form all tables and pass.

        CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA'

          EXPORTING

            noappllog            = gc_check

            nochangedoc          = gc_check

            testrun              = p_test

            inpfldcheck          = 'W'

          IMPORTING

            return               = ls_ret

          TABLES

            headdata             = lt_headdata_s

            clientdata           = lt_clientdata_s

            clientdatax          = lt_clientdatax_s

            plantdata            = lt_plantdata_s

            plantdatax           = lt_plantdatax_s

            storagelocationdata  = lt_storagelocationdata_s

            storagelocationdatax = lt_storagelocationdatax_s

            valuationdata        = lt_valuationdata_s

            valuationdatax       = lt_valuationdatax_s

            salesdata            = lt_salesdata_s

            salesdatax           = lt_salesdatax_s

            materialdescription  = lt_materialdescription_s

            unitsofmeasure       = lt_unitsofmeasure_s

            unitsofmeasurex      = lt_unitsofmeasurex_s

            internationalartnos  = lt_internationalartnos_s

            materiallongtext     = lt_materiallongtext_s

            taxclassifications   = lt_taxclassifications_s

            extensionin          = lt_extensionsin_s

            extensioninx         = lt_extensionsinx_s

            returnmessages       = lt_return2.

Call BAPI_TRANSACTION_COMMIT.

Please revert if you do not understand. I have my code also which you need i can mail you.

BR.

Read only

0 Likes
6,310

Hello Ankit,

Will you be be able to share the codes for uploading mass material master. I want to extend material master from storage location to storage location managed warehouse and WH views.

We have huge list of material master so we want the fastest way to upload material master. Which will be a faster way to extend material master for storage location and WH views:

1. Bapi - BAPI_MATERIAL_SAVEREPLICA

2. LSMW Standard batch input method

Faster reply will be really helpful

regards

Anand

Message was edited by: Suhas Saha

Read only

venkateswaran_k
Active Contributor
0 Likes
6,309

I generally use '

BAPI_MATERIAL_SAVEDATA

It is a working solution for me for many implementations....

Yes, It is comparitively slow, but considering the case as a one time job during materdata upload phase, we generally go with this BAPI...

Do not use BDC in this case....

Regards,

Venkat

Read only

Former Member
0 Likes
6,309

Hey there,

The last weeks i imported material with LSMW. Therefore you can use the BMV0 where you got a quit good logging function.

Cons:

If you customize the transaction mm01 that some field are not showen for specific material you will run into trouble. The filed PRDHA wasn't displayed in mm01 for some types of material, so i got the error:

The field MARA-PRDHA is not ready for input and was therefore not initialized

Haven't tried the bapis right now.

Regards,

Nikolaus

Read only

0 Likes
6,309

Hi Nikolaus,

please map the source structure with the target structure and target structure is BMMH1 - Material Master: Transfer of Main Data, in this structure the filed is present (PRDHA-Product hierarchy-          Type:CHAR, Length: 018)

Please let me know for any clarification.

Regards,

Santosh.

Read only

0 Likes
6,309

Hello Santosh,

Thanks for help, but I already "solved" this problem. I displayed the field again and was able to map it and transfere the data.

But before i done this, i tried to map the field with the value of the *.csv i used, with an empty sting ('') or with the NODATA sign, but everything without success.

Best regards,

Nikolaus

Read only

Former Member
0 Likes
6,309

Hi Deepak,

for uploading the MM records, you can use the LSMW, in that use direct input method (Object:0020), you can get lot of option and it will give you the structure for all the views and you can select the required fields and one important thing is only map the required source structure to target structure (if you map all the source structure to target structure then it will ask to input data which you may not required).

Please let me know for any clarification.

Regards,

Santosh.

Read only

Former Member
0 Likes
6,309

Hello Ankit,

Will you be be able to share the codes for uploading mass material master. I want to extend material master from storage location to storage location managed warehouse and WH views.

We have huge list of material master so we want the fastest way to upload material master. Which will be a faster way to extend material master for storage location and WH views:

1. Bapi - BAPI_MATERIAL_SAVEREPLICA

2. LSMW Standard batch input method

Faster reply will be really helpful

regards

Anand

Message was edited by: Suhas Saha

Read only

0 Likes
6,309

Hi Anand,

Please open a new thread since it will get your query more visibility. As far as code i concerned, mention your email id and i will send my code.

BR.

Read only

0 Likes
6,309

Hi Anand,

Lsmw Standard batch\Direct input methods is really good. I used this one to upload more than 50 k materials with one by one views.You can get all most all the fields which we can see in material master .

Regards,

Madhu.

Read only

0 Likes
6,309

Hello Madhu,

I want to extend the material master not create a new material master so I am wondering if we can use standard batch\Direct input method or not, as i only want to extend sloc and WH views.

Hello Ankit,

I want to upload more than 500,000 material master in background. Using BAPI how to upload so many materials in background as I think BAPI don't execute in background and then we also need log to analyse in case of any errors.

regards

Anand

Message was edited by: Matthew Billingham - email address removed

Read only

0 Likes
6,309

Hi Anand,

As requested please open a new thread. BAPIs(just another function module) are used in programsand can be run in both foreground/online or background mode.

BR.

Read only

0 Likes
6,309

HI,

By direct input you can update the materials with the views you want.

Also you can use BAPI. Regarding tracking the errors, in direct method we get a error log when we update the materials.

In BAPI, IDOC's will be generated. To get the error log in BAPI method, use WE02 transaction and give your IDOC numbers. filter with IDOC status as 51(error) and take the error messages.

Read only

0 Likes
6,309

Hi,

Created new thread.

@Ankit - My abap guy says they cant do upload in background using bapi. Not sure how you saying we can run in background. How do you upload in background.

regards

Read only

Former Member
0 Likes
6,309

Revanth,

Do you mean to say we won't be able to get a error log using LSMW standard batch/table input and it will be slower than the LSMW-BAPI method?

how much time it will take to do LSMW-BAPI method.

regards

Read only

Former Member
0 Likes
6,309

Hello,

I am unable to use BAPI_MATERIAL_SAVEREPLICA bapi to update storage bin. I am able to extend material to storage location, warehouse, storage type but not able to update bin.The field remains blank.

Please advise.

regards

Anand