Start a DB backup from R/3 without using DB13

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

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.