title: How to transpose an internal table rows into columns?
body: <p>I want to transpose my internal table rows into column and i want to fix the first column,i am trying to do it with the following code but i am not getting the expected result....it is not converting all the rows into columns</p>
  
  <pre><code>*Types Declaration
  Types: BEGIN OF ty_t001w,
           ekorg TYPE t001w-ekorg,
           werks TYPE t001w-werks,
           name1 TYPE t001w-name1,
         END OF ty_t001w.
  
  **Field Symbols Declaration
   FIELD-SYMBOLS:  &lt;fs1&gt; TYPE any,
                   &lt;fs2&gt; TYPE any.
  
  **Internal table and work area declaration
   DATA: it1_col_row TYPE STANDARD TABLE OF ty_t001w,
         wa1_col_row TYPE ty_t001w,
         it2_col_row TYPE STANDARD TABLE OF ty_t001w,
         wa2_col_row TYPE ty_t001w,
         cline   TYPE sy-tabix.
  
  **Filling internal table with data
  
  Select *
    from t001w into corresponding fields of table it1_col_row
    where ekorg = p_ekorg
    and fabkl = p_fabkl.
  
  **Looping Internal table to display data
   LOOP AT it1_col_row INTO wa1_col_row.
     WRITE: / wa1_col_row-ekorg, wa1_col_row-werks,wa1_col_row-name1.
   ENDLOOP.
   WRITE: /.
  
  **Looping internal table to change rows into columns
   LOOP AT it1_col_row INTO wa1_col_row.
     CLEAR wa2_col_row.
     ASSIGN COMPONENT sy-tabix OF STRUCTURE wa2_col_row TO &lt;fs1&gt;.
     cline = sy-tabix.
     DO.
       ASSIGN COMPONENT sy-index OF STRUCTURE wa1_col_row TO &lt;fs2&gt;.
       IF sy-subrc NE 0.
         EXIT.
       ENDIF.
       IF cline = 1.
         &lt;fs1&gt; = &lt;fs2&gt;.
         APPEND wa2_col_row TO it2_col_row.
       ELSE.
         READ TABLE it2_col_row INTO wa2_col_row INDEX sy-index.
         &lt;fs1&gt; = &lt;fs2&gt;.
         MODIFY it2_col_row FROM wa2_col_row INDEX sy-index.
       ENDIF.
     ENDDO.
   ENDLOOP.
  *
  **Looping internal table to display
   LOOP AT it2_col_row INTO wa2_col_row.
     WRITE: / wa2_col_row-ekorg,wa2_col_row-werks, wa2_col_row-name1.
   ENDLOOP.
  </code></pre>