<?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 Re: Fetch data from internal table with different structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646164#M2014711</link>
    <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;sun_light&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;have a look at Move-Corresponding&lt;/P&gt;&lt;P&gt;We all know about this keyword and we have been since we learned it. 
For the benefit of me, I would like to define it once again.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING is used to move values from one structure to another.&lt;/P&gt;Now
 that you can not wait to know how this works for internal tables. I 
have to keep you waiting a little longer and introduce you to a new ABAP
 7.4 keyword, a constructor operator called &lt;STRONG&gt;CORRESPONDING&lt;/STRONG&gt;&lt;H3&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;Lets make this 
example even more complex, i have two different set of columns for the 
two internal tables and copy the column named COL2 of first internal 
table to COL3 of second internal table and the code is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES : BEGIN OF lty_demo1,
          col1 TYPE c,
          col2 TYPE c,
        END OF lty_demo1,

        BEGIN OF lty_demo2,
          col1 TYPE c,
          col2 TYPE c,
          col3 TYPE c,
        END OF lty_demo2.

DATA: itab1 TYPE STANDARD TABLE OF lty_demo1,
      itab2 TYPE STANDARD TABLE OF lty_demo2.

itab1 = VALUE #( ( col1 = 'A' col2 = 'B' )
                 ( col1 = 'P' col2 = 'Q' )
                 ( col1 = 'N' col2 = 'P' )
               ).
itab2 = CORRESPONDING #( itab1 MAPPING COL3 = COL2 EXCEPT COL2 ).

cl_demo_output=&amp;gt;write_data( itab1 ).
cl_demo_output=&amp;gt;write_data( itab2 ).
cl_demo_output=&amp;gt;display( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;P&gt;regards &lt;/P&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;P&gt;Christian Fritsch &lt;/P&gt;&lt;/STRONG&gt;</description>
    <pubDate>Tue, 14 Mar 2023 06:51:24 GMT</pubDate>
    <dc:creator>former_member128578</dc:creator>
    <dc:date>2023-03-14T06:51:24Z</dc:date>
    <item>
      <title>Fetch data from internal table with different structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646163#M2014710</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;
  &lt;P&gt;I have first internal table with 2 columns cocd, descrp, ( blank internal table) &lt;/P&gt;
  &lt;P&gt;Second internal table have 3 columns- title, charvalue, charname, in that , I have entry called fr30 under first column, france under second column, cocd under third column. &lt;/P&gt;
  &lt;P&gt;So i want to move this fr30 &amp;amp; France to the cocd and descrp respectively without hard coding( since I have thousands of entries like this) &lt;/P&gt;
  &lt;P&gt;I tried like this, &lt;/P&gt;
  &lt;P&gt;if gs-charname = 'cocd'. &lt;/P&gt;
  &lt;P&gt;Move gs_tab2-title to gs_tab1-cocd.&lt;/P&gt;
  &lt;P&gt;Move gs_tab2-charvalue to gs_tab1-descp.&lt;/P&gt;
  &lt;P&gt;I have some 50 fields like this so, is there any other way. &lt;/P&gt;
  &lt;P&gt;Thanks in advance&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 02:59:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646163#M2014710</guid>
      <dc:creator>sun_light</dc:creator>
      <dc:date>2023-03-14T02:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch data from internal table with different structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646164#M2014711</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;sun_light&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;have a look at Move-Corresponding&lt;/P&gt;&lt;P&gt;We all know about this keyword and we have been since we learned it. 
For the benefit of me, I would like to define it once again.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING is used to move values from one structure to another.&lt;/P&gt;Now
 that you can not wait to know how this works for internal tables. I 
have to keep you waiting a little longer and introduce you to a new ABAP
 7.4 keyword, a constructor operator called &lt;STRONG&gt;CORRESPONDING&lt;/STRONG&gt;&lt;H3&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;Lets make this 
example even more complex, i have two different set of columns for the 
two internal tables and copy the column named COL2 of first internal 
table to COL3 of second internal table and the code is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES : BEGIN OF lty_demo1,
          col1 TYPE c,
          col2 TYPE c,
        END OF lty_demo1,

        BEGIN OF lty_demo2,
          col1 TYPE c,
          col2 TYPE c,
          col3 TYPE c,
        END OF lty_demo2.

DATA: itab1 TYPE STANDARD TABLE OF lty_demo1,
      itab2 TYPE STANDARD TABLE OF lty_demo2.

itab1 = VALUE #( ( col1 = 'A' col2 = 'B' )
                 ( col1 = 'P' col2 = 'Q' )
                 ( col1 = 'N' col2 = 'P' )
               ).
itab2 = CORRESPONDING #( itab1 MAPPING COL3 = COL2 EXCEPT COL2 ).

cl_demo_output=&amp;gt;write_data( itab1 ).
cl_demo_output=&amp;gt;write_data( itab2 ).
cl_demo_output=&amp;gt;display( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;P&gt;regards &lt;/P&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;P&gt;Christian Fritsch &lt;/P&gt;&lt;/STRONG&gt;</description>
      <pubDate>Tue, 14 Mar 2023 06:51:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646164#M2014711</guid>
      <dc:creator>former_member128578</dc:creator>
      <dc:date>2023-03-14T06:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch data from internal table with different structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646165#M2014712</link>
      <description>&lt;P&gt;You are searching to use dynamic fieldname like that ? &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data(field) = 'GS_TAB1-' &amp;amp;&amp;amp; gs-charname.&lt;BR /&gt;assign (field) to field-symbol(&amp;lt;field_content&amp;gt;).&lt;BR /&gt;if &amp;lt;field_content&amp;gt; is assigned.&lt;BR /&gt;  move gs_tab2-title to &amp;lt;field_content&amp;gt;.&lt;BR /&gt;endif.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2023 07:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646165#M2014712</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2023-03-14T07:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch data from internal table with different structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646166#M2014713</link>
      <description>&lt;P&gt;Or&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;assign COMPONENT gs-charname OF STRUCTURE gs_tab1 TO FIELD-SYMBOL(&amp;lt;fs&amp;gt;).&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also check field names are in uppercase?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 09:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-internal-table-with-different-structure/m-p/12646166#M2014713</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-03-14T09:10:47Z</dc:date>
    </item>
  </channel>
</rss>

