<?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/6176420#M1372580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Rudra&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i suppose i didnt made myself clear as if inside the loop in th etable i just want to chck if the entry exist then code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for if condition say if sy-subrc = 0&lt;/P&gt;&lt;P&gt;                               flag = checked&lt;/P&gt;&lt;P&gt;                             else.&lt;/P&gt;&lt;P&gt;                           exit.&lt;/P&gt;&lt;P&gt;                   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so my qustion was how to chck for sysubrc inside a loop &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;now i want to check if the entry exits then raise error message and exit...&lt;/P&gt;&lt;P&gt;what is the posible way to check for sy-subrc...inside loop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Oct 2009 12:10:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-10-07T12:10:37Z</dc:date>
    <item>
      <title>read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176418#M1372578</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;I have a requirement&lt;/P&gt;&lt;P&gt;i am looping to a internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT lt_itab into wa_itab&lt;/P&gt;&lt;P&gt;                         where field1  EQ 'kna1'&lt;/P&gt;&lt;P&gt;                         And   field2 EQ 'zcc1;&lt;/P&gt;&lt;P&gt;Endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i want to check if the entry exits then raise error message and exit...&lt;/P&gt;&lt;P&gt;what is the posible way to check for sy-subrc...inside loop &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here the table name and field name are not primary key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;arora&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 11:59:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176418#M1372578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-07T11:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176419#M1372579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP AT lt_itab into wa_itab&lt;/P&gt;&lt;P&gt;where field1 EQ 'kna1'&lt;/P&gt;&lt;P&gt;And field2 EQ 'zcc1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;raise error message&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endloop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 12:08:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176419#M1372579</guid>
      <dc:creator>former_member195383</dc:creator>
      <dc:date>2009-10-07T12:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176420#M1372580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Rudra&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i suppose i didnt made myself clear as if inside the loop in th etable i just want to chck if the entry exist then code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for if condition say if sy-subrc = 0&lt;/P&gt;&lt;P&gt;                               flag = checked&lt;/P&gt;&lt;P&gt;                             else.&lt;/P&gt;&lt;P&gt;                           exit.&lt;/P&gt;&lt;P&gt;                   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so my qustion was how to chck for sysubrc inside a loop &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;now i want to check if the entry exits then raise error message and exit...&lt;/P&gt;&lt;P&gt;what is the posible way to check for sy-subrc...inside loop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 12:10:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176420#M1372580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-07T12:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176421#M1372581</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 hope your requirement is to show error message if there is no entry in the table, based on the conditions,&lt;/P&gt;&lt;P&gt;that you have given in the loop statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no entry in the table, the control will not go into the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So write the following logic, which may help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare a flag say, wf_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wf_flag = 'X' .&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wf_flag NE 'X' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it solves your p[roblem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 12:30:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176421#M1372581</guid>
      <dc:creator>former_member195383</dc:creator>
      <dc:date>2009-10-07T12:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176422#M1372582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rudra&lt;/P&gt;&lt;P&gt;here is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if not it_itab is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT lt_itab into wa_itabe&lt;/P&gt;&lt;P&gt;                         where field1 EQ 'kna1'&lt;/P&gt;&lt;P&gt;                         And   field2 EQ 'zc3'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        Iflag= 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF I_pricomp_flag is initial.&lt;/P&gt;&lt;P&gt;        Exit.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&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;now there is below code existing for the same now if i dont want that to execute so exit will come to the end of subroutine ? right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 13:03:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176422#M1372582</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-07T13:03: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/6176423#M1372583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just want to exit your subroutine if an entry is available in ITAB, you can use this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT itab INTO wa.
* SET a flag of some sort for returning to calling PERFORM.
  ex_flag = 'X'.
  RETURN.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope I understood your requirement. If so, this would be the easiest solution to your problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 13:09:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176423#M1372583</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-10-07T13:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176424#M1372584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this will do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:val1 type lt_itab-field1, "refer the field type here
     val2 type lt_itab-field2.

val1 = 'kna1'.
val2 = 'zcc1'.
LOOP AT lt_itab into wa_itab where field1 EQ  And field2 EQ .
exit.
Endloop.
if sy-subrc = 0.
message 'Entry Exists' type 'E'.
endif.

or 

read table lt_itab with key field1 = val1 field2 = val2
transporting no fields.
if sy-subrc = 0.
error.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 13:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-statement/m-p/6176424#M1372584</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-10-07T13:18:35Z</dc:date>
    </item>
  </channel>
</rss>

