Start a DB backup from R/3 without using DB13

Developers, learn how to start a DB backup from R/3 without using DB13

To start a DB backup from R/3 without using DB13 tcode, you can use the following code, and it will create a background...

job.


REPORT  ZSAVE_ONLINE.
DATA: ok_code TYPE sy-ucomm,
      save_ok LIKE ok_code,
      output(8) TYPE c,
      zsid type sy-sysid,
      zhost type sy-host,
      zuser type sy-uname.
DATA: CMDSTR LIKE SXPGCOLIST-NAME VALUE 'CHECK_QXDAEDRSQL',
     RESULT  LIKE BTCXPM OCCURS 10 WITH HEADER LINE.
DATA: ZJOBCOUNT LIKE  TBTCJOB-JOBCOUNT.
DATA: ZRELEASED LIKE  BTCH0000-CHAR1.
DATA: ZPARAM(255) type c.

zhost = SY-HOST.
zsid  = sy-sysid.
zparam = ''.

ZPARAM = '-u / -c force -t online -m all -p initSID.sap'.
 concatenate ZPARAM ' -a -c force -p initSID.sap -cds' INTO ZPARAM.


CALL FUNCTION 'JOB_OPEN'
          EXPORTING
              JOBNAME = 'Zbackup_BD_online'
              JOBCLASS = 'C'
          IMPORTING
              JOBCOUNT = ZJOBCOUNT
          EXCEPTIONS
              CANT_CREATE_JOB = 01
              INVALID_JOB_DATA = 02
              JOBNAME_MISSING = 03
              OTHERS = 99.
       CALL FUNCTION 'JOB_SUBMIT'
           EXPORTING
              AUTHCKNAM = SY-UNAME
              JOBCOUNT = ZJOBCOUNT
              JOBNAME = 'Zbackup_BD_online'
              EXTPGM_NAME = 'brbackup'
             EXTPGM_PARAM = zparam
EXTPGM_SYSTEM = zhost
              EXTPGM_WAIT_FOR_TERMINATION = 'X'
              EXTPGM_STDOUT_IN_JOBLOG = 'X'
              EXTPGM_SET_TRACE_ON = 'X'
              EXTPGM_STDERR_IN_JOBLOG = 'X'
           EXCEPTIONS
              INVALID_JOBDATA = 02
             JOBNAME_MISSING = 03
             JOB_NOTEX = 04
             JOB_SUBMIT_FAILED = 05
             LOCK_FAILED = 06
             PROGRAM_MISSING = 07
             PROG_ABAP_AND_EXTPG_SET = 08
             BAD_XPGFLAGS = 09
             OTHERS = 99.

CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              JOBCOUNT = ZJOBCOUNT
              JOBNAME = 'Zbackup_BD_online'
              STRTIMMED = 'X'
            IMPORTING
              JOB_WAS_RELEASED = zreleased
            EXCEPTIONS
               INVALID_STARTDATE = 01
               JOBNAME_MISSING = 02
               JOB_CLOSE_FAILED = 03
               JOB_NOSTEPS = 04
               JOB_NOTEX = 05
               LOCK_FAILED = 06
               OTHERS = 99.

MESSAGE 'the backup was started .....' TYPE 'I'.
       Call TRANSACTION 'DB14'.
This was last published in October 2005

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close