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

Material change data in a single commit possible

Former Member
0 Likes
521

Hi,

I have a internal table of 1000 material , I have a requirement to change the MRP type and Reorder point of each material.

The approach i have done is looping of each material in the internal table calling the BAPI BAPI_MATERIAL_SAVEDATA , for each record i am commiting and rollbacking by calling the BAPI BAPI_TRANSACTION_COMMIT,BAPI_TRANSACTION_ROLLBACK.

it is possible i can do one commit for all the processed record and it should be in such a way the error record needs to be rollbacked also.since the senior person telling me dont commit record wise , do a single commit and your program should be in a position to seperate sucess record and unsucess record and do commit for all sucess record one time and do a rollback for all unsucess record.

Thanks

Ravi

3 REPLIES 3
Read only

Former Member
0 Likes
434

Hi,

The site you have mentioned is not opening , can you provide me the code

Read only

0 Likes
434

Hello

SAP wrote:

Transaction Control in Client

The BAPI transaction model must afford the user explicit transaction control. Therefore, if several BAPIs are called together, the caller can decide him/herself when to execute a COMMIT WORK (or, as the case may be, a ROLLBACK WORK). This means that BAPIs themselves cannot (generally) execute a COMMIT WORK command.

The following restrictions apply to combining several BAPIs in one LUW:

· If an instance was created, modified or deleted by a write BAPI, a read BAPI can only access the most recent data if a COMMIT WORK has taken place.

· It is not possible to make two write accesses on the same instance within one LUW. For example, you cannot first create and then change the object within the same LUW.

You can, however, create several instances of the same object type within an LUW.

If a BAPI executes a COMMIT WORK command, this must be mentioned in the BAPI documentation. This is the only way users are able to know that the BAPI contains a COMMIT WORK command.

These BAPIs must also be documented in SAP Note 0131838, "Collective Note for BAPIs with the Commit Work Command".