# BP_JOB_READ — Read Background Job Data

> Reads the header, steps, job log information and spool numbers created by a background job. Programs that monitor job status or that find the spool list produced by a job and convert it to PDF use it. JOB_READ_OPCODE sets the scope of data to read; if the job does not exist, the JOB_DOESNT_EXIST exception is raised.

- 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/bp-job-read/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| JOB_READ_JOBNAME | TBTCJOB-JOBNAME | Job name | Yes |
| JOB_READ_JOBCOUNT | TBTCJOB-JOBCOUNT | Job count | Yes |
| JOB_READ_OPCODE | BTCH0000-INT4 | Read operation code | Yes |
| JOB_STEP_NUMBER | TBTCP-STEPCOUNT | Step number | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| JOB_READ_JOBHEAD | TBTCJOB | Job header |
| JOBLOG_ATTRIBUTES | BAPIXMJOBLOG | Job log attributes |
| EPP_ATTRIBUTES | BTCJOBEPP | EPP attributes |

## Changing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| RET | I | Return code | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| JOB_READ_STEPLIST | TBTCSTEP | Job steps | - |
| SPOOL_ATTRIBUTES | BAPIXMSPOOLID | Spool numbers | - |

## Exceptions

- INVALID_OPCODE: Invalid operation code
- JOB_DOESNT_EXIST: Job does not exist
- JOB_DOESNT_HAVE_STEPS: Job has no steps

## Call template (ABAP)

```abap
CALL FUNCTION 'BP_JOB_READ'
  EXPORTING
    job_read_jobname = lv_job_read_jobname
    job_read_jobcount = lv_job_read_jobcount
    job_read_opcode = lv_job_read_opcode
  IMPORTING
    job_read_jobhead = lv_job_read_jobhead
    joblog_attributes = lv_joblog_attributes
    epp_attributes = lv_epp_attributes
  CHANGING
    ret = lv_ret
  TABLES
    job_read_steplist = lt_job_read_steplist
    spool_attributes = lt_spool_attributes
  EXCEPTIONS
    invalid_opcode = 1
    job_doesnt_exist = 2
    job_doesnt_have_steps = 3
    OTHERS = 4.
```

## Related tables

TBTCO, TBTCP

