‎2013 Apr 30 4:45 AM
Hi gurus,
I have a program to create sales documents using SD_SALESDOCUMENT_CREATE. The program can be run in foreground & background.
It works fine if when the program is executed in foreground when there is no other background job running. But the foreground processing will fail with time out error when there is another background job for this program that is running concurrently.
Appreciate assistance.
Thank you in advance.
‎2013 Apr 30 5:49 AM
Hello Prakesh,
Can you please check the performance making use of the tool SAT/SE30. Hope you have made use of locks before actually processing the sales orders if not that could be one of the issues.
Regards
Suresh Nair
‎2013 May 01 2:04 PM
Looks like there is a lock on the number range set by one of the two programs (probably the background one). The other program tries to access the number range to get a new sales order number but fails.
You could solve this by changing your program where you first check if another instance is running already. Implement the singleton pattern.(ABAP OO) or call the lock mechanism for a report at the start of your program
See e.g. http://scn.sap.com/thread/1838118
If you want to try until the lock is finished, place the call to the enqueue function module in a while loop (on sy-subrc).
‎2013 May 03 6:03 AM
Hi,
It look like from the DUMP sceenshot that the creation process hits the NRIV table quiet frequently as both your background and your foreground programs try to access the same number range. You can try to use the locks (Lock Obj. ESNRIV) associated with the usage of the table for better access of this and hence improve the execution.
Also for the background jobs to be more efficient you can design to trigger multiple jobs for a set of input values. Say before you use the BAPI SD_SALESDOCUMENT_CREATE. create a job for first 50 entries then for next 50 another job.
Also you can use SET UPDATE TASK LOCAL feature in SAP along with CALL FUNCTION ... IN UPDATE TASK this can help you in better processing management.
Cheers,
Arindam