<?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 Range with internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308747#M160992</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi shah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Unfortunately we have to LOOP&lt;/P&gt;&lt;P&gt;  at every record,&lt;/P&gt;&lt;P&gt;  and check IN Range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  IF FIELD NOT IN MYRANGE.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt; *---- CODE.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jun 2006 12:45:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-08T12:45:26Z</dc:date>
    <item>
      <title>Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308740#M160985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Friends, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to compare an internal table with range , that in this internal table same value as in range, and if any value does not match-&amp;gt; has to do other functionality and if match other logic, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was just curios to know , is there any elegant way of doing so, or that traditional coding means loops over internal table and then inside the loop again loop for range ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you guys have an alternative suggestion, would be really appreiciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:14:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308740#M160985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308741#M160986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;YOu can do this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab where field1 in range1.&lt;/P&gt;&lt;P&gt;do what you want.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab where not field1 in range1.&lt;/P&gt;&lt;P&gt;do what you want.&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;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:17:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308741#M160986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308742#M160987</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;u can do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab where field1 in range&lt;/P&gt;&lt;P&gt;//code&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:20:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308742#M160987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308743#M160988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I misundersttod to select first, check this oneo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;    LOOP AT IT_T001 WHERE BUKRS IN S_BUKRS.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;      IF SY-SUBRC  = 0.&lt;/P&gt;&lt;P&gt;        IT_VBRK-BUTXT = IT_T001-BUTXT.&lt;/P&gt;&lt;P&gt;        MODIFY IT_VBRK INDEX CTAB.&lt;/P&gt;&lt;P&gt;        CLEAR CTAB.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S_BUKRS is the range&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;please reward points if found helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:20:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308743#M160988</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-06-08T12:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308744#M160989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HII SHAH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm not sure if your query is with select options or ranges in particular ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options are explictly for selection-screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we dont want to display anything on screen,&lt;/P&gt;&lt;P&gt;we can use RANGES having the same functionality ,same structure .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select options  are displayed on the selection screen . Ranges are not displayed on the sel. screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be Careful with range table. The size of statement might exceed the limit depending on the size of the range table!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data: Ranges ran_field1 for dbtable1-field1.

Select * from dbtab1 into table itab1.
ran_field1-sign = &amp;#145;I&amp;#146;. 
ran_field1-option = &amp;#145;EQ&amp;#146;.

Loop at itable1 where itable1-field1 in ran_field1 .
Move itable1-field1 To ran_field1-low.
Append ran_field1.
EndLoop.

Loop at itable1 where not itable1-field1 in ran_field1 .
Select * from dbtable2 where field2 in ran_field1.
... 
EndSelect.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful&lt;/P&gt;&lt;P&gt;Revert back for more help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:20:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308744#M160989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308745#M160990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understood your requirement correctly, then at least one loop is must.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_itab into lw_itab.&lt;/P&gt;&lt;P&gt;  if lw_itab-rangefield IN Range1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Do something here  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Do else part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:26:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308745#M160990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308746#M160991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB WHERE FIELD IN S_FIELD.

"Here you can do what ever you want..


ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:29:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308746#M160991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308747#M160992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi shah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Unfortunately we have to LOOP&lt;/P&gt;&lt;P&gt;  at every record,&lt;/P&gt;&lt;P&gt;  and check IN Range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  IF FIELD NOT IN MYRANGE.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt; *---- CODE.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 12:45:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308747#M160992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T12:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308748#M160993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;okey, friends many thanks for your kind inputs, actually I did now like following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; delete lt_kna1 where not land1 in s_land. " RANGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Loop at lt_kna1 into ls_kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Loop at lt_vbpa into ls_vbpa where kunnr eq ls_kna1-kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ls_c_vbpa-vbeln = ls_vbpa-vbeln.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      append ls_c_vbpa to lt_c_vbpa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Endloop.&lt;/P&gt;&lt;P&gt;   Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So actually I want to delete not same entries from internal table and range, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What about comapring the two internal tables, as the example i given above, is there any more efficient way of doing the same ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 14:00:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308748#M160993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T14:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308749#M160994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii shah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;b&amp;gt;delete lt_kna1 where not land1 in s_land. " RANGE

 Prepare for Binary Search
sort IT_KNA1 by KUNNR.

loop at IT_KNA1 .

read table IT_VBAP with key kunnr = IT_KNA1-KUNNR binary search.

if IT_VBAP-KUNNR &amp;lt;&amp;gt; IT_KNA1-KUNNR.

DELETE IT_KNA1 .

endif.

Endloop.&amp;lt;/b&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD POINTS IF HELPFUL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 14:19:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308749#M160994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T14:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Range with internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308750#M160995</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;Try this this works much faster,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete lt_kna1 where not land1 in s_land. " RANGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;sort lt_vbpa  by kunnr&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_kna1 into ls_kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  read table lt_vbpa  with key kunnr eq ls_kna1-kunnr binary serach.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    Loop at lt_vbpa into ls_vbpa from sy-tabix&lt;/P&gt;&lt;P&gt;      if ls_vbpa-kunnr &amp;lt;&amp;gt; ls_kna1-kunnr.&lt;/P&gt;&lt;P&gt;        exit.&lt;/P&gt;&lt;P&gt;      endif. &lt;/P&gt;&lt;P&gt;      ls_c_vbpa-vbeln = ls_vbpa-vbeln.&lt;/P&gt;&lt;P&gt;      append ls_c_vbpa to lt_c_vbpa.&lt;/P&gt;&lt;P&gt;    Endloop.&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;Sreedhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2006 14:22:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-range-with-internal-table/m-p/1308750#M160995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-08T14:22:28Z</dc:date>
    </item>
  </channel>
</rss>

