Sample Program: Declarations, Set Up, and Print Specifications

Use

REPORT BCSAMPLE. 
* 
* You must include LBTCHDEF in all background processing 
* applications.  Use only the LBTCHDEF definitions that appear 
* in examples as values for function modules.  LBTCHDEF also 
* declares values that are used only internally in background 
* processing.  
* 
* If you plan to schedule external programs, you must include 
* RSXPGDEF to define constants for the control flags for external 
* programs. 
* 
INCLUDE LBTCHDEF.     " Background processing definitions. 
INCLUDE RSXPGDEF.     " Definitions for external programs. 
* 
* Sample DATA entries for scheduling a job. 
* 
  DATA: JOBNUMBER       LIKE TBTCJOB-JOBCOUNT,  " Job ID and
        JOBNAME         LIKE TBTCJOB-JOBNAME,   " job name.
        STARTDATE       LIKE TBTCJOB-SDLSTRTDT, " Start-time 
        STARTTIME       LIKE TBTCJOB-SDLSTRTTM, " window specs.
        LASTSTARTDATE   LIKE TBTCJOB-LASTSTRTDT, 
        LASTSTARTTIME   LIKE TBTCJOB-LASTSTRTTM, 
        JOB_RELEASED    LIKE BTCH0000-CHAR1.   " JOB_CLOSE: Was 
                                               " job released?    
* 
* The data structures used by background jobs are: 
* TBTCJOB:    Job definition 
* TBTCSTRT:   Job start time (with function module 
*             BP_START_DATE_EDITOR) 

         

In any production job-scheduling program, you should call * GET_PRINT_PARAMETERS to specify printing and archiving. For more information, see Obtaining Printing and Archiving Specifications

* The following printing and archiving tables are 
* used by background jobs. 
* PRI_PARAMS: Printing options 
* ARC_PARAMS: Archiving options 
* 
* Structure for print parameters 
* 
  DATA USER_PRINT_PARAMS LIKE PRI_PARAMS. 
* 
* Structure for optical archiving parameters 
* 
  DATA USER_ARC_PARAMS LIKE ARC_PARAMS. 
* 
* Additional printing/archiving declarations
* 
  DATA:         COUNT(3) TYPE N VALUE 1,
                VALID    TYPE C.

* GET_PRINT_PARAMETERS:  As coded, presents the user with the 
* standard SAP popup window for collecting printer and optical 
* archiving specifications.  You can export default values for 
* printing and archiving options.  These values are presented as
* defaults in interactive mode or can be written directly into 
* the parameter structures in non-interactive mode.  Use the 
* IMPORTING OUT* parameters to pass the printing and archiving 
* specifications to JOB_SUBMIT or ABAP SUBMIT.  

  CALL FUNCTION 'GET_PRINT_PARAMETERS'
     EXPORTING 
       MODE     = 'BATCH'
       REPORT   = ' <REPORT NAME>'
       NO_DIALOG = ' '
     IMPORTING
       OUT_PARAMETERS         = USER_PRINT_PARAMS
       OUT_ARCHIVE_PARAMETERS = USER_ARC_PARAMS
       VALID                  = VALID
     EXCEPTIONS
       OTHERS = 99.

  IF VALID = SPACE.
<Terminate program, user aborted print option selection> 
  ENDIF.