<?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 Looping through an internal table  column to compare values in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table-column-to-compare-values/m-p/735751#M34848</link>
    <description>&lt;P&gt;hello,&lt;/P&gt;
  &lt;P&gt;I need assistance with my ABAP program to compare the range of values in a column and derived the required entry in my output data. I have used attached code to test the comparison.&lt;/P&gt;
  &lt;P&gt;My requirement is to loop through the amount in column J and compare the value with the amount coming from input table ( column D).&lt;/P&gt;
  &lt;P&gt;Case 1: the input amount in item 10 is 49 and my result should be line 6 where the amount is 40,100 since 49 is greater than 40&lt;/P&gt;
  &lt;P&gt;Case 2: the input amount in item 20 is 15. My result should be line 4 since value 15 is less than the next highest value which is 20,100&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/242428-abap-lookup.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/242427-abap-lookup-code.txt"&gt;bap-lookup-code.txt&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 06:56:18 GMT</pubDate>
    <dc:creator>bhat_vaidya2</dc:creator>
    <dc:date>2018-11-15T06:56:18Z</dc:date>
    <item>
      <title>Looping through an internal table  column to compare values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table-column-to-compare-values/m-p/735751#M34848</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
  &lt;P&gt;I need assistance with my ABAP program to compare the range of values in a column and derived the required entry in my output data. I have used attached code to test the comparison.&lt;/P&gt;
  &lt;P&gt;My requirement is to loop through the amount in column J and compare the value with the amount coming from input table ( column D).&lt;/P&gt;
  &lt;P&gt;Case 1: the input amount in item 10 is 49 and my result should be line 6 where the amount is 40,100 since 49 is greater than 40&lt;/P&gt;
  &lt;P&gt;Case 2: the input amount in item 20 is 15. My result should be line 4 since value 15 is less than the next highest value which is 20,100&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/242428-abap-lookup.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/242427-abap-lookup-code.txt"&gt;bap-lookup-code.txt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 06:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table-column-to-compare-values/m-p/735751#M34848</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2018-11-15T06:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table  column to compare values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table-column-to-compare-values/m-p/735752#M34849</link>
      <description>&lt;P&gt;You can change the logic to below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" amounts that are less than main table
if &amp;lt;result_fields&amp;gt;-amount &amp;gt;= wa_zlookup-amount. 
" Checking the best less amount record.
if &amp;lt;result_fields&amp;gt;-field2 &amp;lt; wa_zlookup-amount. " Highest values less than 
         &amp;lt;result_fields&amp;gt;-field1 = wa_zaxaptcnd-field1.
          &amp;lt;result_fields&amp;gt;-field2 = wa_zaxaptcnd-field2.
endif.

endif.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 07:08:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table-column-to-compare-values/m-p/735752#M34849</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2018-11-15T07:08:26Z</dc:date>
    </item>
  </channel>
</rss>

