Skip to content

ABAP Keyword Documentation →  ABAP Programming Guidelines →  Robust ABAP →  Assignments, Calculations, and Other Types of Data Access 

Anonymous Containers

Other versions: 7.31 | 7.40 | 7.54


Anonymous containers are character-like or byte-like data objects of type c or string type (or x/xstring type). Data objects of other types (especially structures) are assigned using casting to these objects, to store them persistently in these containers.


Do not use character or byte fields as containers

Do not store structured data in unstructured character-like or byte-like variables.


The direct storage of structured data in unstructured character-like or byte-like data objects is problematic, particularly with data exchanges using remote function calls (RFC), input/output through the file system or output to a printer. Unexpected results can occur due to platform-specific byte orders (endianness), alignment requirements and different character sets (codepage).

For example, if a container is stored and imported to an application server with a different byte order, problems will occur if the container is used for content for which the byte sequence is critical. In other words, the numeric fields of types i, decfloat16, decfloat34 and f. In Unicode systems, the byte order of character-like data objects also depends on the platform.

Even without these technical problems, it can difficult to correctly import data that has been stored as described above. You usually have to perform another casting operation for the data type of the data stored in the container. However, as the relevant type information is not saved with the data, it might not be possible to perform type-specific casting.


If you need to store data in an unstructured container, you can use the EXPORT ... TO DATA BUFFER statement. This type of data storage is robust compared to different platform properties. However, you cannot use EXPORT and IMPORT to directly process reference variables or instances referenced by them. As a workaround, you can serialize these variables and instances for storage by using the CALL TRANSFORMATION statement. A class must include the IF_SERIALIZABLE_OBJECT tag interface, so that its objects can be serialized using CALL TRANSFORMATION.