Skip to Content
author's profile photo Former Member
Former Member

Problem in background scheduling

Hi All ,

Requirement : When I run Report ZBKSCHD It will SCHEDULE another program for ex (ypr_range_rb2) .

Here I am passing program name & varint which I want to schedule

Input Field

Program Name : ypr_range_rb2

Varint : ypr_rb2

Getting errror

*********ERROR ****** ********

Short text

Exception condition "INVALID_STARTDATE" raised.

and Report ZBKSCHD scheduling ypr_range_rb2 many times not single time .( in sm36 )

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

******This is my background schedule program

REPORT ZBKSCHD NO STANDARD PAGE HEADING LINE-SIZE 170 LINE-COUNT 58 .

DATA: ZCOUNT LIKE SY-TABIX,

JOBNAME LIKE TBTCJOB-JOBNAME,

PARAMS LIKE PRI_PARAMS,

JOBCOUNT LIKE TBTCJOB-JOBCOUNT,

AUTHCKNAM LIKE TBTCJOB-AUTHCKNAM,

SDLSTRTTM LIKE TBTCJOB-SDLSTRTTM,

SDLSTRTDT LIKE TBTCJOB-SDLSTRTDT,

VARIANT LIKE RALDB-VARIANT,

REPORT LIKE SY-REPID,

ZTIME LIKE SY-UZEIT,

PREDJOB_CHECKSTAT LIKE TBTCSTRT-CHECKSTAT,

PRED_JOBCOUNT LIKE TBTCJOB-JOBCOUNT,

PRED_JOBNAME LIKE TBTCJOB-JOBNAME,

RELEASED LIKE BTCH0000-CHAR1.

SELECTION-SCREEN: BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.

PARAMETERS:

NAME LIKE RS38M-PROGRAMM OBLIGATORY,

VAR LIKE RS38M-SELSET OBLIGATORY,

JOB LIKE TBTCJOB-JOBNAME,

FRQ1 LIKE SY-INDEX,

FRQ2(2) TYPE C.

SELECTION-SCREEN END OF BLOCK A1.

SELECTION-SCREEN: BEGIN OF BLOCK A2 WITH FRAME TITLE TEXT-002.

PARAMETERS: ZDATE LIKE SY-DATUM DEFAULT SY-DATUM OBLIGATORY.

SELECT-OPTIONS:

TIME1 FOR SY-UZEIT OBLIGATORY.

SELECTION-SCREEN END OF BLOCK A2.

AT SELECTION-SCREEN ON FRQ2.

IF FRQ2 NE 'H' AND FRQ2 NE 'M' AND FRQ2 NE 'S'.

MESSAGE E001(Z1) WITH 'Time Unit must be H or M or S'.

ENDIF.

AT SELECTION-SCREEN ON ZDATE.

IF ZDATE < SY-DATUM.

MESSAGE E001(Z1) WITH 'Date must be greater than current date'.

ENDIF.

AT SELECTION-SCREEN ON TIME1.

IF ZDATE = SY-DATUM AND TIME1-LOW < SY-UZEIT.

MESSAGE E001(Z1) WITH 'Time must be greater than current time'.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF JOB IS INITIAL.

JOB = NAME.

ENDIF.

$$* Start of selection

START-OF-SELECTION.

IF JOB IS INITIAL.

JOB = NAME.

ENDIF.

clear params.

call function 'GET_PRINT_PARAMETERS'

EXPORTING

mode = 'CURRENT'

no_dialog = 'X'

IMPORTING

out_parameters = params.

params-paart = 'X_PAPER'.

ZTIME = TIME1-LOW.

JOBNAME = JOB.

VARIANT = VAR.

REPORT = NAME.

AUTHCKNAM = SY-UNAME.

PARAMS-PRIMM = SPACE.

SDLSTRTDT = ZDATE.

CLEAR: ZCOUNT.

WHILE ZTIME LE TIME1-HIGH.

SDLSTRTTM = ZTIME.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = JOB

IMPORTING

JOBCOUNT = JOBCOUNT

EXCEPTIONS

OTHERS = 4.

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

AUTHCKNAM = AUTHCKNAM

JOBCOUNT = JOBCOUNT

JOBNAME = JOB

PRIPARAMS = PARAMS

REPORT = REPORT

VARIANT = VARIANT.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

SDLSTRTDT = SDLSTRTDT

SDLSTRTTM = SDLSTRTTM

JOBCOUNT = JOBCOUNT

JOBNAME = JOB

IMPORTING

JOB_WAS_RELEASED = RELEASED.

IF RELEASED = 'X'.

WRITE: / 'Job', JOBNAME, '(' ,JOBCOUNT, ')' ,'will run at', ZTIME,

'on', ZDATE, 'with program',NAME, 'and variant', VAR.

ELSE.

WRITE: /

'Unable to release job', JOBNAME, '(' ,JOBCOUNT, ')' ,'at', ZTIME,

'on', ZDATE, 'with program',NAME, 'and variant', VAR.

ENDIF.

CASE FRQ2.

WHEN 'H'.

ZTIME = ZTIME + ( 60 * 60 * FRQ1 ).

WHEN 'M'.

ZTIME = ZTIME + ( 60 * FRQ1 ).

WHEN 'S'.

ZTIME = ZTIME + FRQ1.

WHEN OTHERS.

ENDCASE.

ENDWHILE.

Thanks for your time

Rahul

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 05, 2011 at 05:06 AM

    Sloved

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.