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: 

can we write COMMIT WORK AND WAIT statement immediate next to SUBMIT and RETURN

2,687

Hi experts,

i am calling standard program RM06INPO in my custom prog. can we write COMMIT WORK AND WAIT statement immediate next to SUBMIT and RETURN.

Can anyone please let me know if doing a submit/commit will this cause any issues ?

9 REPLIES 9

babu_gavi
Explorer
0 Kudos
1,474

if its a last action in your program you can write the COMMIT WORK AND WAIT. before that you have to check sy-subrc value after submit statement.

0 Kudos
1,474

Thank for your reply.

PO split operation, PIR updation, condition record updation,finally netprice and info record updataion. all these happens in one custom program. here sometime i am getting error "User JOBMAN already processing Purchase order XXXXX" . i have using bapi_transaction_commit with wait 'X". i could not find why the error was coming while running huge records in background mode.

i am suspecting that error may come, while submit std program for netprice and info record updataion. so i am planning to write COMMIT WORK AND WAIT after standard program completion. please suggest me

FredericGirod
Active Contributor
0 Kudos
1,474

You have to do a COMMIT after the SUBMIT if you need an update of the database before next actions.

If you do not have other actions, you don't need it

faebulicious
Explorer
1,474

SUBMIT AND RETURN creates a new internal session. The session and the LUW of the calling program are preserved. If you have any uncommitted data an you want them to be commited right after der SUBMIT it is ok.

0 Kudos
1,474

Thank for your reply.

PO split operation, PIR updation, condition record updation,finally netprice and info record updataion. all these happens in one custom program. here sometime i am getting error "User JOBMAN already processing Purchase order XXXXX" . i have using bapi_transaction_commit with wait 'X". i could not find why the error was coming while running huge records in background mode.

i am suspecting that error may come, while submit std program for netprice and info record updataion. so i am planning to write COMMIT WORK AND WAIT after standard program completion. please suggest me

1,474

If think your problem is not really related to the commit (and wait). You should really find out when and why the error occur and implement a safe error handling fallback.

0 Kudos
1,474

Thank you so much your reply.

we can't find out the exact place where the error came. y because while running with huge data in background mode we got the error.monthly once we got. but the program is running daily. the last step of my program is netprice and info record updataion by submit standard program. so we were suspecting that if we put commit work and wait statement it will wait all LUW get completed.

pls correct me if i am wrong.

inside the program all the bapi was committed with wait statement and table modification also with commit work statement. still we are getting same error

1,474

COMMIT WORK AND WAIT does not affect the LUW of the submitted report, because it is started in it's own session and LUW. The report gets committed implicitly at the end, if not forced by the report itself.

For more information check the documentation about SUBMIT and COMMIT WORK [AND WAIT].

You're really should adapt your programm to handle (and maybe log) all errors. This way you would be able to identify at which point the error might occur...

Sandra_Rossi
Active Contributor
0 Kudos
1,474

You ask if it's okay to do that:

SUBMIT program AND RETURN.
COMMIT WORK AND WAIT. " <====== ????

It's really unusual to do that because the program should itself decide of doing COMMIT WORK or ROLLBACK WORK, not you.

If there are some bugs in the submitted program (i.e. it didn't use COMMIT WORK and ROLLBACK WORK), if you add COMMIT WORK after SUBMIT, only the database updates executed directly by the submitted program will be committed, but everything delegated to an update task will be lost/not started because the submitted program and the calling program are in a different internal session/in a different SAP LUW. The only possibility to execute the update task is to enhance the submitted program with a COMMIT WORK.