<?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 read stmt in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096258#M734547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't bother about the KOKRS = 2000 or 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB.
READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL.  " &amp;lt;&amp;lt; if you have any entry it will set SY-SUBRC = 0
IF SY-SUBRC &amp;lt;&amp;gt; 0.
I_KOSTL-KOSTL = ITAB-KOSTL.
I_KOSTL-KOKRS = I_CSKS-KOKRS.
APPEND I_KOSTL.
ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope you got it &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Nov 2007 03:53:42 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2007-11-28T03:53:42Z</dc:date>
    <item>
      <title>problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096251#M734540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My requirement is that i have an itab, which has KOSTL along with other things. &lt;/P&gt;&lt;P&gt;i need to make sure that each and every KOSTL in this itab, has a master data in CSKS, if not found, &lt;/P&gt;&lt;P&gt;then all those KOSTLs should be listed, &lt;/P&gt;&lt;P&gt;so i thought of doing this way: with for all entries on itab ,grab all the data from CSKS pertaining to this itab &lt;/P&gt;&lt;P&gt;and keep them in new i_csks internal table,  and then loop through over itab, looking for the match.&lt;/P&gt;&lt;P&gt;i coded the following way, here the condition is that, the KOKRS field in the CSKS should be one of 2000 or 3000. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT KOSTL KOKRS&lt;/P&gt;&lt;P&gt;  INTO TABLE I_CSKS&lt;/P&gt;&lt;P&gt;  FROM CSKS&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN ITAB&lt;/P&gt;&lt;P&gt;  WHERE KOSTL = ITAB-KOSTL AND ( KOKRS = 2000 OR KOKRS = 3000 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB.&lt;/P&gt;&lt;P&gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL  kokrs = 3000 .&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      I_KOSTL-KOSTL = ITAB-KOSTL.&lt;/P&gt;&lt;P&gt;      I_KOSTL-KOKRS = I_CSKS-KOKRS.&lt;/P&gt;&lt;P&gt;      APPEND I_KOSTL.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am struck at the READ stmt how do i put both KOKRS = 2000 or KOKRS = 3000., bcos its not taking OR inbetween.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any clues.&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 01:44:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096251#M734540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T01:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096252#M734541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sanjana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You do not require to put KOKRS = 2000 or KOKRS = 3000 in the READ statement as you already put this condition in the SELECT statement so your internal table I_CSKS has data only for KOKRS = 2000 or 3000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 02:03:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096252#M734541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T02:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096253#M734542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in u r read statement  u have to specify the work area.  &lt;/P&gt;&lt;P&gt; change READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL into wa_csks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u r i_csks contain only 2 fields kostl and kokrs so specify key as table_line..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Venu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 02:06:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096253#M734542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T02:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096254#M734543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Several options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Internal table only contains KOSTL where KOKRS 2000 / 3000 based on SELECT statement, so you do not need to check this again when in the LOOP - just read with key KOSTL = ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Does ITAB have KOKRS? if so read with KOSTL = ITAB-KOSTL KORKS = ITAB-KOKRS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Do 2 reads:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT ITAB.
  READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL kokrs = 2000 .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL kokrs = 3000 .
  ENDIF.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    I_KOSTL-KOSTL = ITAB-KOSTL.
    I_KOSTL-KOKRS = I_CSKS-KOKRS.  "&amp;lt;&amp;lt;&amp;lt;&amp;lt; This will not work - I_CSKS entry not found so KOKRS value indeterminate !!! 
    APPEND I_KOSTL.
  ENDIF.
ENDLOOP.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Alternative (not sure if this is your requirement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT ITAB.
  READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL kokrs = 2000 .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    I_KOSTL-KOSTL = ITAB-KOSTL.
    I_KOSTL-KOKRS = '2000'.    "&amp;lt;&amp;lt; Not found in 2000
    APPEND I_KOSTL.
  ENDIF.
  READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL kokrs = 3000 .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    I_KOSTL-KOSTL = ITAB-KOSTL.
    I_KOSTL-KOKRS = '3000'.    "&amp;lt;&amp;lt; Not found in 3000
    APPEND I_KOSTL.
  ENDIF.
ENDLOOP.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 02:09:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096254#M734543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T02:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096255#M734544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use loop statement instead of Read statement....&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;or u can use two read statements....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 02:13:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096255#M734544</guid>
      <dc:creator>former_member426550</dc:creator>
      <dc:date>2007-11-28T02:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096256#M734545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I believe no  need to put KOKR in Read Stmt..&lt;/P&gt;&lt;P&gt;If you insist checking KOKR Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL kokrs = 3000 .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;CHECK I_CSKS-KOKR = 2000 or 3000 .&lt;/P&gt;&lt;P&gt;IF SY_SUBRC = 0 .&lt;/P&gt;&lt;P&gt;I_KOSTL-KOSTL = ITAB-KOSTL.&lt;/P&gt;&lt;P&gt;I_KOSTL-KOKRS = I_CSKS-KOKRS.&lt;/P&gt;&lt;P&gt;APPEND I_KOSTL.&lt;/P&gt;&lt;P&gt;ELSe.&lt;/P&gt;&lt;P&gt;CONTINUE .&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 02:23:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096256#M734545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T02:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096257#M734546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sanjana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try below code for your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT KOSTL&lt;/P&gt;&lt;P&gt;INTO TABLE I_CSKS&lt;/P&gt;&lt;P&gt;FROM CSKS&lt;/P&gt;&lt;P&gt;WHERE KOKRS = 2000&lt;/P&gt;&lt;P&gt;OR KOKRS = 3000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;READ TABLE I_CSKS&lt;/P&gt;&lt;P&gt;TRANSPORTING NO FIELDS&lt;/P&gt;&lt;P&gt;WITH KEY KOSTL = ITAB-KOSTL.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;I_KOSTL-KOSTL = ITAB-KOSTL.&lt;/P&gt;&lt;P&gt;I_KOSTL-KOKRS = ITAB-KOKRS.&lt;/P&gt;&lt;P&gt;APPEND I_KOSTL.&lt;/P&gt;&lt;P&gt;ENDIF.&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;Teddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 03:50:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096257#M734546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T03:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096258#M734547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't bother about the KOKRS = 2000 or 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB.
READ TABLE I_CSKS WITH KEY KOSTL = ITAB-KOSTL.  " &amp;lt;&amp;lt; if you have any entry it will set SY-SUBRC = 0
IF SY-SUBRC &amp;lt;&amp;gt; 0.
I_KOSTL-KOSTL = ITAB-KOSTL.
I_KOSTL-KOKRS = I_CSKS-KOKRS.
APPEND I_KOSTL.
ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope you got it &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 03:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-stmt/m-p/3096258#M734547</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-28T03:53:42Z</dc:date>
    </item>
  </channel>
</rss>

