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

get a reference to a table which is only known as string

Former Member
0 Likes
723

Hi all,

is there a way to get the real variable from a String?

The coding is like this:

Data: itab1 type table of XXX,

itab2 type table of XXX,

itab3 type table of XXX,

.

.

Somewhere in the program i read a configuration table and get for example the string 'itab2'.

Is there a way to get from the string 'itab2' to the real itab2?

Because I'm in a User-Exit in a generated program, I don't know which tables are defined. If the name is in the configuration table, the real table is existing.

Best regards

Dominik

Hi all,

is there a way to get the real variable from a String?

The coding is like this:

Data: itab1 type table of XXX,

itab2 type table of XXX,

itab3 type table of XXX,

.

.

Somewhere in the program i read a configuration table and get for example the string 'itab2'.

Is there a way to get from the string 'itab2' to the real itab2?

Because I'm in a User-Exit in a generated program, I don't know which tables are defined. If the name is in the configuration table, the real table is existing.

Best regards

Dominik

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
666

If I understand correct, you hav Configuration table and which has the name 'ITAB2' and you want to access that in your user exit than you can use the field symbol to do that.

Like:


FIELD-SYMBOLS: <FS_TAB> TYPE ANY TAB.

ASSIGN (CONFIG_TAB-TAB_NAME) TO <FS_TAB>.

Now in the program, you will able to access the <FS_TAB> with relevent content.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
666

Pl find the below code.

DATA: lv_tab_name TYPE dd02l-tabname.

FIELD-SYMBOLS: <fs_inttab> TYPE STANDARD TABLE.

DATA : lr_tab TYPE REF TO data.

CREATE DATA lr_tab TYPE STANDARD TABLE OF (lv_tab_name).

ASSIGN lr_tab->* TO <fs_inttab>.

SELECT * FROM (lv_tab_name)

INTO TABLE <fs_inttab>

WHERE (lv_where).

Hope it helps.

Thanks,

Srinivas

Read only

Former Member
0 Likes
666

Thanks a lot. Sometimes it can be simple too.