10-10-2007 4:05 AM
Hi all
Is there a way to declare the table base on the parameter?
eg.
PARAMETER: p_tablen TYPE tabname.
data : it_st like table of <b>p_tablen</b> with header line.
thks
10-10-2007 4:12 AM
Hi,
You can just create
PARAMETER: p_tablen TYPE <b>tabname.</b>
data : it_st like table of <b>tabname.</b> with header line.
Regards,
Atish
10-10-2007 4:17 AM
I receive a syntax error
"TABNAME" must be a flat structure. You cannot use a structure or
internal table as a component.
PARAMETER: p_tablen TYPE tabname.
data : it_st like table of tabname with header line.
What can be change?
10-10-2007 4:20 AM
Hi Gary ,
I am not able to understand the need to have a table/structure as a paramterer , could you please share some more info on your requirement .
Regards
Arun
10-10-2007 4:21 AM
Hi,
The TABNAME should be a valid type in SAP.
Can you tell me as what is your requirement,. why do you want declaration like this?
Regards,
Atish
10-10-2007 4:29 AM
I gt many table in my database, the user can enter a tablename to the paramater.
So i need to declare the table for my sql statement.
Hw to declare the table base on the parameter value?
10-10-2007 4:31 AM
Hi,
I think you are looking for dynamic internal tables.
Just search forum with dynamic internal table and you will get lots of idea on it.
Regards,
Atish
10-10-2007 4:35 AM
Hi Gray ,
If your requirement some thing like this , that the user enters a table name and you have to preocess data from the table .
If that is the case then i feel you need a paramtere which as input the name of table , you can define it using the data type TABNAME, please check the table DD02L .
and as per the post by Shiba , you can create a dynamic internal table to retreive the data and store it
feel free to revert back in case you still have any further queries.
Regards
Arun
10-10-2007 4:21 AM
try this
PARAMETER: p_tablen TYPE tabname.
data : it_st like table of dd03l-tabname with header line.
regards
shiba dutta
10-10-2007 4:34 AM
sorry for wrong understanding . I think you are talking about dynamic int table . if it is so then pls check this blog by rich heilman.
<a href="/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap">/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap</a>
regards
shiba dutta
10-10-2007 5:02 AM
Dynamic Internal table -weblog in sdn
/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
Rewards if useful..........
Minal
10-10-2007 5:54 AM
Dear Gary,
IMHO we can't use a structure type as a parameter ,
especially when the structure does not consist of string fields only.
This is the case why there is the need to define several select-options in the selection screen pointing to the same table ( ie : s_vbeln for vbak-vbeln, s_auart for vbak-auart ) .
In case of yours, if the parameter has a basic type, then the internal table definition should be just fine .
====
I have just read this thread again and find out that your requirement is to define a dynamic table .
In that case, you can ignore this reply
Rgds,
Tuwuh Sih Winedya
Message was edited by:
TUWUHSIH WINEDYA
10-10-2007 6:08 AM
Hi Gary..
This is the Sample code for ur ReQ:
DATA : REF_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <FTAB> TYPE TABLE.
parameters : L_TABNAME TYPE DD02L-TABNAME VALUE 'EKPO'.
CREATE DATA REF_TAB TYPE TABLE OF (L_TABNAME).
ASSIGN REF_TAB->* TO <FTAB>.
*
SELECT * FROM (L_TABNAME) INTO TABLE <FTAB>.
DESCRIBE TABLE <FTAB>.
WRITE:/ SY-TFILL.
<b>REWARD IF HELPFUL.</b>