<?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: how to exit a form in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091358#M1181812</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;if ur condition is true then&lt;/P&gt;&lt;P&gt;RETURN.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the keyword RETURN.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Feb 2009 11:09:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-01T11:09:21Z</dc:date>
    <item>
      <title>how to exit a form</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091357#M1181811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;is there a way to exit a form if some condition not happend ?&lt;/P&gt;&lt;P&gt;for example if a flag_var eq 0 i want the form to end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 11:05:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091357#M1181811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T11:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to exit a form</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091358#M1181812</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;if ur condition is true then&lt;/P&gt;&lt;P&gt;RETURN.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the keyword RETURN.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 11:09:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091358#M1181812</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T11:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to exit a form</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091359#M1181813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b2535c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b2535c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;ABAP Programming-&amp;gt;Running ABAP Programs-&amp;gt;Subroutines-&amp;gt;Terminating Subroutines&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF &amp;lt;condition&amp;gt;.
  EXIT.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or as Tahir said.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF &amp;lt;condition&amp;gt;.
  RETURN.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Valter Oliveira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 11:57:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091359#M1181813</guid>
      <dc:creator>valter_oliveira</dc:creator>
      <dc:date>2009-02-01T11:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to exit a form</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091360#M1181814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer SAP help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b2535c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b2535c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USE CHECK or EXIT statement to terminate a FORM ... ENDFORM...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Understand that CHECK or EXIT just terminate the immediate control block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do EXIT in a loop like LOOP.. ENDLOOP, DO.. ENDDO etc, only the loop will be terminated and control continues with the statement after ENDLOOP or ENDDO statement. CHECK on the other hand just skips that particular iteration of the loop and the loop continues with the next iteration, if any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CHECK &amp;lt;boolean expression&amp;gt;.

OR

IF &amp;lt;boolean expression&amp;gt;.
   EXIT.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 12:03:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091360#M1181814</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T12:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to exit a form</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091361#M1181815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ami bardogo &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test the following Sample code hope will solve out your problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF t_test,
  sr_no TYPE i,
  name(35),
  flag(1),
END OF t_test.


DATA: it_test TYPE STANDARD TABLE OF t_test WITH HEADER LINE.

DO 5 TIMES.
  it_test-sr_no = sy-index.
  it_test-name = 'SDN'.
  APPEND it_test TO it_test.
ENDDO.
CLEAR: it_test.
it_test-flag = 'X'.

MODIFY it_test FROM it_test INDEX 4. " Set Flag on line number 4 of itab

PERFORM test.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  test
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM test.
  LOOP AT it_test INTO it_test. " It will display three lines because before printing the 4th line it will exit from form
    IF it_test-flag = 'X'.
      RETURN. " you can use both Return and Exit Both are working here.
*      EXIT.
    ENDIF.
    WRITE : / it_test-sr_no , it_test-name.

  ENDLOOP.

ENDFORM.                    "test&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reply if any Issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 12:23:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-exit-a-form/m-p/5091361#M1181815</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-02-01T12:23:08Z</dc:date>
    </item>
  </channel>
</rss>

