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

Problem in uploading material master data using BAPI?

Former Member
0 Likes
589

Hi all,

I am using BAPI_MATERIAL_SAVEDATA to create material master . Though i am successfully creating materials, i have a problem with number range.

I am using another BAPI i.e BAPI_MATERIAL_GETINTNUMBER and passing the material number to BAPI_MATERIAL_SAVEDATA .

if my input file has 4 records , out of which 3 record is not maintained with sufficient data. So it is not creating material for that , but for next material it is creating with next number.

I mean if 1000 is created and 1001 is not created because of error and next it is creating with 1002 .

But my requirement is to create 1001 instead of 1002.

Please help me on how to solve this problem?

Thanks,

Vamshi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

Hi Vamshi,

You have 4 materials in the file and you are calling the BAPI to generate a number before passing the data to the BAPI to create Material, when you are doing it for the first material call the BAPI to generate the material number and then pass the data to the BAPI which creates the material and then check the BAPI Return table whether the material is successfully created or not. If it is created before creating the second material get the next number otherwise use the existing number itself for the second material.

Thanks,

Mahesh.

4 REPLIES 4
Read only

Former Member
0 Likes
492

Hi Krishna,

it will be like that only, because the BAPI will use a number each time (error/sucessful) it runs.

you have to handle it through coding.

What you can do is.

first time use BAPI_MATERIAL_GETINTNUMBER with a different number range than the actual one and check the return parameters of BAPI_MATERIAL_SAVEDATA

if sucess then run the BAPI_MATERIAL_SAVEDATA with actual number range. it might be not the best solution..but can't think of anything else right now and this time you commit the BAPI.

Regards,

Sachin

Read only

Former Member
0 Likes
493

Hi Vamshi,

You have 4 materials in the file and you are calling the BAPI to generate a number before passing the data to the BAPI to create Material, when you are doing it for the first material call the BAPI to generate the material number and then pass the data to the BAPI which creates the material and then check the BAPI Return table whether the material is successfully created or not. If it is created before creating the second material get the next number otherwise use the existing number itself for the second material.

Thanks,

Mahesh.

Read only

0 Likes
492

Hi Mahesh,

Thanks for the reply and the problem solved now.

Thanks,

Vamshi.

Read only

0 Likes
492

Hi,

I also got the same problem.

i have created the same way which you said.

first i upload the flat file with 4 records. like 100, 101 , 102, 103, 104. suppose 104 is error record.

next time if i again run the programe, with different flat file . now it is taking 105 ,106 like ,but it is not starting from 104(previous flat file it is error record).

can any one pl tell me how to do that.

Thank's

pratap