2012 Jun 26 12:04 PM
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 1 | SO..(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.
2012 Jun 26 12:14 PM
2012 Jun 26 12:24 PM
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