‎2008 Dec 09 5:46 PM
Hi,
I have the need to iterate over values in a given field of an internal table and create fields from each distinct value in another internal table. The resulting table would then be displayed in ALV Grid.
Here is a scenario to help make it clear:
original table:
pernr, wage type, amount
10000001, 1000, $100
10000001, 1001, $200
10000001, 1002, $300
10000002, 1000, $200
...
desired result:
pernr, wage type 1000 amount, wage type 1001 amount, wage type 1002 amount
10000001, $100, $200, $300
10000002, $200,,
...
The number of wage types needs to be determined at run time.
Thanks for any help!
‎2008 Dec 09 5:50 PM
There are many threads on [create dynamic internal table|https://www.sdn.sap.com/irj/scn/advancedsearch?query=createdynamicinternal+table&cat=sdn_all]
In a first loop, count the number of fields to create, then create the field-catalog and then the internal table, and last fill the new internal table.
Regards
‎2008 Dec 09 5:50 PM
There are many threads on [create dynamic internal table|https://www.sdn.sap.com/irj/scn/advancedsearch?query=createdynamicinternal+table&cat=sdn_all]
In a first loop, count the number of fields to create, then create the field-catalog and then the internal table, and last fill the new internal table.
Regards