Wednesday, August 29, 2012

How to Transpose Internal Table in SAP ABAP?

Suppose you have one internal table with 12 rows and 15 columns, and you want to transpose it to become 15 rows and 12 columns, how to do it in ABAP? In Excel it can be done easily by simply copy the table and select Paste Special and tick Transpose option.
Will it be such easy in SAP? Things can be easier if you do it with your heart. I heart you, internal table.
So, you're gonna need field-symbols, of course. And loop (can't live without it!). And one magic elegant word like 'ASSIGN COMPONENT idxcol OF STRUCTURE itab TO thefieldsymbol'.

Here is the sample of the codes:

Post a Comment