<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic move data from one internal table to dynamic internal table - column wise in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-from-one-internal-table-to-dynamic-internal-table-column-wise/m-p/3860725#M927896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi abap gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i got two internal tables (one is dynamic).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1 has columns f1, f2 ... f8, with column headings in first row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e date in itab looks like : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;row1      matnr   maktx meins.......&lt;/P&gt;&lt;P&gt;row2      0001    raw     kg&lt;/P&gt;&lt;P&gt;row3      002      fert     kg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;itab2&amp;gt;  is dynamic internal table and  has columns col1, col2 ... col8, where data in f1 is to be placed in col4 , f2 into col3 ... and so on &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the order of f1, f2 .. (in itab1) differs in &amp;lt;itab2&amp;gt; &lt;/P&gt;&lt;P&gt;(Note : colunm names are also different. the relation between the columns of both tables in maintained in other internal table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to move data from one internal table to another internal table (dynamic internal table)  column wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is that i need to move the data column wise . It is one column data should be moved to dynamic internal table cloumn and so on ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an urgent requirement.&lt;/P&gt;&lt;P&gt;Any suggestions are appreciable and will be rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Wajid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 May 2008 08:49:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-26T08:49:34Z</dc:date>
    <item>
      <title>move data from one internal table to dynamic internal table - column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-from-one-internal-table-to-dynamic-internal-table-column-wise/m-p/3860725#M927896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi abap gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i got two internal tables (one is dynamic).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1 has columns f1, f2 ... f8, with column headings in first row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e date in itab looks like : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;row1      matnr   maktx meins.......&lt;/P&gt;&lt;P&gt;row2      0001    raw     kg&lt;/P&gt;&lt;P&gt;row3      002      fert     kg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;itab2&amp;gt;  is dynamic internal table and  has columns col1, col2 ... col8, where data in f1 is to be placed in col4 , f2 into col3 ... and so on &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the order of f1, f2 .. (in itab1) differs in &amp;lt;itab2&amp;gt; &lt;/P&gt;&lt;P&gt;(Note : colunm names are also different. the relation between the columns of both tables in maintained in other internal table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to move data from one internal table to another internal table (dynamic internal table)  column wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is that i need to move the data column wise . It is one column data should be moved to dynamic internal table cloumn and so on ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an urgent requirement.&lt;/P&gt;&lt;P&gt;Any suggestions are appreciable and will be rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Wajid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 08:49:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-from-one-internal-table-to-dynamic-internal-table-column-wise/m-p/3860725#M927896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T08:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: move data from one internal table to dynamic internal table - column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-from-one-internal-table-to-dynamic-internal-table-column-wise/m-p/3860726#M927897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you could find inspiration in following source code example (see "assign component" instruction)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itTABLE TYPE REF TO data.&lt;/P&gt;&lt;P&gt;DATA stTABLE TYPE REF TO data.&lt;/P&gt;&lt;P&gt;PARAMETERS : P_TABLE TYPE TABNAME OBLIGATORY.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Field-symbols&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;TABLE&amp;gt;    TYPE STANDARD TABLE,&lt;/P&gt;&lt;P&gt;                &amp;lt;TABLE_wa&amp;gt; TYPE ANY,&lt;/P&gt;&lt;P&gt;                &amp;lt;field&amp;gt; type any.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA itTABLE TYPE STANDARD TABLE OF (P_TABLE).&lt;/P&gt;&lt;P&gt;ASSIGN itTABLE-&amp;gt;* TO &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE DATA stTABLE TYPE  (P_TABLE).&lt;/P&gt;&lt;P&gt;ASSIGN stTABLE-&amp;gt;* TO &amp;lt;TABLE_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM (P_TABLE) INTO TABLE &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : w_file(250).&lt;/P&gt;&lt;P&gt;DATA :       w_line type string.&lt;/P&gt;&lt;P&gt;data : w_tab type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE ..... into w_file &lt;/P&gt;&lt;P&gt;w_tab = CL_ABAP_CHAR_UTILITIES=&amp;gt;horizontal_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset w_file for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;  message e276(8Z) with w_file.&lt;/P&gt;&lt;P&gt;  exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;GET STRUCTURE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data : idetails type abap_compdescr_tab,&lt;/P&gt;&lt;P&gt;     xdetails type abap_compdescr.&lt;/P&gt;&lt;P&gt;data : ref_table_des type ref to cl_abap_structdescr.&lt;/P&gt;&lt;P&gt;ref_table_des ?=&lt;/P&gt;&lt;P&gt;     cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).&lt;/P&gt;&lt;P&gt;idetails[] = ref_table_des-&amp;gt;components[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IDETAILS INTO XDETAILS.&lt;/P&gt;&lt;P&gt;  if sy-tabix = 1.&lt;/P&gt;&lt;P&gt;    w_line = XDETAILS-name.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    concatenate w_line w_tab  XDETAILS-name into w_line.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;transfer w_line to w_file.&lt;/P&gt;&lt;P&gt;clear w_line.&lt;/P&gt;&lt;P&gt;DATA : W_FIELD(23).&lt;/P&gt;&lt;P&gt;loop at &amp;lt;TABLE&amp;gt; assigning &amp;lt;TABLE_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;  do.&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;assign component  sy-index&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;of structure &amp;lt;table_wa&amp;gt; to &amp;lt;field&amp;gt; .&lt;/STRONG&gt;    if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      exit.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    READ TABLE IDETAILS INTO XDETAILS INDEX SY-INDEX.&lt;/P&gt;&lt;P&gt;    CASE XDETAILS-TYPE_KIND.&lt;/P&gt;&lt;P&gt;      WHEN 'P' OR 's' OR 'b' OR 'F' OR 'X' OR 'I'.&lt;/P&gt;&lt;P&gt;        W_FIELD = &amp;lt;FIELD&amp;gt;.&lt;/P&gt;&lt;P&gt;        if sy-index = 1.&lt;/P&gt;&lt;P&gt;          w_line = W_field.&lt;/P&gt;&lt;P&gt;         else.&lt;/P&gt;&lt;P&gt;           concatenate w_line w_tab W_field into w_line.&lt;/P&gt;&lt;P&gt;         endif.&lt;/P&gt;&lt;P&gt;       WHEN OTHERS.&lt;/P&gt;&lt;P&gt;         if sy-index = 1.&lt;/P&gt;&lt;P&gt;           w_line = &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;         else.&lt;/P&gt;&lt;P&gt;           concatenate w_line w_tab &amp;lt;field&amp;gt; into w_line.&lt;/P&gt;&lt;P&gt;         endif.&lt;/P&gt;&lt;P&gt;     ENDCASE.&lt;/P&gt;&lt;P&gt;   enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   transfer w_line to w_file.&lt;/P&gt;&lt;P&gt;   clear w_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;P&gt; close dataset w_file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 12:38:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-from-one-internal-table-to-dynamic-internal-table-column-wise/m-p/3860726#M927897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T12:38:05Z</dc:date>
    </item>
  </channel>
</rss>

