Application Development and Automation 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: 
Read only

schedule a program with JOB_SUBMIT

Former Member
0 Likes
3,320

Hi Friends,

I need to execute a program using function modules JOB_OPEN, JOB_SUBMIT, JOB_CLOSE when ever i executed

(i.e; similar to Background scheduling immediatly using SM36, sm37)

please help me in the code,

i have written a sample program using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE function modules,

but in SP01, i am able to see many jobs under my user.

How can i avoid multiple Background jobs triggering when i execute a program once using above function modules.

Thanks in Advance,

Ganesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,606

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = <JOB NAME>

IMPORTING

jobcount = tbtcjob-jobcount

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

repid = <REPORT NAME>.

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = tbtcjob-authcknam

jobcount = tbtcjob-jobcount

jobname = tbtcjob-jobname

report = repid

variant = raldb-variant

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobname = tbtcjob-jobname

jobcount = tbtcjob-jobcount

strtimmed = 'X'

EXCEPTIONS

OTHERS = 01.

ENDIF.

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
1,607

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = <JOB NAME>

IMPORTING

jobcount = tbtcjob-jobcount

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

repid = <REPORT NAME>.

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = tbtcjob-authcknam

jobcount = tbtcjob-jobcount

jobname = tbtcjob-jobname

report = repid

variant = raldb-variant

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobname = tbtcjob-jobname

jobcount = tbtcjob-jobcount

strtimmed = 'X'

EXCEPTIONS

OTHERS = 01.

ENDIF.

ENDIF.

Read only

0 Likes
1,606

Hi Nilesh,

I worked in the same way but the system has creating multiple BACTH-JOBS

when i opened SP01 many Spools are there, in SM37 I can see many JOBS in Released Status.

where I got complaint from Basis Team

Please help me

Thanks,

Ganesh