What is XSTRING data type and how to convert it to various formats

XSTRING is predefined byte-like ABAP type with variable length. This type ensures dynamic allocation of memory. Its value is a sequence of bytes that equals its hexadecimal value as shows screenshot from ABAP debugger.

xstring

Usage

XSTRING is used to send files to SAP from web applications using technologies such as BSP or SAP Gateway with OData service.

Conversions

Mostly, we need to convert XSTRING into different ABAP data types to use it as importing parameter to different function modules and methods.

a) XSTRING to SOLIX

This conversion is described in article How to store file incoming as XSTRING in SAP.

b) XSTRING to STRING

There are few ways how to convert xstring to string. This is most convenient way:

 

Second way is using class cl_abap_conv_in_ce.

 

Peter Marcely

ABAP, Python, JavaScript developer