<?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: Onchange in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679326#M299482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I found in SAP help:&lt;/P&gt;&lt;P&gt;"Normally, you use the statement to manipulate database fields during GET events or SELECT/ENDSELECT processing.&lt;/P&gt;&lt;P&gt;There are special control structures for processing control breaks in LOOP s on internal tables or extract datasets (AT). &lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Nov 2006 11:43:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-23T11:43:06Z</dc:date>
    <item>
      <title>Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679320#M299476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i sthe difference between On change and At new statements?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:31:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679320#M299476</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679321#M299477</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;&lt;/P&gt;&lt;P&gt;at new belongs to loop-endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and on change you can use in selects, loops ,do-enddo,while..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Andreas Mann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679321#M299477</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-11-23T11:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679322#M299478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;onchage of is not allowed in ABAP OBJECTS whereas AT NEW can be used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Onchange of can be used in select statements where as AT NEW cannot be used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA T100_WA TYPE T100. 
SELECT * FROM T100 
         INTO T100_WA 
         WHERE SPRSL = SY-LANGU AND 
                         MSGNR &amp;lt; '010' 
                   ORDER BY PRIMARY KEY. 
  ON CHANGE OF T100_WA-ARBGB. 
    ULINE. 
    WRITE: / '***', T100_WA-ARBGB, '***'. 
  ENDON. 
  WRITE: / T100_WA-MSGNR, T100_WA-TEXT. 
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:35:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679322#M299478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679323#M299479</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;  When you r using AT NEW statement you can give the parameter at runtime also whereas in on change of it is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg.: AT NEW (parameter name) this parameter you can give at runtime, it means you can decide at runtime on which field you wish to perform at new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where as in case of ON CHANGE OF &amp;lt;internal tablename - field name&amp;gt; these details you need to decide while writing the program. You can decide the fields at runtime. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than this there is no difference in the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Haritha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:35:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679323#M299479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679324#M299480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;On change of and AT NEW statment working wise they are same.&lt;/P&gt;&lt;P&gt;The difference is using AT NEW F1 will convert the Char fileds to * which are left side of Field F1. But on Change of Statement will not pose such type of problems.&lt;/P&gt;&lt;P&gt;Its so because on change of statement will take the data to temporary momory and will compare the data there so thats the reason why we dont get * .&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;RAVI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:37:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679324#M299480</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679325#M299481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hullo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the 'ON CHANGE' of statement will be triggered every time the value of referenced field changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the 'AT NEW' of statement will be triggered every time the value of referenced field changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, while the 'ON CHANGE' command will display everything, the 'AT NEW' command takes a somewhat more structured approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement: &lt;/P&gt;&lt;P&gt;- All character type fields (on the right) are filled with "*" after the current&lt;/P&gt;&lt;P&gt;  control level key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- All other fields (on the right) are set to their initial values after the current&lt;/P&gt;&lt;P&gt;  control level key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the 'AT NEW' statement will be triggered if a field to the left of the current control level key is changed as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the 'AT NEW' statement it is possible to use the 'SUM' statement, which will sum all the ABAP number types (p, i, f, etc.).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Important to remember is using the 'AT NEW' statement is to sort your internal table according to the control level keys you are using, and make sure that the fields you want to display are to the left of the control key in the data declaration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which one should you use? Well the 'ON CHANGE' statement works, but is considered to be a 'quick &amp;amp; dirty' solution. The 'AT NEW' would be the 'gentleman's' solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:39:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679325#M299481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679326#M299482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I found in SAP help:&lt;/P&gt;&lt;P&gt;"Normally, you use the statement to manipulate database fields during GET events or SELECT/ENDSELECT processing.&lt;/P&gt;&lt;P&gt;There are special control structures for processing control breaks in LOOP s on internal tables or extract datasets (AT). &lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:43:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679326#M299482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679327#M299483</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;  You can check with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZCLASSICAL_REP1                                             *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZCLASSICAL_REP2&lt;/P&gt;&lt;P&gt;        No Standard Page Heading&lt;/P&gt;&lt;P&gt;        line-count 42(3).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data itab like sflight occurs 0 with header line.&lt;/P&gt;&lt;P&gt;Data lines type i.&lt;/P&gt;&lt;P&gt;Data color type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_name(20) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Top-Of-Page.&lt;/P&gt;&lt;P&gt;  write:/45 'Intelligroup Asia Pvt. Ltd.,' color col_heading.&lt;/P&gt;&lt;P&gt; uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start-Of-Selection.&lt;/P&gt;&lt;P&gt; Select * from sflight into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End-Of-Selection.&lt;/P&gt;&lt;P&gt; sort itab by carrid.&lt;/P&gt;&lt;P&gt; loop at itab.&lt;/P&gt;&lt;P&gt;  At First.&lt;/P&gt;&lt;P&gt;   write:/50 'Flight Details' color 6.&lt;/P&gt;&lt;P&gt;  Endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  at new (p_name).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   lines = sy-linct - sy-linno.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   skip lines.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  new-page.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   write:/5 'Airline Code' color col_heading, 27 'Connection No.' color&lt;/P&gt;&lt;P&gt;col_heading.&lt;/P&gt;&lt;P&gt;   uline.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  write:/5 itab-carrid, 30 itab-connid.&lt;/P&gt;&lt;P&gt;  At Last.&lt;/P&gt;&lt;P&gt;   uline.&lt;/P&gt;&lt;P&gt;    write:/55 'Total Number Of Flights', sy-tfill color col_total.&lt;/P&gt;&lt;P&gt;   uline.&lt;/P&gt;&lt;P&gt;  Endat.&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;lines = sy-linct - sy-linno.&lt;/P&gt;&lt;P&gt;skip lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End-Of-Page.&lt;/P&gt;&lt;P&gt; uline.&lt;/P&gt;&lt;P&gt;  write:/10 'Page Number:', sy-pagno color col_total, 90 'Index Number:'&lt;/P&gt;&lt;P&gt;,sy-index color col_total.&lt;/P&gt;&lt;P&gt; uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Haritha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 11:47:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679327#M299483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T11:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679328#M299484</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;'ON CHANGE OF' can be used with in a SELECT..ENDSELECT and in LOOP..ENDLOOP..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But AT NEW can be used only in LOOP..ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way.. 'ON CHANGE OF' is obsolute in SAP Netweaver 2004s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'ON CHANGE OF'&lt;/P&gt;&lt;P&gt;The first time a statement ON CHANGE OF is executed, the statement block is executed if at least one of the specified data objects is not initial. The statement block is executed for each additional execution of the same statement ON CHANGE OF, if the content of one of the specified data objects has been changed since the last time the statement ON CHANGE OF was executed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW..ENDAT&lt;/P&gt;&lt;P&gt;Statement between AT NEW and ENDAT will be executed once per change of the field your are checking. and more over the right side fields after the field in checking in new are not visible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZGD_TEST_HR_ORG_STR&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZGD_TEST_HR_ORG_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   DATA: plvar            LIKE hrsobid-plvar.&lt;/P&gt;&lt;P&gt;  DATA: otype            LIKE hrsobid-otype.&lt;/P&gt;&lt;P&gt;  DATA: sobid            LIKE hrsobid-sobid.&lt;/P&gt;&lt;P&gt;  DATA: date             LIKE sy-datum.&lt;/P&gt;&lt;P&gt;  DATA: leading_position LIKE hrobject OCCURS 1 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;  DATA: org_agent        LIKE swhactor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: lv_sw_vapos      TYPE xflag,&lt;/P&gt;&lt;P&gt;        lv_subrc         TYPE sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA spfli_wa TYPE spfli.&lt;/P&gt;&lt;P&gt;  DATA carrid_buffer TYPE spfli-carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF plvar IS INITIAL.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'RH_GET_ACTIVE_WF_PLVAR'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        act_plvar       = plvar&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        no_active_plvar = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;gt; 0.&lt;/P&gt;&lt;P&gt;      MESSAGE e300(5w) RAISING no_active_plvar.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF otype IS INITIAL OR sobid IS INITIAL.&lt;/P&gt;&lt;P&gt;      otype = 'US'.&lt;/P&gt;&lt;P&gt;      sobid = sy-uname.&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;  CALL FUNCTION 'RH_GET_LEADING_POSITION'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      plvar              = plvar&lt;/P&gt;&lt;P&gt;      otype              = otype&lt;/P&gt;&lt;P&gt;      sobid              = sobid&lt;/P&gt;&lt;P&gt;      date               = sy-datum&lt;/P&gt;&lt;P&gt;      auth               = ' '&lt;/P&gt;&lt;P&gt;      consider_vac_pos   = space&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      leading_pos        = leading_position&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      no_lead_pos_found  = 1&lt;/P&gt;&lt;P&gt;      OTHERS             = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   IF sy-subrc &amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE e802(5w) WITH otype sobid&lt;/P&gt;&lt;P&gt;                     RAISING no_lead_pos_found.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    LOOP AT leading_position.&lt;/P&gt;&lt;P&gt;      write :  / leading_position-otype,&lt;/P&gt;&lt;P&gt;                 leading_position-objid.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Skip 2.&lt;/P&gt;&lt;P&gt;write / 'AT New'.&lt;/P&gt;&lt;P&gt;    LOOP AT leading_position.&lt;/P&gt;&lt;P&gt;      at new otype.&lt;/P&gt;&lt;P&gt;      write :  / leading_position-otype,&lt;/P&gt;&lt;P&gt;                 leading_position-objid.&lt;/P&gt;&lt;P&gt;      endat.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Skip 2.&lt;/P&gt;&lt;P&gt;Write 'On Change 1'.&lt;/P&gt;&lt;P&gt;    LOOP AT leading_position.&lt;/P&gt;&lt;P&gt;      ON CHANGE OF leading_position-otype.&lt;/P&gt;&lt;P&gt;      write :  / leading_position-otype,&lt;/P&gt;&lt;P&gt;                 leading_position-objid.&lt;/P&gt;&lt;P&gt;      endon.&lt;/P&gt;&lt;P&gt;    endloop.&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;  SELECT *&lt;/P&gt;&lt;P&gt;       FROM spfli&lt;/P&gt;&lt;P&gt;       INTO spfli_wa&lt;/P&gt;&lt;P&gt;       ORDER BY carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ON CHANGE OF spfli_wa-carrid.&lt;/P&gt;&lt;P&gt;    write : / spfli_wa-carrid.&lt;/P&gt;&lt;P&gt;  ENDON.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" the below statement shows how the above can be used with IF&lt;/P&gt;&lt;P&gt;CLEAR carrid_buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;       FROM spfli&lt;/P&gt;&lt;P&gt;       INTO spfli_wa&lt;/P&gt;&lt;P&gt;       ORDER BY carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF spfli_wa-carrid &amp;lt;&amp;gt; carrid_buffer.&lt;/P&gt;&lt;P&gt;    carrid_buffer = spfli_wa-carrid.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 12:02:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679328#M299484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T12:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679329#M299485</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;one importatnt tip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AT NEW : for this to work the field addressing shuld come as the first variable declared inside  the internal table.

On CHANGE : the field addressing can come any where in the internal tabel.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 12:10:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679329#M299485</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-23T12:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Onchange</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679330#M299486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;The Major Difference is :&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) When AT NEW occurs,&lt;/P&gt;&lt;P&gt;the alpha-numeric fields have ******* in their value,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) where as in case of ON CHANGE,&lt;/P&gt;&lt;P&gt;the alpha-numeric fields have their corresponding value, &lt;/P&gt;&lt;P&gt;of that particular record,&lt;/P&gt;&lt;P&gt;where the Event gets fired.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; Other differences are :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ON CHANGE OF can be used any where in the program..&lt;/P&gt;&lt;P&gt;on change of differs from at new in the following respects: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.It can be used in any loop construct, not just loop at. For example, it can be used within select and endselect, do and enddo, or while and endwhile, as well as inside get events. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.A single on change of can be triggered by a change within one or more fields named after of and separated by or. These fields can be elementary fields or field strings. If you are within a loop, these fields do not have to belong to the loop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.When used within a loop, a change in a field to the left of the control level does not trigger a control break. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.When used within a loop, fields to the right still contain their original values; they are not changed to contain zeros or asterisks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5.You can use else between on change of and endon. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6.You can use it with loop at it where . . .. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7.You can use sum with on change of. It sums all numeric fields except the one(s) named after of. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8.Any values changed within on change of remain changed after endon. The contents of the header line are not restored as they are for at and endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while&lt;/P&gt;&lt;P&gt;AT NEW can be used only within a loop of an INTERNAL TABLE..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;5. Sample program to get the taste of it&lt;/P&gt;&lt;P&gt;   (just copy paste)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ABC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;       bukrs like t001-bukrs,&lt;/P&gt;&lt;P&gt;       f1(10) type c,&lt;/P&gt;&lt;P&gt;       end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       itab-bukrs = '1000'.&lt;/P&gt;&lt;P&gt;       itab-f1 = '1111111'.&lt;/P&gt;&lt;P&gt;       append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       itab-bukrs = '1100'.&lt;/P&gt;&lt;P&gt;       itab-f1 = '3333333'.&lt;/P&gt;&lt;P&gt;       append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       itab-bukrs = '1200'.&lt;/P&gt;&lt;P&gt;       itab-f1 = '555555'.&lt;/P&gt;&lt;P&gt;       append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;  AT NEW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       loop at itab.&lt;/P&gt;&lt;P&gt;       at new bukrs.&lt;/P&gt;&lt;P&gt;       write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab-bukrs , itab-f1.&lt;/P&gt;&lt;P&gt;       endat.&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;*----&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;  AT ONCHANGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       loop at itab.&lt;/P&gt;&lt;P&gt;       ON CHANGE OF ITAB-BUKRS.&lt;/P&gt;&lt;P&gt;       write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab-bukrs , itab-f1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       ENDON.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       endloop.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 12:37:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/onchange/m-p/1679330#M299486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-23T12:37:58Z</dc:date>
    </item>
  </channel>
</rss>

