SAP BP_JOB_COPY Function Module for Copy Background Request
BP_JOB_COPY is a standard bp job copy SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Copy Background Request processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for bp job copy FM, simply by entering the name BP_JOB_COPY into the relevant SAP transaction such as SE37 or SE38.
Function Group: BTCH
Program Name: SAPLBTCH
Main Program: SAPLBTCH
Appliation area: S
Release date: 08-May-1996
Mode(Normal, Remote etc): Normal Function Module
Update:

Function BP_JOB_COPY pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'BP_JOB_COPY'"Copy Background Request.
EXPORTING
DIALOG = "
SOURCE_JOBCOUNT = "Job Count of the Job to be Copied
SOURCE_JOBNAME = "Job Name of the Job to be Copied
* TARGET_JOBNAME = ' ' "Job Name of the Job Copy (if not Online)
* STEP_NUMBER = 0 "Job step ID number.
IMPORTING
NEW_JOBHEAD = "Job Count of the Job Copy
CHANGING
* RET = "Special Additional Error Code
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
IMPORTING Parameters details for BP_JOB_COPY
DIALOG -
Data type: BTCH0000-CHAR1Optional: No
Call by Reference: No ( called with pass by value option)
SOURCE_JOBCOUNT - Job Count of the Job to be Copied
Data type: TBTCJOB-JOBCOUNTOptional: No
Call by Reference: No ( called with pass by value option)
SOURCE_JOBNAME - Job Name of the Job to be Copied
Data type: TBTCJOB-JOBNAMEOptional: No
Call by Reference: No ( called with pass by value option)
TARGET_JOBNAME - Job Name of the Job Copy (if not Online)
Data type: TBTCJOB-JOBNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
STEP_NUMBER - Job step ID number.
Data type: TBTCJOB-STEPCOUNTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BP_JOB_COPY
NEW_JOBHEAD - Job Count of the Job Copy
Data type: TBTCJOBOptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for BP_JOB_COPY
RET - Special Additional Error Code
Data type: IOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
CANT_CREATE_NEW_JOB - Failed to Create New Job
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CANT_ENQ_JOB - Failed to Lock Source Job
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CANT_READ_SOURCEDATA - Failed to Read Source Job
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_OPCODE - Invalid Operation Code
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
JOBNAME_MISSING - Name of Target Job Missing
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
JOB_COPY_CANCELED - Copy was Canceled by the User
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_COPY_PRIVILEGE_GIVEN - No Authorization to Copy the Source Job
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_PLAN_PRIVILEGE_GIVEN - No Authorization to Schedule a Job
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BP_JOB_COPY Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_ret | TYPE I, " | |||
| lv_dialog | TYPE BTCH0000-CHAR1, " | |||
| lv_new_jobhead | TYPE TBTCJOB, " | |||
| lv_cant_create_new_job | TYPE TBTCJOB, " | |||
| lv_cant_enq_job | TYPE TBTCJOB, " | |||
| lv_source_jobcount | TYPE TBTCJOB-JOBCOUNT, " | |||
| lv_source_jobname | TYPE TBTCJOB-JOBNAME, " | |||
| lv_cant_read_sourcedata | TYPE TBTCJOB, " | |||
| lv_invalid_opcode | TYPE TBTCJOB, " | |||
| lv_target_jobname | TYPE TBTCJOB-JOBNAME, " SPACE | |||
| lv_step_number | TYPE TBTCJOB-STEPCOUNT, " 0 | |||
| lv_jobname_missing | TYPE TBTCJOB, " | |||
| lv_job_copy_canceled | TYPE TBTCJOB, " | |||
| lv_no_copy_privilege_given | TYPE TBTCJOB, " | |||
| lv_no_plan_privilege_given | TYPE TBTCJOB. " |
|   CALL FUNCTION 'BP_JOB_COPY' "Copy Background Request |
| EXPORTING | ||
| DIALOG | = lv_dialog | |
| SOURCE_JOBCOUNT | = lv_source_jobcount | |
| SOURCE_JOBNAME | = lv_source_jobname | |
| TARGET_JOBNAME | = lv_target_jobname | |
| STEP_NUMBER | = lv_step_number | |
| IMPORTING | ||
| NEW_JOBHEAD | = lv_new_jobhead | |
| CHANGING | ||
| RET | = lv_ret | |
| 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 | ||
| . " BP_JOB_COPY | ||
ABAP code using 7.40 inline data declarations to call FM BP_JOB_COPY
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single CHAR1 FROM BTCH0000 INTO @DATA(ld_dialog). | ||||
| "SELECT single JOBCOUNT FROM TBTCJOB INTO @DATA(ld_source_jobcount). | ||||
| "SELECT single JOBNAME FROM TBTCJOB INTO @DATA(ld_source_jobname). | ||||
| "SELECT single JOBNAME FROM TBTCJOB INTO @DATA(ld_target_jobname). | ||||
| DATA(ld_target_jobname) | = ' '. | |||
| "SELECT single STEPCOUNT FROM TBTCJOB INTO @DATA(ld_step_number). | ||||
Search for further information about these or an SAP related objects