<?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: Problem with Internal table looping (range table condition in where clause) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529117#M1263293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the range is also same as  internal table .&lt;/P&gt;&lt;P&gt;First apply the loop on the selection option parameter then u apply the condition on the internal table for which you want to check the condition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will surely do debug and check .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at s_option .

 "loop at the internal table where you want to check condition using where clause .

endloop .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Apr 2009 04:21:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-15T04:21:14Z</dc:date>
    <item>
      <title>Problem with Internal table looping (range table condition in where clause)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529114#M1263290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am facing problem in looping using range table in where condition part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT gt_wv_trans INTO gwa_wv_trans WHERE hkont = r_scelem-low AND&lt;/P&gt;&lt;P&gt;                                                                                kostl = r_skostl-low.&lt;/P&gt;&lt;P&gt;                      :&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;Here the range table is taking the last value only and not from the first. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie., gt_wv_trans has values -&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;hkont       kostl       sgtxt&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;701000      9999       panasonic ltd.&lt;/P&gt;&lt;P&gt;702000      101         xxxxx&lt;/P&gt;&lt;P&gt;803000      9999       yyyyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r_scelem value-&amp;gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;hkont&lt;/U&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 701000&lt;/P&gt;&lt;P&gt; 702000  &lt;/P&gt;&lt;P&gt; 803000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r_skostl value -&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;U&gt;kostl-low&lt;/U&gt;        &lt;U&gt;kostl-high&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   9999&lt;/P&gt;&lt;P&gt;   101                305&lt;/P&gt;&lt;P&gt;   9999&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the looping is done only for the last value ie., 803000 and 9999&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1). how to make the looping to do from the first value (ie., 701000 and 9999)&lt;/P&gt;&lt;P&gt;2). how to loop and check the conditions for the range table low and high value ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2009 03:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529114#M1263290</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-15T03:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Internal table looping (range table condition in where clause)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529115#M1263291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;if u hv two options like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.  LOOP AT gt_wv_trans INTO gwa_wv_trans WHERE hkont GE r_scelem-low AND&lt;/P&gt;&lt;P&gt;             kostl LE r_skostl-low.&lt;/P&gt;&lt;P&gt;             :&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;2. select * from &amp;lt;table&amp;gt; into table gt_wv_trans where WHERE hkont GE r_scelem-low AND&lt;/P&gt;&lt;P&gt;             kostl LE r_skostl-low.&lt;/P&gt;&lt;P&gt;    - sort the internal table &lt;/P&gt;&lt;P&gt;    - start the looping as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shashi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2009 04:06:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529115#M1263291</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-15T04:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Internal table looping (range table condition in where clause)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529116#M1263292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sakthi,&lt;/P&gt;&lt;P&gt;Check the below sample code to understand the logic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:BEGIN OF it_tab OCCURS 0,
     f1 TYPE i,
     f2 TYPE i,
     END OF it_tab.

RANGES: r_f1 FOR it_tab-f1.

"Jus data filling
it_tab-f1 = 1000.
it_tab-f2 = 2000.
APPEND it_tab.

it_tab-f1 = 1001.
it_tab-f2 = 2001.
APPEND it_tab.

it_tab-f1 = 1002.
it_tab-f2 = 2002.
APPEND it_tab.

r_f1-sign = 'I'.
r_f1-option = 'EQ'.
r_f1-low = 1000.
APPEND r_f1.

r_f1-sign = 'I'.
r_f1-option = 'EQ'.
r_f1-low = 1001.
APPEND r_f1.

"Here is the logic
LOOP AT it_tab WHERE f1 IN r_f1. 
  WRITE:/ it_tab-f1, it_tab-f2.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Manoj Kumar on Apr 15, 2009 6:17 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2009 04:17:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529116#M1263292</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-15T04:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Internal table looping (range table condition in where clause)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529117#M1263293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the range is also same as  internal table .&lt;/P&gt;&lt;P&gt;First apply the loop on the selection option parameter then u apply the condition on the internal table for which you want to check the condition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will surely do debug and check .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at s_option .

 "loop at the internal table where you want to check condition using where clause .

endloop .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2009 04:21:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529117#M1263293</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-15T04:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Internal table looping (range table condition in where clause)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529118#M1263294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;r_scelem and  r_skostl. are internal table with header line so when you specify only r_scelem-low AND&lt;/P&gt;&lt;P&gt;kostl = r_skostl-low value it will take the value in the header.&lt;/P&gt;&lt;P&gt;Just try these codes this will solve the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_wv_trans INTO gwa_wv_trans.
IFgwa_wv_trans-hkont IN r_scelem AND
gwa_wv_trans-kostl IN r_skostl.
:
:
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gurpreet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2009 04:57:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-internal-table-looping-range-table-condition-in-where-clause/m-p/5529118#M1263294</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-15T04:57:28Z</dc:date>
    </item>
  </channel>
</rss>

