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: 

Issues while modifying Dynamic Table with a Dynamic field catalog.

Former Member
0 Kudos
80

Hello,

We have developed a Z-report which displays Region(Sales Office) wise Open Sales Order Quantity based on Material Groups. The regions would display the open sales order quantity against a particular material group. The report display is as follows. SO stands for Sales Office.

Header 1SO..(1)
SO..(2)SO..(n)
Material Group 1     10.50     0.00    0.00
Material Group 1     0.00     55.60    0.00
Material Group 1     0.00     0.00    32.23

Inside my dynamic table as shown above, I have multiple rows for the same material group. I need to add up the quantity as shown above for the same material group and form a single row for a particular material group and append it to another dynamic table. SUM function does not support when internal table is looped using ASSIGNING. This is a part of my code snippet wherein I am trying to add the sales order quantity.

I have copied my original table to a temporary table in order to sum up the quantities. WGBEZ is the material group.

LOOP AT <DYN_TABLE> ASSIGNING <FS_DYNTABLE>.

     ASSIGN COMPONENT 1 OF STRUCTURE <FS_DYNTABLE> TO <FS_FLDVAL>.

     AT NEW <FS_FLDVAL>.
       LOOP AT <DYN_TABLE_TEMP> ASSIGNING <FS_DYNTABLE_TEMP> WHERE WGBEZ EQ <FS_FLDVAL>.

       ENDLOOP.
     ENDAT.

ENDLOOP.

I get an error inside the inner loop saying .."The row type of the table must be statically defined".

Can anybody please help me out in this.

Regards,

Danish.

2 REPLIES 2

kesavadas_thekkillath
Active Contributor
0 Kudos
47

Collect Statement ?

Collect <FS_DYNTABLE> into <ITAB2>.

Kartik2
Contributor
0 Kudos
47

Hi,

I think you should use the statement 'COLLECT' to sum up the values.

To avoid the error you have just described. you have to do the following for the inner loop.

LOOP AT <dyn_table_temp> ASSIGNING <fs_dyntable_temp>.

  ASSIGN COMPONENT 'WGBEZ' OF STRUCTURE <fs_dyntable_temp> to <dyn_field>.

  IF sy-subrc EQ 0 and <dyn_field> = <fs_fldval>.

  ENDIF.

ENDLOOP.

Hope it helps. Thank you.

Regards,

kartik