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:

Tuesday, August 28, 2012

Never Thought that Adding Space in Text in Smartforms is That Easy!

Have you ever crossed loosing white space you add inside the texts on generating reports created in the SAP smartforms? I have. I was wondering why smartforms doesn't like space. What did space do wrong? Why smartforms swallow spaces whenever I add it in the text to make indent effect.

Don't get frustated. It's very easy to add space. Yeah, it's easy after you know it. Type the spaces inside the text variable with quotes like:
&' 'myvariable&

Never thought it's that easy? Neither have I!