<?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: Read Statement with key in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658609#M881285</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;sort itab by werks.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = wgc_werk by BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = wgc_werks1 by BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;...for value in wgc_werks1&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;.....for value in wgc_werks&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Apr 2008 10:32:42 GMT</pubDate>
    <dc:creator>jayanthi_jayaraman</dc:creator>
    <dc:date>2008-04-15T10:32:42Z</dc:date>
    <item>
      <title>Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658603#M881279</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;How can I modify this Read statement as Read with same&lt;/P&gt;&lt;P&gt;keys is not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab OCCURS 0,&lt;/P&gt;&lt;P&gt;      matnr LIKE marc-matnr,&lt;/P&gt;&lt;P&gt;      werks LIKE marc-werks,&lt;/P&gt;&lt;P&gt;      steuc LIKE marc-steuc,&lt;/P&gt;&lt;P&gt;       END OF itab.&lt;/P&gt;&lt;P&gt; wgc_werk = 'BR10',&lt;/P&gt;&lt;P&gt;wgc_werk1 ='BR20'.&lt;/P&gt;&lt;P&gt;    READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;                                     werks = wgc_werk&lt;/P&gt;&lt;P&gt;                                     werks = wgc_werks1&lt;/P&gt;&lt;P&gt;                                     BINARY SEARCH.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:00:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658603#M881279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T10:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658604#M881280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: BEGIN OF itab OCCURS 0,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
werks1 like marc-werks,
steuc LIKE marc-steuc,
END OF itab.
wgc_werk = 'BR10',
wgc_werk1 ='BR20'.
READ TABLE itab WITH KEY matnr = it_mvke-matnr
werks = wgc_werk
werks1 = wgc_werks1
BINARY SEARCH.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:03:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658604#M881280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T10:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658605#M881281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi KPN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should I move werks value to werks1. likethis below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;move itab-werks to itab-werks1.&lt;/P&gt;&lt;P&gt;read statement.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; How does the Read statement the different werks vaues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658605#M881281</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T10:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658606#M881282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In these cases I prefer the LOOP statement and declaring the internal table like this:&lt;/P&gt;&lt;P&gt;itab type sorted table of .... with non-unique key MATNR WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa WHERE matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;                                   and werks = ...  or werks = ....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:08:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658606#M881282</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-15T10:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658607#M881283</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 trying to use read statement inorder to fetch a single record isn't it? if you are trying to search for a record having either &lt;/P&gt;&lt;P&gt;WERKS = 'BR10' or WERKS = 'BR20' then you need to modify your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
steuc LIKE marc-steuc,
END OF itab.
wgc_werk = 'BR10'.
wgc_werk1 ='BR20'.
READ TABLE itab WITH KEY matnr = it_mvke-matnr
werks = wgc_werk.
if sy-subrc ne 0.
   READ TABLE itab WITH KEY matnr = it_mvke-matnr
                                               werks = wgc_werk1.
   if sy-subrc eq 0.
      "your post reading process here
   endif.
endif.
BINARY SEARCH.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward points if this helps,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Kiran&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:14:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658607#M881283</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T10:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658608#M881284</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 need to read two times as shown below.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = &lt;STRONG&gt;wgc_werk&lt;/STRONG&gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = &lt;STRONG&gt;wgc_werk1&lt;/STRONG&gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab where matnr = it_mvke-matnr &lt;STRONG&gt;and&lt;/STRONG&gt; ( werks = wgc_werk &lt;STRONG&gt;or&lt;/STRONG&gt; werks = wgc_werk1 ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do what ever you want&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:17:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658608#M881284</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T10:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read Statement with key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658609#M881285</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;sort itab by werks.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = wgc_werk by BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY matnr = it_mvke-matnr&lt;/P&gt;&lt;P&gt;werks = wgc_werks1 by BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;...for value in wgc_werks1&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;.....for value in wgc_werks&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 10:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement-with-key/m-p/3658609#M881285</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2008-04-15T10:32:42Z</dc:date>
    </item>
  </channel>
</rss>

