cancel
Showing results for 
Search instead for 
Did you mean: 

background processing thru submit

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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