<?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 internal table with two keys on same field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565169#M1077379</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;neither of the syntax is supported by ABAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Sep 2008 08:43:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-22T08:43:22Z</dc:date>
    <item>
      <title>READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565167#M1077377</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'm trying to read an internal table to two values but apparently i can't use the keyword OR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what i tryed. Can anybody tell me what is the correct instruction to use ?&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Test 1
  READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 =  ( c_wait_exp OR c_expert ).

*Test 2
  READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 =  c_wait_exp.
   OR txt04 = c_expert.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both are incorrects.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:40:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565167#M1077377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565168#M1077378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;READ is supposed to return a single entry, so there is a logical problem with using OR conditions. That's why they are not allowed.&lt;/P&gt;&lt;P&gt;See if you can use LOOP AT ... WHERE ... instead.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:42:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565168#M1077378</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-09-22T08:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565169#M1077379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;neither of the syntax is supported by ABAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:43:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565169#M1077379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565170#M1077380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use "AND" or "OR" in READ TABLE.&lt;/P&gt;&lt;P&gt;You have to use "LOOP AT" to use the OR condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:44:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565170#M1077380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565171#M1077381</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;Use range , Firsttly declare oa variable of type range . Now pass both of your constants in ranhe as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data ; l type range .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pass both of your constants in range (For help see SAP Help)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now&lt;/P&gt;&lt;P&gt; READ TABLE lt_status INTO wa_status &lt;/P&gt;&lt;P&gt;    WITH KEY txt04 in l .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~hitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:47:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565171#M1077381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565172#M1077382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use READ statement twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like&lt;/P&gt;&lt;P&gt;READ TABLE lt_status INTO wa_status &lt;/P&gt;&lt;P&gt;    WITH KEY txt04 =  c_wait_exp.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE lt_status INTO wa_status &lt;/P&gt;&lt;P&gt;    WITH KEY txt04 =  c_expert.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;Give u r error message here.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF one of the statement is true , do u r processing after that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it solves u r problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chandra.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:47:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565172#M1077382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565173#M1077383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Helder,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both of the syntax are wrong. No OR operator is not supported in READ Statement.&lt;/P&gt;&lt;P&gt;Try using &lt;STRONG&gt;LOOP AT &amp;lt;itab&amp;gt; WHERE &amp;lt;condition&amp;gt;&lt;/STRONG&gt; where you can use OR condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:49:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565173#M1077383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565174#M1077384</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;&lt;/P&gt;&lt;P&gt;If fields are different don't use opertors...&lt;/P&gt;&lt;P&gt;do like this..,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; read table itab with key field1 = 'gfhg' field2 = 'fhbrsjf'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, for the same filed its not possible.!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen.I&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:49:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565174#M1077384</guid>
      <dc:creator>naveen_inuganti2</dc:creator>
      <dc:date>2008-09-22T08:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565175#M1077385</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;With READ table you can not use same field more than one time for comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get this functionality using LOOP ....Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:itab like standard table of sflight,&lt;/P&gt;&lt;P&gt;     wa like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab into wa where carrid = 'AA' or carrid = 'AB'.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:50:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565175#M1077385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565176#M1077386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Helder,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can not use expression with logical operators and other relational operators except '=' in READ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you need to query with the first value then if it fail then query with second value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 =  c_wait_exp.

  IF SY-SUBRC EQ 0.
     &amp;lt;&amp;lt;Required logic&amp;gt;&amp;gt;
  ELSE.
 
  READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 = c_expert.
   IF SY-SUBRC EQ 0.
     &amp;lt;&amp;lt;Required logic&amp;gt;&amp;gt;
   ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:51:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565176#M1077386</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: READ internal table with two keys on same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565177#M1077387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: flag1 type c length 1,
        flag2 type c length 1.

READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 =  c_wait_exp .
if sy-subrc = 0.
 flag1 = 'X'.
endif.
READ TABLE lt_status INTO wa_status 
    WITH KEY txt04 =  c_expert.
if sy-subrc = 0.
 flag2 = 'X'.
endif.

if flag1 = 'X' or flag2 = 'X'.
 " Write your code here
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 08:56:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-with-two-keys-on-same-field/m-p/4565177#M1077387</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T08:56:24Z</dc:date>
    </item>
  </channel>
</rss>

