Events in ABAP

Hi Guys,
I am new to ABAP , I am little bit confused how the events like INITIALIZATION to END-OF-PAGE will trigger. Also I am confused with multiple selections in select options and Ranges. Please let me know the difference between both.
Thanks in Advance.
Regards
Siva

Evets will be triggered automatically in following order.
1)
Initialization
At Selection-screen Output
Selection Screen Appears.(F8 is pressed)
At Selection-screen on <Field>
At Selection-screen on <Block>
At Selection-screen
Start-of-Selection
End-of-Selection
Interactive List events.(At User Command,at line selection etc.)
2)
Initialization
At Selection-screen Output
Selection Screen Appears.(Enter is pressed)
At Selection-screen on <Field>
At Selection-screen on <Block>
At Selection-screen
At selection-screen output.
Selection Screen Appears.
<i>Selection-screen events(At selection-screen output to at selection-screen) will not be triggered if u don't have a selection-screen in ur program.(i.e. neither parameters not select-options</i>)
Top-of page,end-of-Page events:
when a list generating statements(write,uline,etc)is encountered,Control goes to Top-of-page event,executs it completely and then that list generating statements will be executed.
End-od page is executed when end of page is reached.
<b>It is madatory to define line-count for end-of-page to trigger.</b>
Message was edited by:
        Aruna
Message was edited by:
        Aruna

Similar Messages

  • INTERFACE AND EVENTS IN ABAP OO

    Can some one explain me the real time need with example for use of interfaces and events in abap objects
    (asking interface and events along doesnt mean that i am relating them).
    <removed_by_moderator>
    Pankaj Giri
    Edited by: Julius Bussche on Jul 14, 2008 1:36 PM

    Events :
    Technically speaking :
    " Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
    Lets say you have an ALV - An editable one ...
    Lats say - Once you press some button  you want some kind of validation to be done.
    How to do this ?
    Raise an Event - Which is handled by a method and write the validation code.
    Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
    Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
    Where is the function code here ? No function code... But there is an event here - The data changed event.
    So you can raise a data changed event that can be handled and will do the validation.
    It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
    The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
    Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
    Advantage with events : Event handlers can be in a separate class also.
    e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
    In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
    So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
    Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
    And these different classes for different Operation systems will have different code to raise a pop-up.
    Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac  they will catch this event and process accordingly.
    May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
    Cheers.
    Varun.

  • Calling Portal event from ABAP class

    Hi Experts,
    I need a following clarificatrion, Please help,
    1. Is it possible to call a webdynpro method from a normal ABAP class?
    2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    3. Is there any ways with which we can call portal event from ABAP class?
    Thanks,
    Shabir

    >1. Is it possible to call a webdynpro method from a normal ABAP class?
    I wouldn't necessarily recommend this approach. You shouldn't try to trigger events or any of the standard WDDO* methods from outside the WD Component itself.  That said, you can pass the object reference (like the WD_COMP_CONTROLLER object reference or the View Object Reference) into methods of normal classes.  Be careful if you are finding yourself calling a lot of your added methods from outside WD.  This is probably a sign that these methods should be in the Assistance Class or some other Class functioning as a Model Object.
    >2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    What exactly do you want to do here?  Do you just want to get the relaxation script?  For what purpose?  You should never need to inject the relaxation script into WDA. 
    >3. Is there any ways with which we can call portal event from ABAP class?
    To what purpose.  Do you just want to delegate the triggering of the event that is inside WD Component to be called from a class?  If so you can pass the portal API object reference into a class from the WD Component.  However this only works while running within WD.
    How is this class used?  Are you running in WD?  Are you trying to generate some HTML code that runs in the portal independent of WD?

  • Why and how to use events in abap objects

    Dear all,
      Please explain me why and how to use events in abap objects with real time example
    regards
    pankaj giri

    Hi Pankaj,
    I will try to explain why to use events... How to use is a different topic.. which others have already answered...
    This is same from your prev. post...
    Events :
    Technically speaking :
    " Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
    Lets say you have an ALV - An editable one ...
    Lats say - Once you press some button  you want some kind of validation to be done.
    How to do this ?
    Raise an Event - Which is handled by a method and write the validation code.
    Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
    Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
    Where is the function code here ? No function code... But there is an event here - The data changed event.
    So you can raise a data changed event that can be handled and will do the validation.
    It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
    The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
    Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
    Advantage with events : Event handlers can be in a separate class also.
    e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
    In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
    So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
    Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
    And these different classes for different Operation systems will have different code to raise a pop-up.
    Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac  they will catch this event and process accordingly.
    May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
    Cheers.
    Varun.

  • Order of  events in abap

    Hi,
         this is kiran,can any one send the order for events in abap.
    regards,
    kiran

    Hi Kiran,
    Below is the list of events:
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen / <field> : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    interactive report events.
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    Hope this serves your need.
    Regards:
    Sapna

  • Events in ABAP runtime.

    Can Any  one explain me the events in ABAP runtime with proper example please.

    Hi Srnivas,
    Here are the events in order
    Classical Report Events:
    Initialization
    At selection-screen
    at selection-screen output
    start-of-selection
    end-of-selection
    top-of-page
    end-of-page
    Interactive Report Events:
    Above events and also,
    at line-selection,
    at user-command,
    at pfn
    The following events occur at runtime of a typical report program which uses logical databases:
    Event keyword Event
    INITIALIZATION Point before the selection screen
    is displayed
    When you start a program in which a selection screen is defined (either in the program itself or in the linked logical database program), the system normally processes this selection screen first. If you want to execute a processing block before the selection screen is processed, you can assign it to the event keyword INITIALIZATION.
    AT SELECTION-SCREEN Point after processing user
    input on the selection screen while the selection screen is still active
    The event keyword AT SELECTION-SCREEN provides you with several possibilities to carry out processing blocks while the system is processing the selection screen.
    START-OF-SELECTION Point after processing the selection screen
    The event START-OF-SELECTION gives you the possibility of creating a processing block after processing the selection screen and before accessing database tables using a logical database. You can use this processing block, for example, to set the values of internal fields or to write informational statements onto the output screen.
    At the START-OF-SELECTION event, also all statements are processed that are not attached to an event keyword except those that are written behind a FORM-ENDFORM block
    GET <table> Point at which the logical database
    offers a line of the database table <table>.
    The most important event for report programs with an attached logical database is the moment at which the logical database program has read a line from a database table (see Accessing Data Using Logical Databases ). To start a processing block at this event, use the GET statement as follows:
    Syntax
    GET <table> FIELDS <list>.
    After this statement, you can work with the current line of the database table <table>. The data is provided in the table work area <table>.
    GET <table> LATE Point after processing all tables which
    are hierarchically subordinate to the database table <table> in the structure of the logical database.
    To start a processing block at the moment after the system has processed all database tables of a logical database that are hierarchically inferior to a specific database table, use the event keyword GET as follows:
    Syntax
    GET <table> LATE FIELDS <list>.
    In analogy to report programs that use only SELECT statements (see table in Comparison of Access Methods ), the processing block of a GET <table> LATE statement would appear directly before the ENDSELECT statement in the SELECT loop for the database table <table>.
    END-OF-SELECTION Point after processing all lines offered
    by the logical database.
    To define a processing block after the system has read and processed all database tables of a logical database, use the keyword END-OF-SELECTION.
    The following events occur during the processing of the output list of a report program:
    Event keyword Event
    TOP-OF-PAGE Point during list processing when
    a new page is started
    END-OF-PAGE Point during list processing when a page
    is ended
    The following events occur during the display of the output list of a report program:
    Event keyword Event
    AT LINE-SELECTION Point at which the user selects a line
    AT USER-COMMAND Point at which the user presses a function key or enters a command in the command field.
    AT PF<nn> Point at which the user presses the
    function key with the function code PF<n>
    With the selection screen, ABAP/4 offers an interactive element also for report programs. You can define a selection screen without having to bother about all the details required in dialog programming.
    The selection screen is always processed directly after a report program is started. The user can enter field values and selection criteria on this screen.
    Reward points if useful.
    Cheers,
    Swamy Kunche

  • How to Handle Business Object event in ABAP class

    Hello Everybody,
    I wanted to know if it was possible to reference BOR objects in ABAP class and handle BOR events in ABAP Objects.
    Thanks in advance.

    Hi,
    Catch the et_VALIDATE event, when InnerEvent = False and ItemChanged = True.
                If pVal.EventType = BoEventTypes.et_VALIDATE Then
                    If pVal.InnerEvent = False And pVal.ItemChanged Then
                        'TODO Your code here...
                    End If
                End If
    Regards,
    Vítor Vieira

  • What is the equivalent for 'On Change of' Event in ABAP OBJECTS?

    What is the equivalent for 'On Change of' Event in ABAP OBJECTS?  and how to use it in LOOP control?

    hi,
    There is no such Equivalent in OO ABAP.
    You have to Raise your own Event within tha class checking the value of the field whose value is changing.
    Regards
    Sumit Agarwal

  • Link BOR Event with ABAP code (program or function)!

    Hello experts,
    I am trying to link program or function to bor event. Change of data in HR IT0002 trigger event CHANGE of PERSDATA Object. I need to execute some ABAP code (program or function) on CHANGE event, so I have to link event and ABAP code.
    Question: is it possible and how?

    Hi,
    It is very much possible....
    You can use the Workflow & use BO as PERSDATA & this workflow can be triggered on event change.
    & You can write your code ...
    Regards,
    Rahul

  • What is the need of END-OF-SELECTION event in ABAP reporting

    Hi,
    Can anyone explain the need of the END-OF-SELECTION event in ABAP Reports?
    This event is used to terminate the previous event. Is that right? or is there any specific use of it?
    and when exactly we use this event while writing a report? I mean what purpose?
    Thanks,
    Paddu.

    Hi,
    END-OF-SELECTION makes more sense when you are using logical database in your program.
    See these links.
    http://help.sap.com/saphelp_46c/helpdata/en/34/8e74266df74873e10000009b38f9b8/frameset.htm
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9aca35c111d1829f0000e829fbfe/frameset.htm
    After all the data has been selected END-OF-SELECTION event writes the data to the screen
    The END-OF-SELECTION event is triggered in executable programs once the logical database has finished reading all data and before the list processor is started.
    Try to go thro this link.
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm
    Mostly end-of-selection is used in logical data base. It is not mandatory.
    Ex:
    If you use a logical database in your report then this event is mandatory because when all the data selection from the database is finished this events get triggers.
    For example if you are populating a internal table using a logical data base event 'GET' then you need this event because if you don't use this you get display again and again for each selection.
    START-OF-SELECTION.
    GET PERNR.
    itab-pernr = pernr-pernr.
    append itab.
    *this get triggers after all selection from database.
    END-OF-SELECTION.
    loop at itab.
    write:/ itab-pernr.
    endloop.
    Regards,
    Padmam.

  • Generating an event with ABAP Progrm

    Kudos SDN:
    Is there any way to generate an 'Event' using ABAP Progam.?
    Thanks in advance,
    Pidugu

    >
    Mark Barton wrote:
    > yes - create a program which calls function module BP_EVENT_RAISE.
    That function module is obsolete.Shouldnot be used in future.

  • Event for ABAP Objects

    Dear All,
    Would you mind tell me the concept of the event in the ABAP objects.
    Regards,
    Luke

    hI
    Triggering and Handling Events
    In ABAP Objects, triggering and handling an event means that certain methods act as triggers and trigger events, to which other methods - the handlers - react. This means that the handler methods are executed when the event occurs.
    This section contains explains how to work with events in ABAP Objects.  For precise details of the relevant ABAP statements, refer to the corresponding keyword documentation in the ABAP Editor.
    Triggering Events
    To trigger an event, a class must
    ·        Declare the event in its declaration part
    ·        Trigger the event in one of its methods
    Declaring Events
    You declare events in the declaration part of a class or in an interface. To declare instance events, use the following statement:
    EVENTS ) TYPE type ..
    To declare static events, use the following statement:
    CLASS-EVENTS ... ...
    It links a list of handler methods with corresponding trigger methods.  There are four different types of event.
    It can be
    ·        An instance event declared in a class
    ·        An instance event declared in an interface
    ·        A static event declared in a class
    ·        A static event declared in an interface
    The syntax and effect of the SET HANDLER depends on which of the four cases listed above applies. 
    For an instance event, you must use the FOR addition to specify the instance for which you want to register the handler.  You can either specify a single instance as the trigger, using a reference variable ...
    The registration applies automatically to the whole class, or to all of the classes that implement the interface containing the static event.  In the case of interfaces, the registration also applies to classes that are not loaded until after the handler has been registered.
    Timing of Event Handling
    After the RAISE EVENT statement, all registered handler methods are executed before the next statement is processed (synchronous event handling).  If a handler method itself triggers events, its handler methods are executed before the original handler method continues. To avoid the possibility of endless recursion, events may currently only be nested 64 deep.
    Handler methods are executed in the order in which they were registered.  Since event handlers are registered dynamically, you should not assume that they will be processed in a particular order. Instead, you should program as though all event handlers will be executed simultaneously.
    http://help.sap.com/saphelp_erp2004/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

  • Handling C# events in ABAP

    Hi,
        I am having a very bad time trying to make a C# custom control and an ABAP class talk to each other...
        The control have many properties and methods, all of them perfectly accessible using a proxy class derived from cl_gui_control in ABAP. I can instantiate, show the control in   the screen, call its methods, get its properties, but there is nothing in the earth that makes the ABAP understand a single event raised by the component.
        In fact, the component runs ok - I tested it outside SAP, using IExplorer, and the event was good. But when I embed it on SAP, nothing happens.
        What I did:
        1) The component has an event declared this way:
    // C# code, simplified
    public interface IEventInfterface
       [DispID(10)]
       event Selected();
    [ComSourceInterfaces(typeof(ISapControlEvents))]
    public class mycontrol
       public delegate void SelectedHND();
       public event SelectedHND Selected;
       public void OnSelected()
          if (Selected != null)  // Attention here!
             Selected();
       This means that my component have a "Selected" event, its DispatchID is "10".
      2) In SAP, after making all the necessary implementations to use a class (constructor, dispatch, etc), my ABAP code contains this (consider obj_csharp an already instantiated and functional object):
    DATA: evt_table    TYPE cntl_simple_events,
               evt_line       TYPE cntl_simple_event.
          evt_line-eventid = 10.   " This is my DispID to the Selected event
          evt_line-appl_event = 'X'.
          APPEND evt_line to evt_table.
          call METHOD obj_csharp->set_registered_events
            EXPORTING
              events = evt_table.
        Now, the problem is: everything works perfect, including the registration routine (the event is registrered in the obj_csharp object), but when it need to be fired, <b>VisualStudio says that the object "Selected" is null</b> in that verification (where I wrote "Attention here", remember?) and do not raise the event.
        Am I missing anything?
       Thanks !!!
    Arnaldo.

    The ap Object is declared inside my OpenWord - Method.
    The class itself is bound to a GUI button as a command.
    public class OfficeCommand : ICommand
        public void Execute(object parameter)
              OpenWord(info, ReadWrite);
        private void OpenWord(DocumentInfo info, bool readwrite)
                Word.Application ap = new Word.Application();
                Microsoft.Office.Interop.Word.Document document
                             = ap.Documents.Open(path,
    ConfirmConversions:false,
    ReadOnly:!readwrite,
                    AddToRecentFiles:false);
                WordDocumentEventHandler WordCloseEventHandler = GlobalModel.createNew(info);
                ap.DocumentBeforeSave += WordCloseEventHandler.DocumentBeforeSaveEvent;
                ap.Visible = true;
                ap.Activate();

  • Events in ABAP Programming

    Hi,
    Can anybody please list out the exact differences between the events 'LOAD-OF-PROGRAM', 'INITIALIZATION' and 'AT SELECTION-SCREEN OUTPUT'.
    Thanks in advance,
    Sujit.

    Hi,
    <u><b>LOAD-OF-PROGRAM:</b></u> When an ABAP program is loaded in an internal session, the runtime environment triggers the LOAD-OF-PROGRAM event, and the corresponding event block is executed.
    The processing block LOAD-OF-PROGRAM has approximately the same function in an ABAP program with type 1, M, F, or S as the constructor method of a class in ABAP Objects.
    Programs wiht type 1, M, F, or S can be loaded into an internal session in two ways:
    Program calls
    Whenever you call a program using SUBMIT or a transaction code, a new internal session is opened. The LOAD-OF-PROGRAM event is therefore called in each program call.
    External procedure calls
    The first time you call an external procedure (subroutine or function module), the main program of the procedure that you called is loaded into the internal session of the calling program. The eventLOAD-OF-PROGRAM is triggered and the corresponding processing block is executed before the procedure that you called. However, subsequent calls from the same calling program to a procedure in the same subroutine pool or function group do not trigger the LOAD-OF-PROGRAM event.
    so it's before the program is loaded in the memory for execution.
    <u><b>INITIALIZATION:</b></u>
    This event occurs before the standard selection screen is called. You can use it, for example, to initialize the input fields of the standard selection screen. This is the only possible way to change the default values of parameters or selection criteria defined in logical databases. To change a selection criterion, you must fill at least the components <seltab>-SIGN, <seltab>-OPTION, and <seltab>-LOW of the selection table <seltab>, otherwise it remains undefined.
    If you want to initialize input fields of the logical database, you need to find out the names of the fields. To do this for the logical database SAPDB<ldb>, use Transaction SLDB or choose Tools
    ABAP Workbench, followed by Development   Programming environ.   Logical databases. You
    can also display the technical information for the required field on the selection screen. To do
    this, call the F1 help for the required field and then choose Technical info. In the field Scrn Field
    of the following dialog box, you then see the name of the field used in the program.
    <u><b>AT SELECTION-SCREEN OUTPUT</b></u>
    event is triggered. This event block allows you to modify the selection screen directly before it is displayed.

  • Terminating event and abap oo class

    Hi, gurus,
    I 'd like to know how the terminating event works.
    for example,  i define a custom abap oo class (which has been implemented the interface of IF_WORKFLOW), and i want to use it as the terminating event of a standard task.
    could you please tell me how does it works?
    1. there must be an instance defined in the container of the task?
       which must be instanciated in the run time?
    2. then in another abap report, i simply raise the event defined as the terminating event, using the same key, then the pending task will be terminated?
    could you pls provide more information on this ?
    thanks and best regards.
    Jun

    Hi Jun Zhang,
    An event that is used to stop a workflow or task, or change the behavior of an already started workflow is called Terminating Event.
    If the event linkage is active and the linkage rules are satisfied, the status of the work item is set to COMPLETED.
    Defining Event Linkage  Terminating event linkage consists of 2 parts.
    Type linkage which specifies business object type, event name, generic name for event receiver (WORKITEM for terminating events of tasks or EVENTITEM for wait for event steps)
    Instance linkage which identifies the particular receivers (I.e. work item Ids) per object instance.
    Terminating event linkages can be seen in SWE3.
    For terminating events, along with Business object and Event a Container Element should be specified that holds the Object Instance.
    Terminating Event for Workflow is available from Release 6.10 only. This is defined in Basic Data of Workflow Builder.
    Binding Definition is optional for Terminating Events. Binding can be defined b/n event container and workflow container to pass event information to the workflow if required. That is the only way of passing information from an asynchronous method to the task that started it.
    Thanks and Regards,
    Prabhakar Dharmala

Maybe you are looking for

  • PB 12" OSX keeps going to sleep - power problem?

    My 12" 867MHz Powerbook has developed a fault that results in the screen going very dim and the PB going to sleep, even before it's displayed anything on screen. Everything sounds good - I get a startup chime and the usual disk noises and sometimes I

  • Lookout 5.1 & 6.1 locking up

    During last two weeks, lookout Ver 5.1 which has been running without problems for a couple of years started locking up with out warning usually around midnight or shortly after. Attempted all recommended fixes that I could find from the website and

  • Date Popup Default Heigth

    I need to increase the heigth of the date item popup window because when the item is defined as date and time, the buttons OK and Cancel are hidden and the user needs to increase it manually.

  • LOOSING SONGS AFTER DEVICES ARE UNPLUGED

    LOOSING MY LIBRARY WHEN DEVICES ARE UNPLUGED?

  • Pin to start hotmail

    Hi, I'm a new Lumia user. I played with rearranging the tiles on the start site when I incidentally unpinned the 'envelope' tile, which I guess stands for email or outlook or hotmail or sth like that. Now, I can't revert to the previous state because