Alignment of Data Objects

You cannot simply store fields at any addresses you want in main memory. For example, an ABAP field of the type I should normally have an address divisible by 4, a field of the type F an address divisible by 8, and so on. A field is considered to be aligned when it has an address corresponding to its data type.

For components of a structure, the distance of the component from the beginning of the structure is known as the offset of the component.

A structure is aligned if both the following are true:

Normally, ABAP programmers do not have to be concerned about the correct alignment of fields or structures because this is set automatically on declaration.

In the following cases, however, you must pay attention to alignment:

Also, the offset of a structure component may not be the same as the total of the field lengths of the preceding components because some fields may be padded.

If the alignment of a field or structure is insufficient, a runtime error occurs.