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: 

Second user's background program in a queue

Former Member
0 Kudos

Hi SDN

If a user executes one zprogram in background and in the same time if another user executes this zprogram in the background then how can we maintain programatically the second user's program in a queue and make it execute after completion of the first one rather than executing simultaneously.

Thanks in Advance.

Regards

Basha

1 REPLY 1

Former Member
0 Kudos

Hi,

You can use the below function module:

open backgroundjob

*****************************

********Declare parameters of function module accordingly

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = JOBNAME

IMPORTING

JOBCOUNT = JOBNUMBER

EXCEPTIONS

CANT_CREATE_JOB = 01

INVALID_JOB_DATA = 02

JOBNAME_MISSING = 03

OTHERS = 99.

****************************

submit ranges table to program

*****************************

SUBMIT REPORTNAME AND RETURN

with <select-options field of Z_REQUEST_BUSINESS_PARTNER_R3 program> in r_range

USER SY-UNAME " User for runtime authorizations

VIA JOB JOBNAME " Job name from job_open function module

NUMBER JOBNUMBER "job number from job_open

*********************************

close the job so that it gets released

**************************************

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

JOBCOUNT = JOBNUMBER

JOBNAME = JOBNAME

strtimmed = 'X' " check this field

Hope this will help you.

Please reward if helpful.

Thank you.