<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243329#M774128</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The internal table does not have a structure. So direct comparision of fields will result in an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read itab into wa with fields with key connid = 'lh'. will result in an error saying that the structue does not contain any element with project id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Jan 2008 15:04:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-04T15:04:12Z</dc:date>
    <item>
      <title>read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243324#M774123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider the scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type standard table of sflight-connid.&lt;/P&gt;&lt;P&gt;data: wa like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i retrieve single record from itab using &lt;STRONG&gt;read&lt;/STRONG&gt; statement using a logical expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read ,,,,,, logi_exprs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Here there is no header with name connid, so comparing connid = 'LH' &lt;/P&gt;&lt;P&gt;(field1= X) will result in an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: IMRAN PASHA on Jan 4, 2008 4:05 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest if it can be done without usage of index&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: IMRAN PASHA on Jan 4, 2008 4:36 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 14:42:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243324#M774123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T14:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243325#M774124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Imran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know the index of the record, XINDEX is your  records index&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &lt;STRONG&gt;ITAB&lt;/STRONG&gt; INDEX &lt;EM&gt;XINDEX&lt;/EM&gt; INTO WA_ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know the key then it would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &lt;STRONG&gt;ITAB&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;           WITH TABLE KEY FIELD1 = 'XX'  FIELD2 = 'YYYY' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Howe this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vinodh Balakrishnan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 14:48:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243325#M774124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T14:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243326#M774125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;READ TABLE itab INTO wa WITH KEY connid = wa_sflight-connid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;different types of read statements are :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;EMPTAB&amp;gt; options:&lt;/P&gt;&lt;P&gt;1 READ TABLE &amp;lt;EMPTAB&amp;gt;.&lt;/P&gt;&lt;P&gt;2 READ TABLE &amp;lt;EMPTAB&amp;gt; WITH KEY &amp;lt;k1&amp;gt; = &amp;lt;v1&amp;gt;&amp;#133;&lt;/P&gt;&lt;P&gt;&amp;lt;kn&amp;gt; = &amp;lt;vn&amp;gt;.&lt;/P&gt;&lt;P&gt;3 READ TABLE &amp;lt;EMPTAB&amp;gt; WITH TABLE KEY &amp;lt;k1&amp;gt; = &amp;lt;v1&amp;gt; ... &lt;/P&gt;&lt;P&gt;&amp;lt;kn&amp;gt; = &amp;lt;vn&amp;gt;.&lt;/P&gt;&lt;P&gt;4 READ TABLE &amp;lt;EMPTAB&amp;gt; WITH KEY = &amp;lt;value&amp;gt;.&lt;/P&gt;&lt;P&gt;5 READ TABLE &amp;lt;EMPTAB&amp;gt; WITH KEY . . . BINARY SEARCH.&lt;/P&gt;&lt;P&gt;6 READ TABLE &amp;lt;EMPTAB&amp;gt; INDEX .&lt;/P&gt;&lt;P&gt;7 READ TABLE &amp;lt;EMPTAB&amp;gt; COMPARING &amp;lt;f1&amp;gt; &amp;lt;f2&amp;gt; . . . .&lt;/P&gt;&lt;P&gt;8 READ TABLE &amp;lt;EMPTAB&amp;gt; COMPARING ALL FIELDS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 14:54:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243326#M774125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T14:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243327#M774126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB into WA&lt;/P&gt;&lt;P&gt;          WITH KEY field1 = valuex&lt;/P&gt;&lt;P&gt;                           field2 = valuey......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However here you can only specify an equal as condition. If you want to use other logical expressions you need to do &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO WA WHERE field1 log_expressionx AND/OR&lt;/P&gt;&lt;P&gt;                                                   field2 log_expressiony .......&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;Hope that helps,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 14:56:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243327#M774126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T14:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243328#M774127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Here is simple &amp;amp; short way to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa WHERE &amp;lt;logi_exprs&amp;gt;.&lt;/P&gt;&lt;P&gt;  EXIT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Record matching condition was found&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Record matching condition was NOT found&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this manner you will get first record from itab that maches &amp;lt;logi_exprs&amp;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;Reinis Dzenis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 15:01:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243328#M774127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T15:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243329#M774128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The internal table does not have a structure. So direct comparision of fields will result in an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read itab into wa with fields with key connid = 'lh'. will result in an error saying that the structue does not contain any element with project id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 15:04:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243329#M774128</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T15:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243330#M774129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Imran, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   You can try like below, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT YSAT_TEST6 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type standard table of sflight-connid.&lt;/P&gt;&lt;P&gt;data: wa like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa = '1234'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab index 1 into wa.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   write: /10 wa.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Satya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 15:16:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243330#M774129</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T15:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243331#M774130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Imran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know what your requirements are but here is what you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itab type standard table of sflight-connid.
data: wa1 like line of itab,
       *wa2 like line of itab.*

select connid from sflight
  into TABLE itab.

* set the logical expression, can be done in a loop
wa1 = '0017'.

* read the table using a work area instead of a key assignment
READ TABLE itab into wa2
  from wa1.
* with key connid = '0017'. 

if sy-subrc eq 0.
  write :/ wa2.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally, an internal table is read using a &lt;STRONG&gt;key&lt;/STRONG&gt; or an &lt;STRONG&gt;index&lt;/STRONG&gt;. But in this case, key is not available as there is no structure and no component, we still can make use of FROM WA addition of the READ TABLE statement, see above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using index to read the table was definitely not part of the requirement in the initial post sent by you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sanjeev&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 16:17:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243331#M774130</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T16:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243332#M774131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; The internal table does not have a structure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is the case, then what logical expression do you expect to have? Logical expression requires two operands(fields or values) and an operator. If you don't know the operands how do you expect to have a logical expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 16:23:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243332#M774131</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T16:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243333#M774132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to define your itab like this to have a structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_itab,&lt;/P&gt;&lt;P&gt;         connid TYPE s_conn_id.&lt;/P&gt;&lt;P&gt;TYPES: END OF ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: itab TYPE STANDARD TABLE OF ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa LIKE LINE OF itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab INTO wa WITH KEY connid = 'LH'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 16:28:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/3243333#M774132</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T16:28:26Z</dc:date>
    </item>
  </channel>
</rss>

