Skip to Content
0
Former Member
Feb 20, 2011 at 06:38 PM

Creating multiple dynamic internal tables and accessing the same

1253 Views

Halo Experts,

1 I have got 10 attributes like my_attr1-my_attr10

in my class which are type ref to data

Depending upon the reqment I will instatnaite the attributes

In our example I am instantiating 3 attributes.say my_attr1- my_attr3.

my_ref_data( which is the final output) which contains fields from all the three.

This I am able to do.

2 Now I have an itab which has values like

name value

attr1 10

attr2 20

attr2 30

attr3 40

attr3 40

attr3 40

I loop at this itab I have to move this values to seperate attributes like

if name = 'ATTR1' then it should get appended to my_attr1.

if name = 'ATTR2' then it should get appended to my_attr2.

like wise So my_attr1 will have 1 entry and my_attr2 will have two entry and

my_attr3 will have 3 entries.

Can I do this dynamically . Because here we need to generate field symbols dynamically to assign.

otherwise the field symbols values will get overwrittten.

3

Now i should loop thru the attribute my_Attr3 which is having max no of entries

assign my_attr3->* <ft_max_ref_data>.
 loop at <ft_max_ref_data> assigning <fs_max_ref_data>.
 move-corresponding <fs_max_ref_data> to <fs_ref_data>.
 append <fs_ref_data> to <ft_ref_data>.
 endloop.

how can i access filled up my attriutes without creating separate field symbols?

Regards

Kallu