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_MATERIAL_SAVEDATA and roll back

former_member211992
Active Participant
0 Kudos

Dear all

im creating basic data by using bapi_material_Savedata in the simulation mode , once i have created basic data i done the roll back..now im trying to create plant data for the material  by calling bapi again here im doing view wise upload ,,now system thro's error material does not exist. because i have done the roll back...my requirement is i have to roll back the basic data after simulating all the views for the material ,,how to acheive this...

Thanks

3 REPLIES 3

former_member182550
Active Contributor
0 Kudos

When you simulate the creation of the material then the database will not be updated.  You therefore shouldn't need a rollback at that point.

However,  to get to the functionality that you want in that nothing should be created if there is a problem for example with a storage location not existing or something then you can pass all of the view data to the Bapi in one call using the Material header structure with the _View parameters checked,  and with all the relevant structures for the views populated.  You can then check the returned messages and if there is a problem then Rollback work otherwise commit work.

To do the operations as a set of discrete Bapi calls means that you will need to commit the data for each view after the basic data.

If you just need to simulate the operation,  set the simulate flag as you are doing.

I would suggest that you have a read about Logical Units Of Work (LUW's) and Rollback/Commit statements.

Regards

Rich

AniketB
Explorer
0 Kudos

Hi Peter,

Could you state the requirement in detail? Why do you want to rollback after the creation of the BASIC data view.

Thanks.

0 Kudos

He has to simulate the creation of the views.  He is rolling back because he is under the impression that there are db records waiting to be committed.