Entering content frame

Data Areas for Field Symbols Locate the document in its SAP Library structure

You can only assign data objects from the data areas of the ABAP program to a field symbol. When you assign a data object to a field symbol, the system checks at runtime to ensure that no data is lost due to the field symbol addressing memory outside the data area.

The data areas of an ABAP program are:

·        The table memory area for internal tables. The size of this storage area depends on the number of table lines. This is not a fixed value, it is  determined dynamically at runtime.

·        The DATA storage area for other data objects. The size of this storage area is fixed during the data declaration.

Field symbols cannot point to addresses outside these areas. If you assign data objects to a field symbol and point to addresses outside these areas, a runtime error occurs.

Certain system information, such as the control blocks of internal tables, is also stored in the DATA storage area. Therefore, despite the runtime checks, you may unintentionally overwrite some of these fields and cause subsequent errors (for example, destruction of the table header).

Example

REPORT demo_field_symbols_assign_err.

DATA: text1(10) TYPE c, text2(10) TYPE c, text3(5) TYPE c.

FIELD-SYMBOLS <fs> TYPE ANY.

DO 100 TIMES.                          "Runtime-Error!
  ASSIGN text1+sy-index(1) TO <fs>.
ENDDO.

After starting DEMO, a runtime error occurs. The short dump message begins as follows:

This graphic is explained in the accompanying text

The DATA memory area is at least 25 bytes wide (it can be expanded due to alignment of the data areas in memory). During one of the loop passes, the program tries to access an address outside this area. The termination message also contains the contents of the field sy-index, which may vary from case to case. Up to the 24th loop pass, no error occurs. If you replace text1 with text2in the ASSIGN statement, the error occurs ten loop passes earlier.

 

 

 

 

Leaving content frame