Application Development 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: 

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

Former Member
0 Kudos

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

naimesh_patel
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks a lot. Sometimes it can be simple too.