SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Schedule reorg background jobs in a client (variants needed)



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Nov 17, 2007 6:13 pm    Post subject: Schedule reorg background jobs in a client (variants needed) Reply with quote

Code:
REPORT RSNAPJOB MESSAGE-ID 00.

DATA:
  RDD_JOBNAME   LIKE TBTCO-JOBNAME,
  RDD_USERNAME  LIKE TBTCO-AUTHCKNAM VALUE 'DDIC',
  RDD_REPORT    LIKE SY-REPID,
  RDD_VARIANT   LIKE RALDB-VARIANT   VALUE '1',
  RDD_PRDDAYS   LIKE TBTCO-PRDDAYS,
  RDD_PRDMONTHS LIKE TBTCO-PRDMONTHS,
  RDD_STRTTIME  LIKE TBTCO-SDLSTRTTM VALUE 28800,
  RDD_STRTDATE  LIKE TBTCO-SDLSTRTDT,
  RDD_JOBCOUNT  LIKE TBTCO-JOBCOUNT,
  COUNT  LIKE TBTCO-SDLSTRTTM,
  NOVAR TYPE I.

IF SY-MANDT = '000'.                   " Client independent jobs

* SAP_REORG_ABAPDUMPS
  RDD_PRDDAYS  = 1.                    " 1 day period
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_REORG_ABAPDUMPS'.
  RDD_REPORT = 'RSSNAPDL'.
  PERFORM SCHEDULE_JOB.

* SAP_REORG_JOBSTATISTIC
  RDD_PRDMONTHS = 1.                   " 1 month
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_REORG_JOBSTATISTIC'.
  RDD_REPORT = 'RSBPSTDE'.
  PERFORM SCHEDULE_JOB.

* SAP_COLLECTOR_FOR_JOBSTATISTICS
  RDD_PRDDAYS  = 1.                    " 1 day period
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_COLLECTOR_FOR_JOBSTATISTICS'.
  RDD_REPORT = 'RSBPCOLL'.
  NOVAR = 1.
  PERFORM SCHEDULE_JOB.
  CLEAR NOVAR.

* SAP_COLLECTOR_FOR_PERFMONITOR
  NOVAR = 1.
  COUNT = 28800.
  DO 12 TIMES.
    RDD_PRDDAYS  = 1.                  " 1 day period
    RDD_STRTDATE = SY-DATUM + 1.       " tomorrow
    RDD_STRTTIME = COUNT.              " 1 am
    RDD_JOBNAME = '#SAP_COLLECTOR_FOR_PERFMONITOR'.
    RDD_REPORT = 'RSCOLL00'.
    PERFORM SCHEDULE_JOB.
    COUNT = COUNT + 3600.
  ENDDO.
  CLEAR NOVAR.

ELSE.                                  " Client dependent jobs

* SAP_REORG_JOBS
  RDD_PRDDAYS  = 1.                    " 1 day period
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_REORG_JOBS'.
  RDD_REPORT = 'RSBTCDEL'.
  PERFORM SCHEDULE_JOB.

* SAP_REORG_SPOOL
  RDD_PRDDAYS  = 1.                    " 1 day period
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_REORG_SPOOL'.
  RDD_REPORT = 'RSPO0041'.
  PERFORM SCHEDULE_JOB.

* SAP_REORG_BATCHINPUT
  RDD_PRDDAYS  = 1.                    " 1 day period
  RDD_STRTDATE = SY-DATUM + 1.         " tomorrow
  RDD_JOBNAME = '#SAP_REORG_BATCHINPUT'.
  RDD_REPORT = 'RSBDCREO'.
  PERFORM SCHEDULE_JOB.
ENDIF.

*---------------------------------------------------------------------*
*       FORM SCHEDULE_JOB                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM SCHEDULE_JOB.
  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            JOBNAME          = RDD_JOBNAME
       IMPORTING
            JOBCOUNT         = RDD_JOBCOUNT
       EXCEPTIONS
            CANT_CREATE_JOB  = 1
            INVALID_JOB_DATA = 2
            JOBNAME_MISSING  = 3
            OTHERS           = 4.
  IF SY-SUBRC EQ 0.
    IF NOVAR IS INITIAL.
      CALL FUNCTION 'JOB_SUBMIT'
           EXPORTING
                JOBNAME                 = RDD_JOBNAME
                JOBCOUNT                = RDD_JOBCOUNT
                AUTHCKNAM               = RDD_USERNAME
                REPORT                  = RDD_REPORT
                VARIANT                 = RDD_VARIANT
           EXCEPTIONS
                BAD_PRIPARAMS           = 1
                BAD_XPGFLAGS            = 2
                INVALID_JOBDATA         = 3
                JOBNAME_MISSING         = 4
                JOB_NOTEX               = 5
                JOB_SUBMIT_FAILED       = 6
                LOCK_FAILED             = 7
                PROGRAM_MISSING         = 8
                PROG_ABAP_AND_EXTPG_SET = 9
                OTHERS                  = 10.
    ELSE.
      CALL FUNCTION 'JOB_SUBMIT'
           EXPORTING
                JOBNAME                 = RDD_JOBNAME
                JOBCOUNT                = RDD_JOBCOUNT
                AUTHCKNAM               = RDD_USERNAME
                REPORT                  = RDD_REPORT
*               variant                 = rdd_variant
           EXCEPTIONS
                BAD_PRIPARAMS           = 1
                BAD_XPGFLAGS            = 2
                INVALID_JOBDATA         = 3
                JOBNAME_MISSING         = 4
                JOB_NOTEX               = 5
                JOB_SUBMIT_FAILED       = 6
                LOCK_FAILED             = 7
                PROGRAM_MISSING         = 8
                PROG_ABAP_AND_EXTPG_SET = 9
                OTHERS                  = 10.
    ENDIF.
    IF SY-SUBRC EQ 0.
      IF RDD_PRDMONTHS IS INITIAL.
        CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
                  JOBNAME              = RDD_JOBNAME
                  JOBCOUNT             = RDD_JOBCOUNT
                  PRDDAYS              = RDD_PRDDAYS
                  SDLSTRTDT            = RDD_STRTDATE
                  SDLSTRTTM            = RDD_STRTTIME
             EXCEPTIONS
                  CANT_START_IMMEDIATE = 1
                  INVALID_STARTDATE    = 2
                  JOBNAME_MISSING      = 3
                  JOB_CLOSE_FAILED     = 4
                  JOB_NOSTEPS          = 5
                  JOB_NOTEX            = 6
                  LOCK_FAILED          = 7
                  OTHERS               = 8.
        IF SY-SUBRC <> 0.
          MESSAGE S587 WITH RDD_JOBNAME.
        ENDIF.
      ELSE.
        CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
                  JOBNAME              = RDD_JOBNAME
                  JOBCOUNT             = RDD_JOBCOUNT
                  PRDMONTHS            = RDD_PRDMONTHS
                  SDLSTRTDT            = RDD_STRTDATE
                  SDLSTRTTM            = RDD_STRTTIME
             EXCEPTIONS
                  CANT_START_IMMEDIATE = 1
                  INVALID_STARTDATE    = 2
                  JOBNAME_MISSING      = 3
                  JOB_CLOSE_FAILED     = 4
                  JOB_NOSTEPS          = 5
                  JOB_NOTEX            = 6
                  LOCK_FAILED          = 7
                  OTHERS               = 8.
        IF SY-SUBRC <> 0.
          MESSAGE S587 WITH RDD_JOBNAME.
        ENDIF.
        CLEAR RDD_PRDMONTHS.
      ENDIF.
    ELSE.
      MESSAGE S587 WITH RDD_JOBNAME.
    ENDIF.
  ELSE.
    MESSAGE S587 WITH RDD_JOBNAME.
  ENDIF.
ENDFORM.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.