Skip to Content
author's profile photo
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

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

    Sloved

    Add comment
    10|10000 characters needed characters exceeded