‎2007 Nov 05 10:31 AM
I want to accept a filename from user and display its contents.
parameters:tabname(15) type c.
data wa type ZGTABLE. *I dont know how to declare a variable of table type which user enters.
select * from (TABNAME) into wa. *Dynamic declaration
write wa.
endselect.
The output is coming,but I have hardcoded 'Data wa type zgtable' ie if user enters table otherthan zgtable it gives undesired ouput.I need to declare wa type as table type which user enters.Hope you understood my question.Thanks in advance.
‎2007 Nov 05 10:37 AM
Hi
take care that table name should be defined as:
data: tabname type dd08v-tabname Value 'MARA.
select * from (tabname) into table itab where x = y.
<b>Reward if usefull</b>
‎2007 Nov 05 10:38 AM
Hi
Try this piece of code:
REPORT YDEMO .
PARAMETERS: TBLNAME(50). "DEFAULT 'SPFLI'.
DATA: TOTAL_ROWS TYPE P.
SELECT COUNT(*) FROM (TBLNAME) INTO TOTAL_ROWS.
WRITE: / TBLNAME, TOTAL_ROWS.
Thanks
Vasudha
‎2007 Nov 05 10:39 AM
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
regards
shiba dutta
‎2007 Nov 05 10:39 AM
Hi Gopi,
Use Field symbols then. Or refer below thread
http://www.sap-img.com/ab030.htm
https://wiki.sdn.sap.com/wiki/display/Snippets/DynamicInternalTable
Regards,
Atish
‎2007 Nov 05 12:01 PM
Thanks guys for your replies.I tried your ways.
Naresh:Itab is not declared.How do you declare it now?we dont the structure of the table which user is going to input.
Vasudha : Your code displays number of total rows in the given table.
Reminder:If user enters zgtable,zgtable contents should be displayed.If zgtable1 is entered,its conents should be displayed.This is how it should work.
Any more help..Please.