11-30-2007 7:03 AM
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
11-30-2007 7:20 AM
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.