Application Development 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: 

BAPI for material creation which returns the new material number

Former Member
0 Kudos

Hi,

I need a single BAPI or a remote enabled function module to create a material which would return the new Material number generated.

Regards,

Tanveer S.

8 REPLIES 8

Former Member
0 Kudos

Not sure, but BAPI_MATERIAL_SAVEDATA: Used to create/Change a material data, may be useful.

0 Kudos

Hi,

But does it returns MATNR???

Former Member
0 Kudos

Hello Tanveer,

U could use this BAPI <b>BAPI_MATERIAL_SAVEDATA</b>

Please the RETURN PARAMETER & Message table from BAPI.

It will have the MATNR which is created.

If useful reward.

Vasanth

0 Kudos

Hi,

So, does the message field contain the newly created material number??

This BAPI requires a material number as an input field.

I need a BAPI which shall not ask for a new number but shall generate a new number and return it as a parameter.

Regards,

Tanveer.

Message was edited by:

Tanveer Shaikh

0 Kudos

Hello,

U r right. So what u have to do is

there is a special BAPI BAPI_MATERIAL_GETINTNUMBER (should be called first) to be used in combination with BAPI_MATERIAL_SAVEDATA.

This BAPI provides additional parameter for MATERIAL TYPE and INDUSTRY SECTOR. Depending on these parameters and customizing settings - different number ranges are used.

If useful reward.

Vasanth

0 Kudos

Hi,

I am aware of this method but was wondering if there was single BAPI to do the same..

Former Member
0 Kudos

Hi

if this scenario should occur:

run BAPI_MATERIAL_GETINTNUMBER and get next material number

run BAPI_MATERIAL_SAVEDATA and get an error when creating.

Is there a way to rollback the internal number range?!

ROLLBACK WORK doesn't seem to work and, if the BI_SAVEDATA returns with the error, the next try will have the material number X+1, although X was never used.

0 Kudos

Hi,

unfortunally this is just the way SAP works with number ranges ALLWAYS. First get a new number than try booking. If any error occurs ROLLBACK WORK but never reset number ranges. So this behaviour is common at most applications.

If this bothers you too much - at material master you may use EXIT_SAPLMG02_001 and/or EXIT_SAPLMG02_002.

kind regards,

HP