To assign a variable a type at runtime, use the ABAP statement ASSIGN with the option TYPE.
For instance:
DATA: D_TYPE,
D_FIELD(35).
DATA: D_TEST TYPE P.
FIELD-SYMBOLS:
D_FIELD = 'D_TEST'.
D_TYPE = 'P'.
ASSIGN (D_FIELD) TO
Additionally you can use the option DECIMALS of the ASSIGN statement if your type is 'P'.
You can even change the type at runtime of previously assigned field symbol like
ASSIGN
One more thing for dynamic programing. With the following coding you can access every DDIC table with the key you want:
SELECT SINGLE * FROM (DF_TNAME) INTO S_TMP WHERE (IF_KEY).
No comments:
Post a Comment