<?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: exit loop if condition is true in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012637#M410941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      IF p0001_begda-bukrs NE p0001_endda-bukrs.
              EXIT.
      ELSE.
              MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this -;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      IF p0001_begda-bukrs NE p0001_endda-bukrs.
              CONTINUE.
      ELSE.
              MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Mar 2007 18:02:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-12T18:02:59Z</dc:date>
    <item>
      <title>exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012635#M410939</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 selected a couple of personnal numbers (key) and i loop them into wa_pernr_select which is used in an functional module (HR_READ_INFOTYPE) to get information for this personal number. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i want to do is to exclude the record if a certain condition is true (bukrs ne bukrs).&lt;/P&gt;&lt;P&gt; I don't want to exit the whole loop just exclude a specific record. I have tried with continue and exit but i doesn't seem to work. Any suggestions?&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; LOOP AT it_pernr INTO wa_pernr_sel.

        CALL FUNCTION 'HR_READ_INFOTYPE'
              EXPORTING
                tclas                 = 'A'
                pernr                 = wa_pernr_sel
                infty                 = '0001'
                .........
              TABLES
                infty_tab             = p0001_endda
                 ......
                

        CALL FUNCTION 'HR_READ_INFOTYPE'
              EXPORTING
                tclas                 = 'A'
                pernr                 = wa_pernr_sel
                infty                 = '0001'
                .........
              TABLES
                infty_tab             = p0001_begda
                 ......

      IF p0001_begda-bukrs NE p0001_endda-bukrs.
              EXIT.
      ELSE.
              MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
      ENDIF.



 ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards &lt;/P&gt;&lt;P&gt;Claes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 17:56:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012635#M410939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T17:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012636#M410940</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;Please try this if continue or exit doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT it_pernr INTO wa_pernr_sel.
 
  CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
      tclas                 = 'A'
      pernr                 = wa_pernr_sel
      infty                 = '0001'
      .........
    TABLES
      infty_tab             = p0001_endda
      ......
        
 
  CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
      tclas                 = 'A'
      pernr                 = wa_pernr_sel
      infty                 = '0001'
      .........
    TABLES
      infty_tab             = p0001_begda
      ......
 
  IF p0001_begda-bukrs EQ p0001_endda-bukrs.
    MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
  ENDIF.
  
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:02:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012636#M410940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012637#M410941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      IF p0001_begda-bukrs NE p0001_endda-bukrs.
              EXIT.
      ELSE.
              MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this -;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      IF p0001_begda-bukrs NE p0001_endda-bukrs.
              CONTINUE.
      ELSE.
              MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:02:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012637#M410941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012638#M410942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you define your internal tables p0001_endda and p0001_begda? Do they have  header lines?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, your IF does not make sense (and even if they do it is not clean the way you do it since the FM might have processed the table and therefor set your header line randomly).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you set a break point and check before the IF?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:09:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012638#M410942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012639#M410943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wonder why CONTINUE will not work in the place of EXIT in your current code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      CHECK p0001_begda-bukrs EQ p0001_endda-bukrs.
      MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also see that p0001_begda and p0001_endda are internal tables and will NOT make sense to compare like p0001_begda-bukrs EQ p0001_endda-bukrs, as here you are only comparing the headers which MAY or MAY NOT contain data which makes sense to compare. What if both the tables have multiple rows of data, how will you compare BUKRS fields from multiple rows then?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:10:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012639#M410943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012640#M410944</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 thought that this should work since it is only possible for a person to have one (1) bukrs at a specific time. But obviously it doesn't....   &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;  &lt;/P&gt;&lt;P&gt;Have you any suggestions of how i can do instead? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;Claes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:36:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012640#M410944</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012641#M410945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Are you using the p0001_endda and p0001_begda for importing data or exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  If you are using this for importing then your logic doesn't work coz data in both the tables is same. Same parameters yield same output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  If you have the table as export parameters then try debugging and getting the scenario with different data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  This requirement of yours is a logical error. Check the logic or send complete details for help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Let me know if you have any more questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rakeesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:38:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012641#M410945</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop if condition is true</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012642#M410946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if you known (and validated) that 1 employee can only have 1 comp code and that all the records in the table have the same BUKRS, you can read the 1st record of each table in a work area and compare those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guenther&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2007 18:42:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit-loop-if-condition-is-true/m-p/2012642#M410946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-12T18:42:36Z</dc:date>
    </item>
  </channel>
</rss>

