Application Development and Automation 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: 
Read only

how to read data from dynamic work area.

Former Member
0 Likes
2,732

Hi guys,

I have created dynamic table and work area for report.

i have populated few values in dynamic work area.

Now i want to read that data from work area again for calculation.

i can not use local varialbes to store those values as i dont know how many such variables i need to read.

that will be known only at run time.

So as per my knowledge i have only 1 option...to read those all values from work area.

Kindly help me .... how can i read data which is stored in dynamic work area.

1 ACCEPTED SOLUTION
Read only

aabhas_wilmar
Contributor
0 Likes
1,384

Hi Kiran,

Following is not exact code, but exact solution to your problem:

  LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
      l_tabix = sy-tabix.
      ASSIGN COMPONENT 'KOTAB' OF STRUCTURE <dyn_wa> TO <l_kotab>.
      IF <l_kotab> IS ASSIGNED AND <l_kotab> IS INITIAL.
        <l_kotab> = gt_tabs-kotab.
        MODIFY <dyn_table> FROM <dyn_wa> INDEX l_tabix.
      ENDIF.
    ENDLOOP.

I am hardcoding KOTAB as I was sure about that being in the dynamic structure.

You can loop on the field catalogue, which you used to create dyamic table, to use the FIELDNAME to read all the fields of the work area (structure) of your dynamic table.

thanks,

Aabhas

Edited by: Aabhas K Vishnoi on Sep 24, 2009 8:12 PM

Hi guys,

I have created dynamic table and work area for report.

i have populated few values in dynamic work area.

Now i want to read that data from work area again for calculation.

i can not use local varialbes to store those values as i dont know how many such variables i need to read.

that will be known only at run time.

So as per my knowledge i have only 1 option...to read those all values from work area.

Kindly help me .... how can i read data which is stored in dynamic work area.

4 REPLIES 4
Read only

aabhas_wilmar
Contributor
0 Likes
1,385

Hi Kiran,

Following is not exact code, but exact solution to your problem:

  LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
      l_tabix = sy-tabix.
      ASSIGN COMPONENT 'KOTAB' OF STRUCTURE <dyn_wa> TO <l_kotab>.
      IF <l_kotab> IS ASSIGNED AND <l_kotab> IS INITIAL.
        <l_kotab> = gt_tabs-kotab.
        MODIFY <dyn_table> FROM <dyn_wa> INDEX l_tabix.
      ENDIF.
    ENDLOOP.

I am hardcoding KOTAB as I was sure about that being in the dynamic structure.

You can loop on the field catalogue, which you used to create dyamic table, to use the FIELDNAME to read all the fields of the work area (structure) of your dynamic table.

thanks,

Aabhas

Edited by: Aabhas K Vishnoi on Sep 24, 2009 8:12 PM

Read only

Former Member
0 Likes
1,384

thx a LOT

Read only

Former Member
0 Likes
1,384

HI

Read only

Former Member
0 Likes
1,384

THX A LOT