2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ABAP Background Job copy program

Posted at

Job Copy ABAP sample

I once needed to create so many jobs many times for system benchmark. I created this program and it is memo of sample program.

Code

Please create an executable report program.
Input parameters
p_sid: check job id via t-cd:sm37 or table "TBTCO" directory

Report.abap

PARAMETERS:
  p_sid    TYPE tbtcjob-jobcount DEFAULT'16575000',                         "Job ID
  p_sname  TYPE tbtcjob-jobname  DEFAULT'AQZZ/SAPQUERY/SMCRM_REP_ACT1==',   "Job name(source)
  p_target TYPE tbtcjob-jobname  DEFAULT'AQZZ/SAPQUERY/SMCRM_REP_ACT1==2',  "Job name(target)
  p_num    TYPE i DEFAULT 1.                                                "Number of job copy


START-OF-SELECTION.
  DATA:
     lv_target TYPE tbtcjob-jobname,
     lv_num(3) TYPE n.

  DO p_num TIMES.
    lv_num = sy-index.
    CONCATENATE p_target lv_num INTO lv_target.
    CALL FUNCTION 'BP_JOB_COPY'
      EXPORTING
        dialog                  = 'N'
        source_jobcount         = p_sid
        source_jobname          = p_sname
        target_jobname          = lv_target
      EXCEPTIONS
        cant_create_new_job     = 1
        cant_enq_job            = 2
        cant_read_sourcedata    = 3
        invalid_opcode          = 4
        jobname_missing         = 5
        job_copy_canceled       = 6
        no_copy_privilege_given = 7
        no_plan_privilege_given = 8
        OTHERS                  = 9.
    IF sy-subrc <> 0.
*  implement suitable error handling here
    ENDIF.

  ENDDO.

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?