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 first published in October 2005

Dig deeper on SAP ABAP

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close