11-07-2007 6:16 AM
Hi Freinds,
I have a small doubt.
What I am doing is....I have a custom table,which will contain entries this way.
<u>CONDITION</u> <u>TABLE NAME</u>
A MARA
B VBAK
C EKKO
So,based on the condition I need to fire a Select Query on the respective table.
I am doing the selection in a subroutine.
Now,I am Selecting from v_tabname...v_tabname contains table name.
But,this is an error, coz Select query always allows to select from DB table.
Is there any way to dynamically get the table name in Select Query.
Any Object Programming ?
Eg., SELECT FROM <u>TABNAME</u>
Regards,
Imran.
11-07-2007 6:20 AM
Hi
U can refer these links:
<u>http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm</u>
<u>http://help.sap.com/saphelp_nw2004s/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm</u>
Thanks
Vasudha
11-07-2007 6:18 AM
hi.
sample code:
REPORT ZSEL_BGJOB.
DATA : REF_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <FTAB> TYPE TABLE.
DATA: 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.
Reward if Helpful.
11-07-2007 6:20 AM
Hi
U can refer these links:
<u>http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm</u>
<u>http://help.sap.com/saphelp_nw2004s/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm</u>
Thanks
Vasudha