01-17-2008 2:50 PM
Hi all
I want to use a function module in different programs. I want to pass always a table and in a string the name of the structure, so that I can access the data with ASSIGN and the passed structure name.
For a structure I can use the type ANY, but if I want to use a table in a function module, I need to define a table type.
Is there a way to define a tabletype with the type ANY? A Workaround would be fine too.
Thanks and best regards!
Christian
01-18-2008 3:42 AM
Hi Christian,
ANY TABLE is used to type a parameter, or field symbol, that can be a table of any type or structure.
ANY is used to type a parameter, or field symbol, that can be any type. You can't, however, use any table operations on a parameter/field-symbol typed as ANY. For that, you have to use ANY TABLE.
The same applies to ANY. You can pass to the method a data object, without specifying its type (i.e, in dynamic programs).
Suppose that I need to split a line into a table, but I don't know the structure of this line:
I have a method:
codeMETHOD split_line_in_table IMPORTING im_line TYPE ANY
EXPORTING ex_table TYPE ANY TABLE.
[/code]
codeMETHOD split_line_in_table.
SPLIT im_line AT separator INTO TABLE ex_table.
ENDMETHOD.[/code]
Now, i can pass this method a line of ANY structure and get a table without specifying its structure.
cheers,
Hema.
01-18-2008 3:42 AM
Hi Christian,
ANY TABLE is used to type a parameter, or field symbol, that can be a table of any type or structure.
ANY is used to type a parameter, or field symbol, that can be any type. You can't, however, use any table operations on a parameter/field-symbol typed as ANY. For that, you have to use ANY TABLE.
The same applies to ANY. You can pass to the method a data object, without specifying its type (i.e, in dynamic programs).
Suppose that I need to split a line into a table, but I don't know the structure of this line:
I have a method:
codeMETHOD split_line_in_table IMPORTING im_line TYPE ANY
EXPORTING ex_table TYPE ANY TABLE.
[/code]
codeMETHOD split_line_in_table.
SPLIT im_line AT separator INTO TABLE ex_table.
ENDMETHOD.[/code]
Now, i can pass this method a line of ANY structure and get a table without specifying its structure.
cheers,
Hema.
01-18-2008 8:36 AM
Exactly the information, which I was searching for!
Thank you very much!!