‎2008 Feb 04 12:36 PM
Hi All
I need to create an internal table at runtime.
I have a selection screen parameter which is specific to country, Which can take values below
eg:- IT_AREA for Italy(IT)
FR_AREA for France(FR)
IE_AREA for Ireland(IE).....And similary for other countries
Based on the Above parameter, I need to create Internal Table as below
DATA: itab TYPE italy_data Occurs 0.
If I declare as above, Then itab has fields from italy_data. And this internal table i will be sending it to Function Module to get data into it.
My Requirement is to Create the Internal table itab during runtime for tables italy_data OR france_data OR ireland_data based on selection screen parameter. Tables on Country may have different number of fields in it.
Can anyone help me on this??
‎2008 Feb 04 12:43 PM
Check this webblog of Dynamic Internal Table
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
‎2008 Feb 04 12:43 PM
Check this webblog of Dynamic Internal Table
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
‎2008 Feb 04 12:47 PM
DATA:
tabname type string,
it TYPE REF TO data,
wa TYPE REF TO data.
FIELD-SYMBOLS:
<it> TYPE STANDARD TABLE,
<p> TYPE ANY.
case s_ctry-low.
when 'IT_AREA '.
tabname = 'italy_data'.
* other possibilities here
endcase.
CREATE DATA it TYPE TABLE OF (tabname).
ASSIGN it->* TO <it>.
select *
into table <it>
from (tabname).
Edited by: Rainer Hübenthal on Feb 4, 2008 1:47 PM