Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime Declaration of Internal Table

Former Member
0 Kudos

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??

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Check this webblog of Dynamic Internal Table

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

2 REPLIES 2

Former Member
0 Kudos

Check this webblog of Dynamic Internal Table

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

rainer_hbenthal
Active Contributor
0 Kudos

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