on 02-25-2008 11:07 AM
Dear All,
I am using Job_open, Submit <> via Jobname <> and job_close option. but still I am unable to execute the report in background as the same doesn't get schedule. I wanted to konw how the name of the job should be specified as it is not creating any job with the name i am providing.
regards
ag
Hello Friend,
Try this code for example.
Say you have two programs prog-1 and prog-2 may or may not have same selection-screen parameters. And you are calling prog-1 from prog-2.
Write the below code in prog-2.
Select-options:...................
DATA: jobnam TYPE btcjob value 'JOB1',
job_released TYPE c,
cnt LIKE tbtcjob-jobcount,
stpn LIKE tbtcjob-stepcount,
strim TYPE c VALUE 'X',
p_params like pri_params.
initialization.
-
-
start-of-selection.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = jobnam
SDLSTRTDT = sy-datum
SDLSTRTTM = sy-uzeit
JOBCLASS = 'A'
IMPORTING
JOBCOUNT = cnt
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4
.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
expiration = 8
immediately = ' '
new_list_id = 'X'
no_dialog = 'X'
release = 'X'
IMPORTING
out_parameters = p_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
SUBMIT prog-1 TO SAP-SPOOL
SPOOL PARAMETERS p_params
WITHOUT SPOOL DYNPRO
VIA selection-screen
USER sy-uname
VIA JOB jobnam NUMBER cnt AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = cnt
jobname = jobnam
strtimmed = 'X'
IMPORTING
job_was_released = job_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.
end-of-selection.
Hope this is helpful, if so reward.
Regards,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.