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

Dynamic type variables

Former Member
0 Likes
467

I have a function module that receives a table name, in a character variable.

How do I create a variable, within the function, of the type of the parameter-passed table ?

I've been trying with field-symbols and create data, but without success.

Could anyone show me an example please?

Thanks

Avraham

3 REPLIES 3
Read only

Former Member
0 Likes
445

HI,

I think u need the data element to pass the table name

if so try this

TABNAME16

this is the data element used for table names.

Regards,

Venkatesh

Read only

0 Likes
445

I'm sorry, I do receive the table name in a variable of type

DD02D-TABNAME, not in a char variable. How does it help me, anyways.

Read only

0 Likes
445

Hi Avraham,

maybe this helps:

data: lt_table type ref to data.

create data lt_table type standard table of ('SFLIGHT').

With create data you can achieve what you need.

Then analyze the fields in the table and use it with that information.

here you will want to look at classes cl_abap_typedescr, cl_abap_tabledescr and cl_abap_structdescr.

Hope that helps,

Lutz

Edited by: Lutz Morrien on Oct 29, 2008 11:18 AM