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: 

Scheduling a background abap report to run on a specific date

Former Member
0 Kudos

Hello Experts,

I have an ABAP report I want to schedule in another program.

Basically, I want to schedule it, so that it runs the next day (sy-datum + 1). I have used FM Job_open followed by submit and Job close, but the program is executed immediately.

Below is the code snippet:

......

v_datenext = sy-datum + 1.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

delanfrep = ' '

jobgroup = ' '

jobname = jobname

sdlstrtdt = v_datenext

sdlstrttm = sy-uzeit

IMPORTING

jobcount = jobcount.

SUBMIT z_prg_spinterf

WITH i_year EQ v_subyrnext

WITH i_month EQ app->g_str_header-f_month

WITH i_dc EQ 'B'

USER sy-uname

VIA JOB jobname

NUMBER jobcount

AND RETURN.

starttime-sdlstrttm = sy-uzeit + 60.

  • Close job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobcount

jobname = jobname

  • prddays = 1

sdlstrtdt = v_datenext

sdlstrttm = starttime-sdlstrttm

strtimmed = starttimeimmediate

targetsystem = host.

The report z_prg_spinterf is getting executed immediately, which i dont want. I wanted it to be executed the next day.

Can someone help find out the source of the error. Maybe I am missing out something.

Thanks,

Nitish.

1 ACCEPTED SOLUTION

ThomasZloch
Active Contributor
0 Kudos

Do not provide sdlstrtdt and sdlstrttm when calling JOB_OPEN, do not provide strtimmed when calling JOB_CLOSE, and see if this helps.

Thomas

4 REPLIES 4

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

CALL FUNCTION 'JOB_OPEN'

EXPORTING

delanfrep = ' '

jobgroup = ' '

jobname = jobname

sdlstrtdt = v_datenext => this shuold be space('').

sdlstrttm = sy-uzeit

IMPORTING

jobcount = jobcount.

Specify the date and time in JOB_CLOSE.

Former Member
0 Kudos

Hi

1. go to transaction sm36

2. select job wizard

2.1 press continue

2.2 Enter a job name say abc(user defined)

Enter job class:- select priority say 'high priority"

2.3press continue

2.4 Select Abap program step

2.5 press continue

2.6 Enter the correct program name say"Z_REPORT"

2.7 Enter the correct variant name say" v1" and press continue

2.8 press continue

2.9 Select job start condition: "Date/Time" radio button and press continue

3.0 Enter the scheduled date: ie, date to which the report to be executed and give the desire time

3.1 press continue

3.2 Press complete

3.3 If success the report will be executed

*******************************************************

To see the output of the report

********************************************************

1. transaction sm36

2. select own jobs

3. Find ur job name .

4. Press on spool, u will find the out put.

ThomasZloch
Active Contributor
0 Kudos

Do not provide sdlstrtdt and sdlstrttm when calling JOB_OPEN, do not provide strtimmed when calling JOB_CLOSE, and see if this helps.

Thomas

0 Kudos

Hello Thomas,

Now it works fine.

Many thanks.

Nitish.