SAP JOB_SUBMIT Function Module for Insert Background Task in Background Request With COMMIT WORK









JOB_SUBMIT is a standard job submit SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Insert Background Task in Background Request With COMMIT WORK 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 job submit FM, simply by entering the name JOB_SUBMIT 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 JOB_SUBMIT 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 'JOB_SUBMIT'"Insert Background Task in Background Request With COMMIT WORK
EXPORTING
* ARCPARAMS = "Archiving Parameters
* EXTPGM_SYSTEM = ' ' "Target Host for Executing External Program
* EXTPGM_RFCDEST = ' ' "
* EXTPGM_WAIT_FOR_TERMINATION = 'X' "Wait for Termination of External Program
JOBCOUNT = "ID number of background job
JOBNAME = "Job Name
* LANGUAGE = SY-LANGU "
* PRIPARAMS = ' ' "Print Parameters
* REPORT = ' ' "
* VARIANT = ' ' "
AUTHCKNAM = "Background User Name for Authorization Check
* COMMANDNAME = ' ' "
* OPERATINGSYSTEM = ' ' "
* EXTPGM_NAME = ' ' "Name of External Program
* EXTPGM_PARAM = ' ' "Parameters of External Program
* EXTPGM_SET_TRACE_ON = ' ' "Switch on Flow Trace for Control Program
* EXTPGM_STDERR_IN_JOBLOG = 'X' "Log Standard Error Output
* EXTPGM_STDOUT_IN_JOBLOG = 'X' "Log Standard Output of External Program

IMPORTING
STEP_NUMBER = "

EXCEPTIONS
BAD_PRIPARAMS = 1 BAD_XPGFLAGS = 2 INVALID_JOBDATA = 3 JOBNAME_MISSING = 4 JOB_NOTEX = 5 JOB_SUBMIT_FAILED = 6 LOCK_FAILED = 7 PROGRAM_MISSING = 8 PROG_ABAP_AND_EXTPG_SET = 9
.



IMPORTING Parameters details for JOB_SUBMIT

ARCPARAMS - Archiving Parameters

Data type: ARC_PARAMS
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_SYSTEM - Target Host for Executing External Program

Data type: TBTCSTEP-XPGTGTSYS
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_RFCDEST -

Data type: TBTCSTEP-XPGRFCDEST
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_WAIT_FOR_TERMINATION - Wait for Termination of External Program

Data type: BTCH0000-CHAR1
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

JOBCOUNT - ID number of background job

Data type: TBTCJOB-JOBCOUNT
Optional: No
Call by Reference: No ( called with pass by value option)

JOBNAME - Job Name

Data type: TBTCJOB-JOBNAME
Optional: No
Call by Reference: No ( called with pass by value option)

LANGUAGE -

Data type: SY-LANGU
Default: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)

PRIPARAMS - Print Parameters

Data type: PRI_PARAMS
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

REPORT -

Data type: SY-REPID
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

VARIANT -

Data type: RALDB-VARIANT
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

AUTHCKNAM - Background User Name for Authorization Check

Data type: TBTCJOB-AUTHCKNAM
Optional: No
Call by Reference: No ( called with pass by value option)

COMMANDNAME -

Data type: SXPGCOLIST-NAME
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

OPERATINGSYSTEM -

Data type: SY-OPSYS
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_NAME - Name of External Program

Data type: TBTCSTEP-PROGRAM
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_PARAM - Parameters of External Program

Data type: TBTCSTEP-PARAMETER
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_SET_TRACE_ON - Switch on Flow Trace for Control Program

Data type: BTCH0000-CHAR1
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_STDERR_IN_JOBLOG - Log Standard Error Output

Data type: BTCH0000-CHAR1
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTPGM_STDOUT_IN_JOBLOG - Log Standard Output of External Program

Data type: BTCH0000-CHAR1
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for JOB_SUBMIT

STEP_NUMBER -

Data type: TBTCJOB-STEPCOUNT
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

BAD_PRIPARAMS - Incorrect Print/Archiving Parameters

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

BAD_XPGFLAGS - Incorrect Control Flags for External Program

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

INVALID_JOBDATA - Error in Job Data, See SYSLOG

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

JOBNAME_MISSING - Job Name Not Specified

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

JOB_NOTEX - Specified Job Does Not Exist

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

JOB_SUBMIT_FAILED - Job Submit Failed, See SYSLOG

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

LOCK_FAILED - ** No Longer Set **

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PROGRAM_MISSING - Program to Execute is Not Specified

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PROG_ABAP_AND_EXTPG_SET - ABAP and External Program Specified

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for JOB_SUBMIT 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_arcparams  TYPE ARC_PARAMS, "   
lv_step_number  TYPE TBTCJOB-STEPCOUNT, "   
lv_bad_priparams  TYPE TBTCJOB, "   
lv_extpgm_system  TYPE TBTCSTEP-XPGTGTSYS, "   SPACE
lv_extpgm_rfcdest  TYPE TBTCSTEP-XPGRFCDEST, "   SPACE
lv_extpgm_wait_for_termination  TYPE BTCH0000-CHAR1, "   'X'
lv_jobcount  TYPE TBTCJOB-JOBCOUNT, "   
lv_jobname  TYPE TBTCJOB-JOBNAME, "   
lv_language  TYPE SY-LANGU, "   SY-LANGU
lv_priparams  TYPE PRI_PARAMS, "   SPACE
lv_report  TYPE SY-REPID, "   SPACE
lv_variant  TYPE RALDB-VARIANT, "   SPACE
lv_authcknam  TYPE TBTCJOB-AUTHCKNAM, "   
lv_bad_xpgflags  TYPE TBTCJOB, "   
lv_commandname  TYPE SXPGCOLIST-NAME, "   SPACE
lv_invalid_jobdata  TYPE SXPGCOLIST, "   
lv_jobname_missing  TYPE SXPGCOLIST, "   
lv_operatingsystem  TYPE SY-OPSYS, "   SPACE
lv_job_notex  TYPE SY, "   
lv_extpgm_name  TYPE TBTCSTEP-PROGRAM, "   SPACE
lv_extpgm_param  TYPE TBTCSTEP-PARAMETER, "   SPACE
lv_job_submit_failed  TYPE TBTCSTEP, "   
lv_lock_failed  TYPE TBTCSTEP, "   
lv_extpgm_set_trace_on  TYPE BTCH0000-CHAR1, "   SPACE
lv_program_missing  TYPE BTCH0000, "   
lv_extpgm_stderr_in_joblog  TYPE BTCH0000-CHAR1, "   'X'
lv_extpgm_stdout_in_joblog  TYPE BTCH0000-CHAR1, "   'X'
lv_prog_abap_and_extpg_set  TYPE BTCH0000. "   

  CALL FUNCTION 'JOB_SUBMIT'  "Insert Background Task in Background Request With COMMIT WORK
    EXPORTING
         ARCPARAMS = lv_arcparams
         EXTPGM_SYSTEM = lv_extpgm_system
         EXTPGM_RFCDEST = lv_extpgm_rfcdest
         EXTPGM_WAIT_FOR_TERMINATION = lv_extpgm_wait_for_termination
         JOBCOUNT = lv_jobcount
         JOBNAME = lv_jobname
         LANGUAGE = lv_language
         PRIPARAMS = lv_priparams
         REPORT = lv_report
         VARIANT = lv_variant
         AUTHCKNAM = lv_authcknam
         COMMANDNAME = lv_commandname
         OPERATINGSYSTEM = lv_operatingsystem
         EXTPGM_NAME = lv_extpgm_name
         EXTPGM_PARAM = lv_extpgm_param
         EXTPGM_SET_TRACE_ON = lv_extpgm_set_trace_on
         EXTPGM_STDERR_IN_JOBLOG = lv_extpgm_stderr_in_joblog
         EXTPGM_STDOUT_IN_JOBLOG = lv_extpgm_stdout_in_joblog
    IMPORTING
         STEP_NUMBER = lv_step_number
    EXCEPTIONS
        BAD_PRIPARAMS = 1
        BAD_XPGFLAGS = 2
        INVALID_JOBDATA = 3
        JOBNAME_MISSING = 4
        JOB_NOTEX = 5
        JOB_SUBMIT_FAILED = 6
        LOCK_FAILED = 7
        PROGRAM_MISSING = 8
        PROG_ABAP_AND_EXTPG_SET = 9
. " JOB_SUBMIT




ABAP code using 7.40 inline data declarations to call FM JOB_SUBMIT

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 STEPCOUNT FROM TBTCJOB INTO @DATA(ld_step_number).
 
 
"SELECT single XPGTGTSYS FROM TBTCSTEP INTO @DATA(ld_extpgm_system).
DATA(ld_extpgm_system) = ' '.
 
"SELECT single XPGRFCDEST FROM TBTCSTEP INTO @DATA(ld_extpgm_rfcdest).
DATA(ld_extpgm_rfcdest) = ' '.
 
"SELECT single CHAR1 FROM BTCH0000 INTO @DATA(ld_extpgm_wait_for_termination).
DATA(ld_extpgm_wait_for_termination) = 'X'.
 
"SELECT single JOBCOUNT FROM TBTCJOB INTO @DATA(ld_jobcount).
 
"SELECT single JOBNAME FROM TBTCJOB INTO @DATA(ld_jobname).
 
"SELECT single LANGU FROM SY INTO @DATA(ld_language).
DATA(ld_language) = SY-LANGU.
 
DATA(ld_priparams) = ' '.
 
"SELECT single REPID FROM SY INTO @DATA(ld_report).
DATA(ld_report) = ' '.
 
"SELECT single VARIANT FROM RALDB INTO @DATA(ld_variant).
DATA(ld_variant) = ' '.
 
"SELECT single AUTHCKNAM FROM TBTCJOB INTO @DATA(ld_authcknam).
 
 
"SELECT single NAME FROM SXPGCOLIST INTO @DATA(ld_commandname).
DATA(ld_commandname) = ' '.
 
 
 
"SELECT single OPSYS FROM SY INTO @DATA(ld_operatingsystem).
DATA(ld_operatingsystem) = ' '.
 
 
"SELECT single PROGRAM FROM TBTCSTEP INTO @DATA(ld_extpgm_name).
DATA(ld_extpgm_name) = ' '.
 
"SELECT single PARAMETER FROM TBTCSTEP INTO @DATA(ld_extpgm_param).
DATA(ld_extpgm_param) = ' '.
 
 
 
"SELECT single CHAR1 FROM BTCH0000 INTO @DATA(ld_extpgm_set_trace_on).
DATA(ld_extpgm_set_trace_on) = ' '.
 
 
"SELECT single CHAR1 FROM BTCH0000 INTO @DATA(ld_extpgm_stderr_in_joblog).
DATA(ld_extpgm_stderr_in_joblog) = 'X'.
 
"SELECT single CHAR1 FROM BTCH0000 INTO @DATA(ld_extpgm_stdout_in_joblog).
DATA(ld_extpgm_stdout_in_joblog) = 'X'.
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!