<?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: About Read stmt in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561456#M584174</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;You are read statement to find out whether the record satisfying this condition is in internal table.The binary search is used to make the efficiency in reading.&lt;/P&gt;&lt;P&gt;But before using binary search, as sugggested you should sort the table by using the fields you are giving as condition in read statement.&lt;/P&gt;&lt;P&gt;You need to clear the workarea before the read statement, then only the work area will have the correct valueas after read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_hrp1000 by plvar otype endda.&lt;/P&gt;&lt;P&gt;LOOP AT it_hrp1000.&lt;/P&gt;&lt;P&gt;clear it_hrp1000.&lt;/P&gt;&lt;P&gt;READ TABLE it_hrp1000 WITH KEY plvar = p_plvar&lt;/P&gt;&lt;P&gt;and otype = p_otype&lt;/P&gt;&lt;P&gt;and endda = p_endda2&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jul 2007 01:58:22 GMT</pubDate>
    <dc:creator>jayanthi_jayaraman</dc:creator>
    <dc:date>2007-07-13T01:58:22Z</dc:date>
    <item>
      <title>About Read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561454#M584172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;can anyone .. Explain this below READ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT it_hrp1000.&lt;/P&gt;&lt;P&gt;    READ TABLE it_hrp1000 WITH KEY plvar = p_plvar&lt;/P&gt;&lt;P&gt;                               and otype = p_otype&lt;/P&gt;&lt;P&gt;                               and endda = p_endda2&lt;/P&gt;&lt;P&gt;                               BINARY SEARCH.&lt;/P&gt;&lt;P&gt;MY QUESTION IS,&lt;/P&gt;&lt;P&gt;WHY WE ARE USING THE ABOVE READ STMT WITH CONDITIONS IN PRG.. I MEAN WHICH WHICH SCENARIO..(SITUATION).&lt;/P&gt;&lt;P&gt;PLS.EXPLAIN ANY ONE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 00:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561454#M584172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T00:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: About Read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561455#M584173</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;Read statement is usually used find exact match in an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please change the query as it is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

sort it_hrp1000 by plvar otype endda.
READ TABLE it_hrp1000 WITH KEY plvar = p_plvar
                               otype = p_otype
                               endda = p_endda2
                               BINARY SEARCH.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please make a sort before using read with binary search otherwise your read statement will not give proper result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 01:07:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561455#M584173</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-07-13T01:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: About Read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561456#M584174</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;You are read statement to find out whether the record satisfying this condition is in internal table.The binary search is used to make the efficiency in reading.&lt;/P&gt;&lt;P&gt;But before using binary search, as sugggested you should sort the table by using the fields you are giving as condition in read statement.&lt;/P&gt;&lt;P&gt;You need to clear the workarea before the read statement, then only the work area will have the correct valueas after read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_hrp1000 by plvar otype endda.&lt;/P&gt;&lt;P&gt;LOOP AT it_hrp1000.&lt;/P&gt;&lt;P&gt;clear it_hrp1000.&lt;/P&gt;&lt;P&gt;READ TABLE it_hrp1000 WITH KEY plvar = p_plvar&lt;/P&gt;&lt;P&gt;and otype = p_otype&lt;/P&gt;&lt;P&gt;and endda = p_endda2&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 01:58:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561456#M584174</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2007-07-13T01:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: About Read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561457#M584175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;READ statement always returns a single value based on the Key validations given.&lt;/P&gt;&lt;P&gt;in your case you are looping on an internal table and trying to read the same internal table with some parameter values p_plvar p_otype p_endda2, which does not make any sense. Even if the it_hrp1000 contains 200 records. every time in the loop you are trying to match the values p_plvar..... in the same internal table.&lt;/P&gt;&lt;P&gt;so loop is not really necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just use READ statement.&lt;/P&gt;&lt;P&gt;or Use the loop at using where conditions.&lt;/P&gt;&lt;P&gt;loop at it_hrp1000 where plvar = p_plvar and otype = p_otype and endda = p_endda2.&lt;/P&gt;&lt;P&gt;&amp;lt;do your requirement here&amp;gt;&lt;/P&gt;&lt;P&gt;clear it_hrp1000.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart from this as what other suggested of using binary search, clear work area etc should be followed and make then a general practice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 02:13:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561457#M584175</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-13T02:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: About Read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561458#M584176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Read statement is basically used to capture one particular record instead of looping over the whole table. With the read statment you can just get one particular row of the table , put it in a work area and process it as per your requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please go through the following links to understand the fucntionality of read statement and how can we read lines of tables;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="457138"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward the helpful entries.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raman.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 03:14:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-read-stmt/m-p/2561458#M584176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T03:14:34Z</dc:date>
    </item>
  </channel>
</rss>

