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

sample code for job scheduling

former_member841898
Participant
0 Likes
921

hi all,

can anyone give me the sample code for job scheduling.

job scheduling is to be done programitically(not using tcode sm36 and sm37)

and then to display it withouut going to spool. the program to execute at particular date and time and should have a variant.

urgent.

thanks

pankaj

8 REPLIES 8
Read only

gopi_narendra
Active Contributor
0 Likes
751

Make use of the FMs' : JOB_CLOSE, JOB_OPEN, JOB_SUBMIT

Regards

Gopi

Read only

0 Likes
751

hi gopi,

can u send me sample code, i m new in apap.

regards

pankaj

Read only

Former Member
0 Likes
751

Hi,

check this sample code

Check this sample code..

DATA: p_jobcnt LIKE tbtcjob-jobcount,

l_release(1) TYPE c.

  • Open the job

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = 'ZMY_OBJ'

IMPORTING

jobcount = p_jobcnt

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

  • Submit the job.

SUBMIT ztest_program VIA JOB 'ZMY_OBJ' NUMBER p_jobcnt

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

WITH destination = 'LOCL'

WITH immediately = space

WITH keep_in_spool = 'X' AND RETURN.

  • Close the job.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = p_jobcnt

jobname = 'ZMY_OBJ'

strtimmed = 'X'

prdmins = 15

IMPORTING

job_was_released = l_release.

Thanks

Naren

Read only

0 Likes
751

hi naren sir,

i do not want to execute program immediately, if my program has sel-screen then i have to create variant how?

thanks

pankaj

Read only

Former Member
0 Likes
751

Hi,

If you have variant..

Then use the USING SELECTION-SET <variant name> addition to trigger with the variant

Thanks

Naren

Read only

0 Likes
751

hi sir,

the program is triggering immeditely

Read only

Former Member
0 Likes
751

Hi,

In the JOB_CLOSE function module pass blank to the parameter strtimmed

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = p_jobcnt

jobname = 'ZMY_OBJ'

<b>strtimmed = ' ' """""Pass blank..</b>

prdmins = 15

IMPORTING

job_was_released = l_release.

Thanks

naren

Read only

0 Likes
751

hi naren sir,

what are these parametrs for: sdltrtdt and sdltrttm in job_close fm

regards

pankaj