07-10-2006 3:45 PM
Hi Friends,
i have a job to submit. the report name is RKGALKSU5 (Actual Assessment). the variant is VAR1. the parameters to be passed to the selectio-screen is stored in RSPARAMS internal table. it has more than one cycle to submit.
right now i am using
SUBMIT RKGALKSU5 USING SELECTION-SET 'VAR1'
WITH SELECTION-TABLE IT_RSPARAMS1
VIA JOB 'ASSESSMENT1' NUMBER JOBNUMBER1
AND RETURN.
but the problem is all the cycles are executed in parallel.
how can i submit the job in steps.
usign job submit how to do the job steps
where should i passs the parameters for selection screen in the function module job_submit.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
AUTHCKNAM =
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
JOBCOUNT = JOBNUMBER2
JOBNAME = 'ASSESSMENT2'
LANGUAGE = SY-LANGU
PRIPARAMS = IT_RSPARAMS2
REPORT = RKGALKSU5 VARIANT = VAR1
IMPORTING
STEP_NUMBER = STEP2
EXCEPTIONS
BAD_PRIPARAMS = 1
BAD_XPGFLAGS = 2
INVALID_JOBDATA = 3
JOBNAME_MISSING = 4
JOB_NOTEX = 5
JOB_SUBMIT_FAILED = 6
LOCK_FAILED = 7
PROGRAM_MISSING = 8
PROG_ABAP_AND_EXTPG_SET = 9
OTHERS = 10
.
Thanks in Advance
07-10-2006 4:58 PM
Is this what you are looking for?
call function job_open.
loop at cost center groups.
SUBMIT RKGALKSU5 USING SELECTION-SET 'VAR1'
WITH SELECTION-TABLE IT_RSPARAMS1
VIA JOB 'ASSESSMENT1' NUMBER JOBNUMBER1
AND RETURN.
endloop.
call function job_close.
This way it will open one job with multiple steps.
07-10-2006 3:49 PM
One option is to create a new job each time using JOB_OPEN and start the 2nd job after the 1st job has completed.
You need to use the parameters PREDJOB_CHECKSTAT,
PRED_JOBCOUNT and PRED_JOBNAME in the function JOB_CLOSE.
-Kiran
*Please reward useful answers
07-10-2006 4:38 PM
Hi Kiran,
thanks for your prompt reply. i will give u the clear picture. two cycles are created for each costcenter (iteration1 and iteration2 cycles). if it is a costcenter groupd more than one iteration1 and iteration2 cycles. all the cycles for iteration1 are collected in one internal table......IT_RSPARAMS1 which is the selection-table containg the parameters to be sent to the selection screen for program RKGALKSU5. similrly iteration2 cycles in IT_RSPARAMS2.
suppose there are 20 costcenters in costcenter group.
then 20 cyles each for both iteration1 and iteration2.
now i need to submit these cycles for execution.
iteration1 cycles are submitted as job1 and then job2 for iteration2.
for iteration1 i used
job_open.
SUBMIT RKGALKSU5 USING SELECTION-SET 'VARTEST2'
WITH SELECTION-TABLE IT_RSPARAMS1
VIA JOB 'ASSESSMENT1' NUMBER JOBNUMBER1
AND RETURN.
job_close.
with this all the iteration1 cycles (20) are getting executed in parallel. but i want them as jobsteps.
i tried to loop
loop at it_rsparams1.
job_open.
SUBMIT RKGALKSU5 USING SELECTION-SET 'VARTEST2'
WITH SELECTION-TABLE IT_RSPARAMS1
VIA JOB 'ASSESSMENT1' NUMBER JOBNUMBER1
AND RETURN.
job_close.
endloop.
but getting errors.
i am wondering whether we can do jobsteps with job_submit.
the program to run is RKGALKSU5 and parameters for selection screen are IT_RSPARAMS1 ( contains all 20 iteration1 cycles) . and the variant is VAR1.
suggest where to pass the above to the attributes of job_submit.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
AUTHCKNAM = 'SY-UNAME'
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = IT_RSPARAMS1
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
JOBCOUNT = JOBNUMBER1
JOBNAME = 'ASSESSMENT1'
LANGUAGE = SY-LANGU
PRIPARAMS = IT_RSPARAMS1
REPORT = REPORTNAME
VARIANT = VARNAME
IMPORTING
STEP_NUMBER = STEP1
EXCEPTIONS
BAD_PRIPARAMS = 1
BAD_XPGFLAGS = 2
INVALID_JOBDATA = 3
JOBNAME_MISSING = 4
JOB_NOTEX = 5
JOB_SUBMIT_FAILED = 6
LOCK_FAILED = 7
PROGRAM_MISSING = 8
PROG_ABAP_AND_EXTPG_SET = 9
OTHERS = 10
Thanks
07-10-2006 4:52 PM
Hey,
I am not sure how to add steps to a job programatically but I had a similar problem sometime back and I created 2 separate jobs and made the 2nd job run after the 1st job was over. It is similar to having 2 steps in a single job as the 2nd step would start processing after the 1st step has finished.
Sample code below:
Create both the reports below:
REPORT zkartest.
DO 500000 TIMES.
WRITE:/ sy-index.
ENDDO.
REPORT zjobtest.
DATA: jobcount1 LIKE tbtcjob-jobcount,
jobname1 LIKE tbtcjob-jobname,
jobcount2 LIKE tbtcjob-jobcount,
jobname2 LIKE tbtcjob-jobname,
date LIKE tbtcjob-sdlstrtdt,
time LIKE tbtcjob-sdlstrttm,
index(2) TYPE c.
DO 5 TIMES.
index = sy-index.
CONCATENATE 'ZTESTKAR' index INTO jobname1.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobgroup = 'TEST'
jobname = jobname1
IMPORTING
jobcount = jobcount1
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE i000(vz) WITH 'Error in function' 'OPEN'.
ENDIF.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobcount = jobcount1
jobname = jobname1
report = 'ZKARTEST'
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10.
IF sy-subrc NE 0.
MESSAGE i000(vz) WITH 'Error in function' 'SUBMIT'.
ENDIF.
IF sy-index = 1.
date = sy-datum.
time = sy-uzeit + 120 .
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount1
jobname = jobname1
sdlstrtdt = date
sdlstrttm = time
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc NE 0.
MESSAGE i000(vz) WITH 'Error in function' 'CLOSE'.
ENDIF.
ELSE.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount1
jobname = jobname1
predjob_checkstat = 'X'
pred_jobcount = jobcount2
pred_jobname = jobname2
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc NE 0.
MESSAGE i000(vz) WITH 'Error in function' 'CLOSE'.
ENDIF.
ENDIF.
jobname2 = jobname1.
jobcount2 = jobcount1.
ENDDO.
-Kiran
*Please reward useful answers
07-10-2006 4:58 PM
Is this what you are looking for?
call function job_open.
loop at cost center groups.
SUBMIT RKGALKSU5 USING SELECTION-SET 'VAR1'
WITH SELECTION-TABLE IT_RSPARAMS1
VIA JOB 'ASSESSMENT1' NUMBER JOBNUMBER1
AND RETURN.
endloop.
call function job_close.
This way it will open one job with multiple steps.
07-10-2006 5:05 PM
Just tried what Srinivas has suggested and it WORKS!!!. Just need to call the function JOB_SUBMIT in the loop.
07-10-2006 9:29 PM
Thanks Srinivas ur suggestion solved my problem.
Thanks Kiran for your responses. they were helpful.