Friday, November 5, 2010

Load Dynamic internal table using Field Symbols

With this code we will load an internal table using field symbols. It is useful when you do not know the structure of the table in programming time.


FIELD-SYMBOLS: TYPE ANY.
DATA: l_preis(13), "LIKE eipa-preis,
l_count(1) TYPE n,
l_field(22).

LOOP AT ti_eipa.
l_count = l_count + 1.
* Price.
CLEAR l_field.
WRITE ti_eipa-preis TO
l_preis CURRENCY ti_eipa-bwaer.
CONCATENATE 'P_PREIS' l_count INTO l_field.
ASSIGN (l_field) TO
.
= l_preis.
ENDLOOP.

0 comments: