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

Create Material with reference

Former Member
0 Likes
620

Hi all. I have the next requeriment:

On a Z program, a user creates a relation between 2 material in 2 different plants, when the material on the 2nd plant doesn't exist must be created as a copy of the original material. For example:

Original MATNR --> MATERIAL01

Original WERKS --> IN55

Copy MATNR --> MATERIAL02

Copy WERKS --> IN25

In this case, the material MATERIAL02 doesn't exist in the IN25 Plant, so it must be created as a copy of the MATERIAL01.

This could be done manually on MM01 trx and adding the MATERIAL01 value as the reference material, but this needs to be done automatically, and the easiest way to do it is using BAPI.

Does anybody know a BAPI to do this??

Thanx.

Jesus

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
563

You can use the BAPI_MATERIAL_SAVEDATA. You will have to get all of the data for the reference material, then swap the material number, then call the BAPI.

Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
564

You can use the BAPI_MATERIAL_SAVEDATA. You will have to get all of the data for the reference material, then swap the material number, then call the BAPI.

Regards,

Rich Heilman

Read only

0 Likes
563

Thanx Rich, but the material MATERIAL01 already exist... so is there a way to get ALL THE DATA of this material into the tables used by the BAPI_MATERIAL_SAVEDATA?

Thanx.

Jesus

Read only

0 Likes
563

I think that you could get some of it using BAPI_MATERIAL_GET_DETAIL.

Regards,

Rich Heilman