<?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 join 2 internal tables based on condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292809#M1989588</link>
    <description>&lt;P&gt;Hi&lt;BR /&gt;I have 2 internal tables,&lt;BR /&gt;ill give example:&lt;/P&gt;
  &lt;P&gt;itab1:&lt;BR /&gt;wa_1&lt;/P&gt;
  &lt;P&gt;vbeln&lt;BR /&gt;posnr&lt;BR /&gt;material (no value)&lt;BR /&gt;field4&lt;BR /&gt;field5&lt;BR /&gt;field6......&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;itab2&lt;BR /&gt;wa_2&lt;/P&gt;
  &lt;P&gt;vbeln&lt;BR /&gt;posnr&lt;BR /&gt;material (has value)&lt;/P&gt;
  &lt;P&gt;i want to join both in a way that ill get itab2-material value into itab1-material, &lt;BR /&gt;where itab1-vbeln = itab2 -vbeln&lt;BR /&gt;and itab1-posnr = itab2-posnr.&lt;/P&gt;
  &lt;P&gt;(their structure is different)&lt;/P&gt;
  &lt;P&gt;I guess its quite a simple question but would be great if someone can help with the way to achive this,&lt;BR /&gt;Thank you very much.&lt;/P&gt;</description>
    <pubDate>Sun, 16 Aug 2020 08:51:44 GMT</pubDate>
    <dc:creator>usersant077</dc:creator>
    <dc:date>2020-08-16T08:51:44Z</dc:date>
    <item>
      <title>join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292809#M1989588</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I have 2 internal tables,&lt;BR /&gt;ill give example:&lt;/P&gt;
  &lt;P&gt;itab1:&lt;BR /&gt;wa_1&lt;/P&gt;
  &lt;P&gt;vbeln&lt;BR /&gt;posnr&lt;BR /&gt;material (no value)&lt;BR /&gt;field4&lt;BR /&gt;field5&lt;BR /&gt;field6......&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;itab2&lt;BR /&gt;wa_2&lt;/P&gt;
  &lt;P&gt;vbeln&lt;BR /&gt;posnr&lt;BR /&gt;material (has value)&lt;/P&gt;
  &lt;P&gt;i want to join both in a way that ill get itab2-material value into itab1-material, &lt;BR /&gt;where itab1-vbeln = itab2 -vbeln&lt;BR /&gt;and itab1-posnr = itab2-posnr.&lt;/P&gt;
  &lt;P&gt;(their structure is different)&lt;/P&gt;
  &lt;P&gt;I guess its quite a simple question but would be great if someone can help with the way to achive this,&lt;BR /&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 08:51:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292809#M1989588</guid>
      <dc:creator>usersant077</dc:creator>
      <dc:date>2020-08-16T08:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292810#M1989589</link>
      <description>&lt;P&gt;Ill just add that on my case unfortunately I cant join everything into 1 internal table from the first place so I have to find a way to merge both&lt;/P&gt;&lt;P&gt;thanks again.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292810#M1989589</guid>
      <dc:creator>usersant077</dc:creator>
      <dc:date>2020-08-16T09:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292811#M1989590</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You could try something like following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;fs_itab1&amp;gt; LIKE LINE OF itab1,
               &amp;lt;fs_itab2&amp;gt; LIKE LINE OF itab2.

LOOP AT itab1 ASSIGNING &amp;lt;fs_itab1&amp;gt;.
  READ TABLE itab2 ASSIGNING &amp;lt;fs_itab2&amp;gt; WITH KEY vbeln = &amp;lt;fs_itab1&amp;gt;-vbeln
                                                 posnr = &amp;lt;fs_itab1&amp;gt;-posnr.

  IF sy-subrc = 0.
    &amp;lt;fs_itab1&amp;gt;-material = &amp;lt;fs_itab2&amp;gt;-material.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Geert-Jan Klaps&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:04:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292811#M1989590</guid>
      <dc:creator>geert-janklaps</dc:creator>
      <dc:date>2020-08-16T09:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292812#M1989591</link>
      <description>&lt;P&gt;Please use the button CODE to format your examples, like this:&lt;/P&gt;&lt;P&gt;itab1:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;vbeln posnr material   field4 field5 field6
----- ----- ---------- ------ ------ ------
XX    XX    (no value) XX     XX     XX&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;itab2:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;vbeln posnr material
----- ----- ----------
XX    XX    aaaaa&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to join both in a way that ill get itab2-material value into itab1-material:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;vbeln posnr material   field4 field5 field6
----- ----- ---------- ------ ------ ------
XX    XX    aaaaa      XX     XX     XX&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292812#M1989591</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-16T09:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292813#M1989592</link>
      <description>&lt;P&gt;Hi, thank you very much, ive tried but it still dosent fetch the value... any idea why maybe?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:22:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292813#M1989592</guid>
      <dc:creator>usersant077</dc:creator>
      <dc:date>2020-08-16T09:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292814#M1989593</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;usersant077&lt;/SPAN&gt; &lt;/P&gt;The solution provided by &lt;SPAN class="mention-scrubbed"&gt;8d8214c7f9734f45be69f95cc0d5aeee&lt;/SPAN&gt; should work. If it does not then please share the definition of ITAB1 and ITAB2 types. There might by some inconsistencies in the field types (probably missing zeros in the VBELN and/or POSNR fields).Posted on&lt;BR /&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
      <pubDate>Sun, 16 Aug 2020 09:32:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292814#M1989593</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-08-16T09:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292815#M1989594</link>
      <description>&lt;P&gt;Maybe post the actual code so we can have a better look. Above example should work if itab1 and itab2 contain the data you described.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:32:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292815#M1989594</guid>
      <dc:creator>geert-janklaps</dc:creator>
      <dc:date>2020-08-16T09:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292816#M1989595</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;usersant077&lt;/SPAN&gt;, 'joining' two internal tables based on two corresponding values (e.g. vbeln, posnr), should indeed be a 'quite simple' task. A very standard answer to solve this 'problem' has been presented to you, and if the data and the structures are ok, it works 100%.&lt;/P&gt;&lt;P&gt;There is nothing else the community can do for you now, &lt;EM&gt;unless&lt;/EM&gt; you also post the relevant parts of the coding (data definition and 'joining' technique, e.g. loop/read table) and possible give information about the data that should match but doesnt (e.g. screenshot of itabs in debugger showing the two fields).&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 02:25:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292816#M1989595</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-08-17T02:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: join 2 internal tables based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292817#M1989596</link>
      <description>&lt;P&gt;&amp;lt;fs_itab2&amp;gt; should be defined with as HASHED table with UNIQUE-KEY vbeln posnr, and the read should be:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  READ TABLE itab2 ASSIGNING &amp;lt;fs_itab2&amp;gt; WITH TABLE KEY vbeln = &amp;lt;fs_itab1&amp;gt;-vbeln
                                                        posnr = &amp;lt;fs_itab1&amp;gt;-posnr.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;otherwise you are likely to have performance problems.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(Also, using fs inside the angle brackets to indicate a field symbol when you already know that it's a field symbol due to the angle bracket... &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt; ).&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 10:31:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-2-internal-tables-based-on-condition/m-p/12292817#M1989596</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2020-08-17T10:31:19Z</dc:date>
    </item>
  </channel>
</rss>

