<?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 table statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225063#M478070</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can do the coding as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: spfli_tab TYPE SORTED TABLE OF spfli.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;       FROM spfli &lt;/P&gt;&lt;P&gt;       INTO TABLE spfli_tab &lt;/P&gt;&lt;P&gt;       WHERE carrid = 'LH'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE spfli_tab &lt;/P&gt;&lt;P&gt;           WITH TABLE KEY carrid = 'LH' connid = '2402'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly I feel we can write your Read Stmt like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table t_mara with table key matnr = t_mara1-matnr&lt;/P&gt;&lt;P&gt;                                                 spart = 'aa'&lt;/P&gt;&lt;P&gt;                                                 spart = 'bb'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 May 2007 18:17:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-01T18:17:50Z</dc:date>
    <item>
      <title>Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225056#M478063</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;&lt;/P&gt;&lt;P&gt;is there any way to use read table like this?&lt;/P&gt;&lt;P&gt;read table t_mara with key matnr = t_mara1-matnr&lt;/P&gt;&lt;P&gt;                                       spart in (  'aa' ,'bb').&lt;/P&gt;&lt;P&gt;i need to compare with these two values . if one of the value satisfies sy-subrc should be equal to '0'. just like select statement with OR condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:01:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225056#M478063</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T17:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225057#M478064</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 cannot use READ TABLE for multiple values..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead you can use LOOP AT ..EXIT..ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT T_MARA WHERE MATNR = 'TEST'&lt;/P&gt;&lt;P&gt;               AND   ( SPART = 'AA' OR SPART = 'BB' ).&lt;/P&gt;&lt;P&gt;  EXIT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;  write: / 'Found'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;    write: / 'NOT Found'.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&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;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:04:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225057#M478064</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T17:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225058#M478065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you can use a read statement that way, and looping at a database table is obsolete.  But you can use a select statement.  This should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT * FROM t_mara INTO w_mara&lt;/P&gt;&lt;P&gt;   WHERE ( spara = 'aa' OR spara = 'bb' )&lt;/P&gt;&lt;P&gt;   AND matnr = t_mara1-matnr.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;put your processing code here&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt; ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt; - April King&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:44:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225058#M478065</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T17:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225059#M478066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It has to be a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT itab WHERE matnr = t_mara1-matnr
                OR spart = 'AA' 
                OR spart = 'BB'.
ENDLOOP&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:48:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225059#M478066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T17:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225060#M478067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think he meant..&lt;/P&gt;&lt;P&gt;LOOP AT itab WHERE matnr = t_mara1-matnr&lt;/P&gt;&lt;P&gt;                and ( spart = 'AA'  or spart = 'BB' ).&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use two READs &amp;amp; check if either of the subrc is 0 with aflag.. I think, the loop is better..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225060#M478067</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-05-01T17:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225061#M478068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct, I was thinking of the database table MARA, not realizing he meant an itab with name T_MARA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 17:59:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225061#M478068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T17:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225062#M478069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even though I thought that it is an AND instead of an OR, her statement 'even if one of them is satisfied' made me tilt towards OR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you may be right using AND.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 18:05:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225062#M478069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T18:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225063#M478070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can do the coding as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: spfli_tab TYPE SORTED TABLE OF spfli.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;       FROM spfli &lt;/P&gt;&lt;P&gt;       INTO TABLE spfli_tab &lt;/P&gt;&lt;P&gt;       WHERE carrid = 'LH'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE spfli_tab &lt;/P&gt;&lt;P&gt;           WITH TABLE KEY carrid = 'LH' connid = '2402'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly I feel we can write your Read Stmt like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table t_mara with table key matnr = t_mara1-matnr&lt;/P&gt;&lt;P&gt;                                                 spart = 'aa'&lt;/P&gt;&lt;P&gt;                                                 spart = 'bb'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 18:17:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225063#M478070</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T18:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Read table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225064#M478071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry !&lt;/P&gt;&lt;P&gt;Read table t_mara with table key matnr = t_mara1-matnr&lt;/P&gt;&lt;P&gt;spart = 'aa' or &lt;/P&gt;&lt;P&gt;spart = 'bb'.  Will give an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We cannot use  spart twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2007 19:35:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-statement/m-p/2225064#M478071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-01T19:35:22Z</dc:date>
    </item>
  </channel>
</rss>

