# JOB_SUBMIT — Add Step to Background Job

> Adds an ABAP program or external program step to a background job opened with JOB_OPEN. It is used to run a report in the background with a given variant and print parameters; the SUBMIT ... VIA JOB statement is an alternative. AUTHCKNAM sets whose authorizations the step runs with; REPORT and EXTPGM_NAME cannot both be filled.

- Modules: BASIS
- Type: Function module
- Function group: BTCH
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/job-submit/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| JOBNAME | TBTCJOB-JOBNAME | Job name | Yes |
| JOBCOUNT | TBTCJOB-JOBCOUNT | Job count | Yes |
| AUTHCKNAM | TBTCJOB-AUTHCKNAM | User for authorization check | Yes |
| REPORT | SY-REPID | ABAP program | - |
| VARIANT | RALDB-VARIANT | Variant | - |
| PRIPARAMS | PRI_PARAMS | Print parameters | - |
| ARCPARAMS | ARC_PARAMS | Archive parameters | - |
| EXTPGM_NAME | TBTCSTEP-PROGRAM | External program | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| STEP_NUMBER | TBTCJOB-STEPCOUNT | Step number |

## Exceptions

- BAD_PRIPARAMS: Invalid print parameters
- BAD_XPGFLAGS: Invalid external program flags
- INVALID_JOBDATA: Invalid job data
- JOBNAME_MISSING: Job name missing
- JOB_NOTEX: Job does not exist
- JOB_SUBMIT_FAILED: Step could not be added
- LOCK_FAILED: Lock failed
- PROGRAM_MISSING: Program missing
- PROG_ABAP_AND_EXTPG_SET: Both ABAP and external program given

## Call template (ABAP)

```abap
CALL FUNCTION 'JOB_SUBMIT'
  EXPORTING
    jobname = lv_jobname
    jobcount = lv_jobcount
    authcknam = lv_authcknam
  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
    OTHERS = 9.
```

## Related tables

TBTCP

