‎2004 Apr 22 7:37 AM
Hi,
Lets say I am executing a report program. Now I would like to start a Background Job, which should start once this internal session is complete, is there any means of achieving the same.
Like in this case once the report is done, it should start executing the background job.
Regards,
Pavan
‎2004 Apr 22 9:24 AM
‎2004 Apr 22 8:58 PM
Hi,
Yes I need to schedule a report as the back ground job.
Any inputs on the same.
Regards,
Pavan
‎2004 Apr 22 10:14 AM
Hi Pavan,
Possibly you can set the background job to start after an event is triggered. You can Raise the event from your program. The job will be started when this event is triggered.
regards,
Tathagata
‎2004 Apr 22 8:59 PM
Hi Thathagata,
Unfortunately I cannot use raise event.
Regards,
Pavan
‎2004 Apr 23 4:53 AM
Hi Pavan,
In such a scenario possibly you can configure the two reports as two steps of the job. Completion of Step 1 would lead to Step 2. Just try configuring such a job in SM36.
Possibly this could solve your problem.
Regards,
Tathagata
‎2004 Apr 23 1:34 PM
Hi Pavan,
there are function modules JOB_OPEN and JOB_CLOSE:
CALL FUNCTION <b>'JOB_OPEN'</b>
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = <b>cl_jobname</b>
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
IMPORTING
jobcount = wl_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
.
IF sy-subrc <> 0.
...
ENDIF.
PERFORM get_print_parameters
CHANGING sl_pri_params sl_arc_params wl_valid.
IF wl_valid <> space.
<b>SUBMIT</b> ztprprotokoll LINE-SIZE 200
WITH a_trkorr = wf_trkorr
TO SAP-SPOOL
SPOOL PARAMETERS sl_pri_params
ARCHIVE PARAMETERS sl_arc_params
WITHOUT SPOOL DYNPRO
USER wf_user+2 VIA JOB <b>cl_jobname</b> NUMBER wl_jobcount
AND RETURN.
ENDIF.
2. Transportprotokoll ablegen ...
... wenn Quellsystem C11!
IF wf_trkorr(4) = 'C11K'.
sl_arc_params-info = 'TP'.
CONCATENATE 'Transportprotokoll' wf_trkorr INTO
sl_arc_params-arctext SEPARATED BY space.
PERFORM get_print_parameters
CHANGING sl_pri_params sl_arc_params wl_valid.
IF wl_valid <> space.
<b>SUBMIT</b> rddprott WITH pv_korr = wf_trkorr
TO SAP-SPOOL
SPOOL PARAMETERS sl_pri_params
ARCHIVE PARAMETERS sl_arc_params
WITHOUT SPOOL DYNPRO
USER wf_user+2 VIA JOB <b>cl_jobname</b> NUMBER wl_jobcount
AND RETURN.
ENDIF.
ENDIF.
CALL FUNCTION <b>'JOB_CLOSE'</b>
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = wl_jobcount
jobname = cl_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
strtimmed = 'X'
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
IMPORTING
JOB_WAS_RELEASED =
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2004 Apr 23 5:45 PM
Hi Martin,
Thanks a lot for your reply.
But report one is executed online, by the user. The scenario is as such, User is executing some program, which locks particular entries.
Now I need to execute the subsequent report immediately the first program ends, so that the locks are not acquired by someone else, and the second program has to run only after the first program ends.
Regards,
Pavan
‎2004 Apr 26 10:58 AM
Hi Pavan,
are the programs Z-reports? Then you could lock the objects by yourself and start the second report in the first.
Otherwise you could use submit-statements for calling standard reports in a selfwritten program.
Regards,
Martin
‎2004 Apr 26 11:38 AM
If both programs are Z reports then you could simply use the SUBMIT statement at the end of the first report.
Otherwise if the first one is an SAP report then one way to do it would be to create a wrapper report, by this i mean a report that will have the same selection screen(copy sap program) as the SAP report for the user to enter his/her details into. The report then calls the SAP report using the user selection then imediatly calls the zreport. Only down side would be that the user would have to execute a different transaction than they may be used to(i.e. that associated to the wrapper report).
Hope this helps
regards
Mart
Message was edited by: Mart
‎2004 Apr 27 6:07 AM
Actually the work arounds are fine guys. I am completely happy with the work arounds, in fact we have also achieved a work around, using lock objects as indicated by martin.
But what exactly i am looking for was, just like we could schedule a batch job on termination of another job. Is there some way we can identify the current session as well, and say that on the termination of this session start the next one.
Regards,
Pavan