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

Timeout when foreground & background run concurrently using SD_SALESDOCUMENT_CREATE

Former Member
0 Likes
1,124

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.

3 REPLIES 3
Read only

former_member15255
Active Participant
0 Likes
697

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

Read only

PeterJonker
Active Contributor
0 Likes
697

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).

Read only

arindam_m
Active Contributor
0 Likes
697

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