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: 

job open synchronous

Valeck
Participant
0 Kudos

hi guru,

i need to launch a program by this formula:

*&---------------------------------------------------------------------*
*& Report ZTEST_VA
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest_va.


DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.



CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT zsubmitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
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.
...
ENDIF.
ENDIF.
ENDIF.

is it possible to take the response of the program launched zsubmitable synchronously in the program that launches the job?

3 REPLIES 3

FredericGirod
Active Contributor

Could clarify your requierment ?

raymond_giuseppi
Active Contributor

There are options to get the results of RFC enabled FM, but not for reports submitted in the background.

Either

Sandra_Rossi
Active Contributor
0 Kudos
  1. A background job runs asynchronously, so you must wait for its end.
  2. If you want to run synchronously, don't run the program as a background job.
  3. You may also trigger code within the background job after the submitted program has run (but the program which submitted the job lives independently, see point 1).

Please clarify your requirement if you need further help.