# RSPO_DOWNLOAD_SPOOLJOB — Download Spool Request to File

> Downloads the content of a spool request as a file to the user's PC. User tools that save report output as text or PDF without going to SP01 use it. It needs an SAP GUI connection and therefore does not work in the background; pass the spool number in ID and the file name in FNAME.

- Modules: BASIS
- Type: Function module
- Function group: SPOX
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/rspo-download-spooljob/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| ID | TSP01-RQIDENT | Spool request number | Yes |
| FNAME | RLGRAP-FILENAME | File name | Yes |
| OUTTYPE | RSPODOCTYP | Output document type | - |
| ENCODING | ABAP_ENCOD | Character encoding | - |
| FULLPATH | STRING | Full file path | - |

## Changing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| DIRECTORY | STRING | Directory | - |

## Exceptions

- CANNOT_RETURN: Spool content cannot be returned
- DOWNLOAD_FAILED: Download failed
- INVALID_DOCTYPE: Invalid document type

## Call template (ABAP)

```abap
CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'
  EXPORTING
    id = lv_id
    fname = lv_fname
  CHANGING
    directory = lv_directory
  EXCEPTIONS
    cannot_return = 1
    download_failed = 2
    invalid_doctype = 3
    OTHERS = 4.
```

## Related tables

TSP01

