# SCMS_XSTRING_TO_BINARY — Convert XSTRING to Binary Table

> Converts a byte string (XSTRING) into an internal table of binary lines and returns the length of the data. It is needed whenever binary content such as a PDF, Excel file or image must be passed to APIs that expect a table, for example GUI_DOWNLOAD, e-mail attachments or archive functions. Keep OUTPUT_LENGTH and pass it on as the file size, because the last table line is padded; SCMS_BINARY_TO_XSTRING does the reverse.

- Modules: CA
- Type: Function module
- Function group: SCMS_CONV
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/scms-xstring-to-binary/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| BUFFER | XSTRING | Input byte string | Yes |
| APPEND_TO_TABLE | C | Append to existing table content | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| OUTPUT_LENGTH | I | Length of the data in bytes |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| BINARY_TAB | - | Binary table | Yes |

## Call template (ABAP)

```abap
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer = lv_buffer
  IMPORTING
    output_length = lv_output_length
  TABLES
    binary_tab = lt_binary_tab.
```


