cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic internal table assignment.

Former Member
0 Kudos
140

I have few internal tables in my bsp application but at a time i need to show 1 internal table based on some criteria into tableview.

can anybody guide me how to do so, its really urgent

Thanx,

Abhijeet

View Entire Topic
Former Member
0 Kudos

Hi Abhijeet,

Just use field-symbols and ur problem will be solved.

Check out the following code:

<% Field-symbols <var> type any .

.......logic for internal table selection..

assign it2 to <var>.

%>

<htmlb:tableView id="tab1" table="<%=<var>%>">

</htmlb:tableView>

Hope it'll help u.

Thanks & Regards,

Ankur

Former Member
0 Kudos

Thanks Ankur.

I can now dynamically select and view my tables.

One more thing in my internal tanles i have large no. of fields.

transferring data to an another internal table would be too much complex.

Is there any simplified way to do that ?

Regards,

Abhijeet

Former Member
0 Kudos

Hi Abhijeet,

Can u please post this as a new thread in ABAP programming forum as it would be more suitable.

Thanks & Regards,

Ankur

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Do you mean making a copy of the internal table? You can do this with one line of code.


itab2[] = itab1[].

The entire contents of itab1 are copied to itab2. Actually the memory isn't copied until you do a modification operation on itab2. Until that point it is just reference to itab1. But that is all behind the scenes and handled by the ABAP runtime.

Don't forget you also have the move-corresponding command in case you don't have indentical structures. You would loop through itab1 and perform a move-corresponding for each record.