<?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: compare multiple variable selections between two internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215164#M1523136</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its hard to mention the logic here.&lt;/P&gt;&lt;P&gt;You can make use of range table for comparison.&lt;/P&gt;&lt;P&gt;Append all the values to the range table.&lt;/P&gt;&lt;P&gt;TL1&lt;/P&gt;&lt;P&gt;TL2&lt;/P&gt;&lt;P&gt;TL3&lt;/P&gt;&lt;P&gt;TL4&lt;/P&gt;&lt;P&gt;TL5&lt;/P&gt;&lt;P&gt;TL6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at second itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then a if condition with &lt;STRONG&gt;in&lt;/STRONG&gt; statement will do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wa-field in r_1. &lt;/P&gt;&lt;P&gt;exists.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope i understood your question properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Aug 2010 19:41:59 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2010-08-26T19:41:59Z</dc:date>
    <item>
      <title>compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215163#M1523135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to work out the syntax for the following, however i am stumped on the 2nd part of the requirement....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two internal tables.  and i need to compare the records.&lt;/P&gt;&lt;P&gt;1st, line by line, which i can do, however the 2nd requirement, i need to check a range of data against the same table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is an example of the tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal Table1 has the following records.&lt;/P&gt;&lt;P&gt;TL1&lt;/P&gt;&lt;P&gt;TL2&lt;/P&gt;&lt;P&gt;TL3&lt;/P&gt;&lt;P&gt;TL4&lt;/P&gt;&lt;P&gt;TL5&lt;/P&gt;&lt;P&gt;TL6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table 2 has the following records...&lt;/P&gt;&lt;P&gt;LDOC1	TL1&lt;/P&gt;&lt;P&gt;LDOC1	TL2&lt;/P&gt;&lt;P&gt;LDOC1	TL3&lt;/P&gt;&lt;P&gt;LDOC1	TL7&lt;/P&gt;&lt;P&gt;LDOC2	TL1&lt;/P&gt;&lt;P&gt;LDOC2	TL5&lt;/P&gt;&lt;P&gt;LDOC3	TL6&lt;/P&gt;&lt;P&gt;LDOC3	TL7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for the 2nd requirement, i have to group the LDOC1 (2, 3)  and search for all TL* and report if they all exist, some exist or none exist within the 1st internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so for requirement 1, the answer would be yes (as i can do a read table using the TL*), however i am not sure how i can check "for all entries" for TL1, Tl2, TL3, TL7 and return that only some entries exist....  LDOC1 should return "some", LDOC2 should return "all" and LDOC3 should return "none".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully that makes sense???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone give me a keyword to investigate as i am not sure the At new would work....  Unless i do an at new and then loop and maybe add the record to a "range" to then compare and log the result as it runs through each result... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if Itab1 = itab2 then variable = yes. else None.&lt;/P&gt;&lt;P&gt;if variable = yes, and itab1 = itab2 then variable = yes.&lt;/P&gt;&lt;P&gt;if variable = yes and itab1 &amp;lt;&amp;gt; itab2 then variable = some.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would that work??  i am worried about performance too as there could be 1000's of records....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and can i have an "at end" so at end, if variable = yes, then variable = all?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written all the rest of the report to get all the data into these tables...  i am just a little baffled as to how i can validate and compare the multiple selection....  :o(&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 19:31:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215163#M1523135</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T19:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215164#M1523136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its hard to mention the logic here.&lt;/P&gt;&lt;P&gt;You can make use of range table for comparison.&lt;/P&gt;&lt;P&gt;Append all the values to the range table.&lt;/P&gt;&lt;P&gt;TL1&lt;/P&gt;&lt;P&gt;TL2&lt;/P&gt;&lt;P&gt;TL3&lt;/P&gt;&lt;P&gt;TL4&lt;/P&gt;&lt;P&gt;TL5&lt;/P&gt;&lt;P&gt;TL6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at second itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then a if condition with &lt;STRONG&gt;in&lt;/STRONG&gt; statement will do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wa-field in r_1. &lt;/P&gt;&lt;P&gt;exists.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope i understood your question properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 19:41:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215164#M1523136</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-08-26T19:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215165#M1523137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just trying to understand your question..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;LDOC3 should return "none".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LDOC3 TL6  has TL6 which is present in itab1 and it should return some.. right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 20:26:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215165#M1523137</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T20:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215166#M1523138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that was a typo!   and for some reason i cannot edit the post....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if TL6 is not in internal table 1...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i have to return the three answers based upon all the entries in both tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 20:29:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215166#M1523138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T20:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215167#M1523139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot edit a post once it has been replied to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I can.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can tell me the exact wording that is in the post and what you want it changed to, I will take care of that and then get rid of the posts referring to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 20:44:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215167#M1523139</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T20:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215168#M1523140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Rob.&lt;/P&gt;&lt;P&gt;in the first internal table1 i wanted the TL6 removed so there is just TL1 - TL5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think i have worked out the logic now, but will post the code once i have it working...  &lt;/P&gt;&lt;P&gt;it may need some optimisation afterwards, but i can't run before i can walk! &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 20:47:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215168#M1523140</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T20:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215169#M1523141</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;It is really confusing :-).. But i have tried to figure out.. may be this could be useful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal Table1 has the following records.&lt;/P&gt;&lt;P&gt;TL1&lt;/P&gt;&lt;P&gt;TL2&lt;/P&gt;&lt;P&gt;TL3&lt;/P&gt;&lt;P&gt;TL4&lt;/P&gt;&lt;P&gt;TL5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table 2 has the following records...&lt;/P&gt;&lt;P&gt;LDOC1 TL1&lt;/P&gt;&lt;P&gt;LDOC1 TL2&lt;/P&gt;&lt;P&gt;LDOC1 TL3&lt;/P&gt;&lt;P&gt;LDOC1 TL7&lt;/P&gt;&lt;P&gt;LDOC2 TL1&lt;/P&gt;&lt;P&gt;LDOC2 TL5&lt;/P&gt;&lt;P&gt;LDOC3 TL6&lt;/P&gt;&lt;P&gt;LDOC3 TL7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab3[] = itab2[]&lt;/P&gt;&lt;P&gt;sort itab3 by field1.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab3 comparing field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab3&lt;/P&gt;&lt;P&gt;LDCO1  &lt;/P&gt;&lt;P&gt;LDCO2&lt;/P&gt;&lt;P&gt;LDCO3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab3.&lt;/P&gt;&lt;P&gt;clear: lv_flag, index, ind.&lt;/P&gt;&lt;P&gt;loop at itab2 where field1 = itab3-field1.&lt;/P&gt;&lt;P&gt;index = index + 1.&lt;/P&gt;&lt;P&gt;read table itab1 with key field1 = itab2-field2.&lt;/P&gt;&lt;P&gt;if sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;lv_flag = 'X'.&lt;/P&gt;&lt;P&gt;ind = ind + 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if lv_flag = 'X'.&lt;/P&gt;&lt;P&gt; if ind = index.&lt;/P&gt;&lt;P&gt;  lv_val = 'NONE'.&lt;/P&gt;&lt;P&gt; elseif ind NE index.&lt;/P&gt;&lt;P&gt;  lv_val = 'SOME'. &lt;/P&gt;&lt;P&gt; endif. &lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  lv_val = 'ALL'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"here you can modify itab3 with lv_val in one field, so that you can figure out which is SOME, NONE, ALL&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 21:55:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215169#M1523141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T21:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215170#M1523142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code may be can help you&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: ZM_MEN(5) TYPE C,
        ZM_LD(5)  TYPE C.

  LOOP AT TI_ITAB2.
   IF ZM_LD IS INITIAL OR ZM_LD NE TI_ITAB2-LD.
    IF NOT ZM_MEN IS INITIAL.
     CLEAR: TI_ITAB3.
     TI_ITAB3-LD    = ZM_LD.
     TI_ITAB3-ZMEN  = ZM_MEN.
     APPEND TI_ITAB3.
     CLEAR: ZM_MEN.
    ENDIF.

    ZM_LD = TI_ITAB2-LD.
    ZM_MEN = 'ZERO'.
   ENDIF. " IF ZM_LD IS INITIAL OR ZM_LD NE TI_ITAB2-LD

   READ TABLE TI_ITAB1 WITH KEY TL = TI_ITAB2-TL.

   IF SY-SUBRC EQ 0.
    IF ZM_MEN EQ 'ZERO'.
     ZM_MEN = 'ALL'.
    ENDIF. " IF ZM_MEN EQ 'ZERO'
   ELSEIF SY-SUBRC EQ 4 AND ZM_MEN EQ 'ALL'.
    ZM_MEN = 'SOME'.
   ENDIF. " IF SY-SUBRC EQ 0
  ENDLOOP. " LOOP AT ITAB2
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 22:16:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215170#M1523142</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-26T22:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: compare multiple variable selections between two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215171#M1523143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Senthil.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my working code based upon your suggestion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  lt_objky1[] = lt_objky[].
  SORT lt_objky1 BY doknr.
  DELETE ADJACENT DUPLICATES FROM lt_objky1 COMPARING doknr.

  LOOP AT lt_objky1 INTO ls_objky1.
    CLEAR: lv_flag, index, ind.
    LOOP AT lt_objky INTO ls_objky WHERE doknr = ls_objky1-doknr.
      index = index + 1.
      READ TABLE lt_task_list WITH KEY objky = ls_objky-objky TRANSPORTING NO FIELDS.
      IF sy-subrc NE 0.
        lv_flag = 'X'.
        ind = ind + 1.
      ENDIF.
    ENDLOOP.

    IF lv_flag = 'X'.
      IF ind = index.
        lv_value = 'NONE'.
      ELSEIF ind NE index.
        lv_value = 'SOME'.
      ENDIF.
    ELSE.
      lv_value = 'ALL'.
    ENDIF.

    LOOP AT lt_objky INTO ls_objky WHERE doknr = ls_objky1-doknr.
      ls_objky-selection = lv_value.
      MODIFY lt_objky FROM ls_objky.
    ENDLOOP.

  ENDLOOP. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Aug 2010 11:18:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-multiple-variable-selections-between-two-internal-tables/m-p/7215171#M1523143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-27T11:18:50Z</dc:date>
    </item>
  </channel>
</rss>

