<?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 Transfer dynamic data from source table to target table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280593#M1633766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI All ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is two table lt_source and lt_target which both are type any table ,I want to move data from &lt;/P&gt;&lt;P&gt;lt_source to lt_target ,lt_target have some identical column but not all of them,&lt;/P&gt;&lt;P&gt;for instance &lt;/P&gt;&lt;P&gt;in lt_source I have Column F1 - F10 and lt_target I have just F2 and F7 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do that ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Sep 2011 09:17:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-26T09:17:10Z</dc:date>
    <item>
      <title>Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280593#M1633766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI All ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is two table lt_source and lt_target which both are type any table ,I want to move data from &lt;/P&gt;&lt;P&gt;lt_source to lt_target ,lt_target have some identical column but not all of them,&lt;/P&gt;&lt;P&gt;for instance &lt;/P&gt;&lt;P&gt;in lt_source I have Column F1 - F10 and lt_target I have just F2 and F7 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do that ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 09:17:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280593#M1633766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-26T09:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280594#M1633767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  FIELD-SYMBOLS: &amp;lt;ls_source&amp;gt; type any,
                 &amp;lt;ls_target&amp;gt; type any.

loop at lt_source assigning &amp;lt;ls_source&amp;gt;.
  append initial line to lt_target assigning &amp;lt;ls_target&amp;gt;.
  move-corresponding &amp;lt;ls_source&amp;gt; to &amp;lt;ls_target&amp;gt;.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 09:26:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280594#M1633767</guid>
      <dc:creator>arseni_gallardo</dc:creator>
      <dc:date>2011-09-26T09:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280595#M1633768</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;However this won't work if your internal tables have the type ANY TABLE...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, you will have to play with the class cl_abap_structdescr to first know the components and be able to do the matching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: go_typedesc TYPE REF TO cl_abap_typedescr.
FIELD-SYMBOLS: &amp;lt;tab1&amp;gt; TYPE ANY TABLE.
"...
DATA: l_dref     TYPE REF TO data.
GET REFERENCE OF &amp;lt;tab1&amp;gt; INTO l_dref.
go_typedesc ?= cl_abap_structdescr=&amp;gt;describe_by_data_ref( l_dref ).

"Then components of your tab should then be in go_typedesc-&amp;gt;key[]
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 09:50:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280595#M1633768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-26T09:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280596#M1633769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right. My sample code will only work correctly for STANDARD TABLES. In a general case this would do the trick:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  FIELD-SYMBOLS: &amp;lt;ls_source&amp;gt; TYPE ANY,
                 &amp;lt;ls_target&amp;gt; TYPE ANY.
  DATA: l_ref TYPE REF TO data.

  CREATE DATA l_ref LIKE LINE OF lt_target.
  ASSIGN l_ref-&amp;gt;* TO &amp;lt;ls_target&amp;gt;.
  LOOP AT lt_source ASSIGNING &amp;lt;ls_source&amp;gt;.
    MOVE-CORRESPONDING &amp;lt;ls_source&amp;gt; TO &amp;lt;ls_target&amp;gt;.
    INSERT &amp;lt;ls_target&amp;gt; INTO TABLE lt_target.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 10:15:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280596#M1633769</guid>
      <dc:creator>arseni_gallardo</dc:creator>
      <dc:date>2011-09-26T10:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280597#M1633770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Of course... Seems I'm still asleep &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much easier this way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 10:20:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280597#M1633770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-26T10:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280598#M1633771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello M,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're code won't work if the target table is ANY TABLE(because index access is not possible for HASHED TABLEs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can prevent the usage of the RTTI class by using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;itab1&amp;gt; TYPE ANY TABLE,
               &amp;lt;itab2&amp;gt; TYPE ANY TABLE,
               &amp;lt;wa1&amp;gt;   TYPE ANY,
               &amp;lt;wa2&amp;gt;   TYPE ANY.

LOOP AT &amp;lt;itab1&amp;gt; ASSIGNING &amp;lt;wa1&amp;gt;.

  INSERT INITIAL LINE INTO TABLE &amp;lt;itab2&amp;gt; ASSIGNING &amp;lt;wa2&amp;gt;.
  MOVE-CORRESPONDING &amp;lt;wa1&amp;gt; TO &amp;lt;wa2&amp;gt;.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NB: Please remember that duplicate records(if any) will get filtered out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: I try not to use the generic table type(ANY TABLE) in most of the cases. I prefer using the more specific STANDARD TABLE, SORTED TABLE or HASHED TABLE as or when required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 10:37:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280598#M1633771</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-26T10:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280599#M1633772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sushas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code won't work either for HASHED or SORTED tables because it is forbidden to change the value of the key fields (runtime exception). The code in my second post prevents this from happening.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 10:45:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280599#M1633772</guid>
      <dc:creator>arseni_gallardo</dc:creator>
      <dc:date>2011-09-26T10:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer dynamic data from source table to target table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280600#M1633773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I forgot that i was trying to change the key fields of a SORTED / HASHED table. My bad &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for pointing it out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Sep 26, 2011 4:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 11:07:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transfer-dynamic-data-from-source-table-to-target-table/m-p/8280600#M1633773</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-26T11:07:16Z</dc:date>
    </item>
  </channel>
</rss>

