Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create variable in program dinamically

Former Member
0 Likes
511

Hi Gurus,

I know it is possible create internal tables and structures like this internal table.. but...

Is it possible create a variable dinamically in ABAP program???

Thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
492

This message was moderated.

Read only

matt
Active Contributor
0 Likes
492

Yes.

DATA lp_data TYPE REF TO DATA.
FIELD-SYMBOLS: <FS>.
CONSTANTS c_type TYPE c LENGTH 1 VALUE 'F'.

CREATE DATA lp_data TYPE (c_type).
ASSIGN lp_data->* TO <FS>.

The field symbol is now a floating point variable. You can have any type, and also construct your own types dynamically, using the RTTS (search for info).

You can also create internal tables dynamically by building on these techniques.

Read only

Former Member
0 Likes
492

Hi,

Yes. You can also make use of the class CL_ABAP_DATADESCR to create a new variable at runtime

Regards,

Siddarth

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
492

Hi,

Refer:

Hope this helps you.

Regards,

Tarun