<?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 the Read Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736423#M635594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you paste ur code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Sep 2007 05:52:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-11T05:52:50Z</dc:date>
    <item>
      <title>Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736417#M635588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have one issue while using the read table .Iam using Read table with binary search .but even though there is matching key Sy-subrc is returning 4.Since I used the binary search there is no need of using sort table before read.&lt;/P&gt;&lt;P&gt;Can some one help me to solve this issue .&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;P&gt;-Padma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:49:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736417#M635588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736418#M635589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;before binary search sorting should be done.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736418#M635589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736419#M635590</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 need to sort the table before using BINARY SEARCH in the read statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cud u pls give us the code....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is a sample:&lt;/P&gt;&lt;P&gt;sort i_final by BUKRS .&lt;/P&gt;&lt;P&gt;  LOOP AT i_final INTO w_final.&lt;/P&gt;&lt;P&gt;        READ TABLE i_output INTO w_output WITH KEY&lt;/P&gt;&lt;P&gt;                                  bukrs = w_final-bukrs&lt;/P&gt;&lt;P&gt;                                  BINARY SEARCH.&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;Anjali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:51:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736419#M635590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736420#M635591</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 must sort the table with key which u r using in Read statement before using Binary search.&lt;/P&gt;&lt;P&gt;&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;Balavardhan.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:51:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736420#M635591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736421#M635592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FETCHING NAME1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SELECT werks&lt;/P&gt;&lt;P&gt;           name1&lt;/P&gt;&lt;P&gt;           FROM t001w&lt;/P&gt;&lt;P&gt;           INTO TABLE t_name1&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN t_itab1&lt;/P&gt;&lt;P&gt;           WHERE werks = t_itab1-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SORT t_itab1 BY werks.&lt;/P&gt;&lt;P&gt;    SORT t_name1 BY werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      LOOP AT t_itab1 INTO wa_itab1.&lt;/P&gt;&lt;P&gt;        hold_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;       READ TABLE t_name1 INTO wa_name1 WITH KEY werks = wa_itab1-werks&lt;/P&gt;&lt;P&gt;                                                         BINARY SEARCH.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          wa_itab1-name1 = wa_name1-name1.&lt;/P&gt;&lt;P&gt;          MODIFY t_itab1 INDEX  hold_tabix FROM wa_itab1.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:51:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736421#M635592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736422#M635593</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;SORTING IS A PRE REQUISIT FOR BINARY SEARCH. BEFORE REAT TABLE ST SORT UR INTERNAL TABLE WITH A KEY FIELD AND TRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WITH REGARDS,&lt;/P&gt;&lt;P&gt;SURESH ALURI.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:52:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736422#M635593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736423#M635594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you paste ur code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 05:52:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736423#M635594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T05:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736424#M635595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all !!  &lt;/P&gt;&lt;P&gt;The problem has been resolved!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 06:01:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736424#M635595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T06:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with the Read Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736425#M635596</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;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Binary Search in Standard Tables&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;If you read entries from standard tables using a key other than the default key, you&lt;/P&gt;&lt;P&gt;can use a binary search instead of the normal linear search. To do this, include the addition BINARY SEARCH in the corresponding READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH KEY = &amp;lt;f&amp;gt; &amp;lt;result&amp;gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH KEY &amp;lt;k1&amp;gt; = &amp;lt;f1&amp;gt; ... &amp;lt;kn&amp;gt; = &amp;lt;fn&amp;gt; &amp;lt;result&amp;gt;&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The standard table must be sorted in ascending order by the specified search key. The BINARY SEARCH addition means that you can access an entry in a standard table by its key as quickly as you would be able to in a sorted table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COL1 TYPE I,&lt;/P&gt;&lt;P&gt;COL2 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE STANDARD TABLE OF LINE.&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;LINE-COL1 = SY-INDEX.&lt;/P&gt;&lt;P&gt;LINE-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;SORT ITAB BY COL2.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB WITH KEY COL2 = 16 INTO LINE BINARY SEARCH.&lt;/P&gt;&lt;P&gt;WRITE: 'SY-SUBRC =', SY-SUBRC.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0&lt;/P&gt;&lt;P&gt;The program fills a standard table with a list of square numbers and sorts them into&lt;/P&gt;&lt;P&gt;ascending order by field COL2. The READ statement uses a binary search to look&lt;/P&gt;&lt;P&gt;for and find the line in the table where COL2 has the value 16.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2007 06:04:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-the-read-statement/m-p/2736425#M635596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-11T06:04:45Z</dc:date>
    </item>
  </channel>
</rss>

