Multiple event receivers with a list

Hi All,
If there are two item event receivers attached with a list and event is cancelled by event receiver that trigger first, will second event receiver be invoked? As per my understanding that second event receiver will not be invoked.
I have a requirement where in case first event receiver cancel the event, second event recever should still be invoked.
do anyone has any idea aroound it?
Regards Amit

Hi, Amit KM.
http://msdn.microsoft.com/en-us/library/gg749858.aspx
Notice the following details:
Synchronous event receivers are called in sequential order based on the sequence number specified during event binding. This applies to both Before and After synchronous events.
Asynchronous After event receiver threads are initiated in sequential order based on the sequence number. However, there is no guarantee that they will finish in that same order.
An asynchronous After event can start at any time after its associated user action is performed. It may start before, at the same time as, or after the Web request is completed.
After a user initiates an action in the SharePoint user interface, and before SharePoint Foundation executes the user action, the synchronous Before events are raised. If there are multiple synchronous Before events, they are raised in the order specified
by their sequence number. Similarly, synchronous After events are raised after SharePoint Foundation executes the user action. These, too, are raised in the order specified by sequence number. As you can see, all synchronous events are processed in the same
thread as that in which the user action occurs.
Asynchronous After events, however, are processed on secondary threads.
So you're completely right that if the first event receiver has cancelled the operation, the second event receiver will never been executed.
In your case if you want second event receiver(B) to be invoked regardless of the first event receivers'
(A) result you can easily swap the sequence numbers for those event receivers.
Event Receiver Sequence          
The event receiver sequence specifies the order in which an event receiver is executed in cases where an event triggers multiple event receivers. For example, if you have two
ItemAdded event receivers bound to the same list (one from Assembly "1" and the other from Assembly "2"), the event receiver that is bound with a lower sequence number is executed first. A practical example is adding an event receiver to a
system list that already has a system event receiver bound to it. In that case, you assign the new event receiver a higher sequence number.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListUrl="Lists/Tasks">
<Receiver>
<Assembly>MyReceiverAssembly, Version=1.0.0.0, Culture=Neutral,
PublicKeyToken=12e5e5525fb3d28a</Assembly>
<Class>MyReceiverAssembly.MyReceiverClass</Class>
<Type>ItemAdded</Type>
<Name>My ItemAdded Event Receiver</Name>
<Synchronization>Synchronous</Synchronization>
<SequenceNumber>1000</SequenceNumber>
</Receiver>
</Receivers>
</Elements>
LinkedIn Profile
SharePoint Advanced Visibility Options project
SharePoint Managed Metadata Claims Provider project

Similar Messages

  • Can I have multiple event structures with the same event cases?

    Hello, 
    I'm doing an application that reproduces the front panel of the HP6675A power supply. To achieve this, I have done a state machine with different states
    (initialize, measures, voltage, current, ocp, ov, store, recall, etc). In each state, should have an event structure that catches the events of the buttons, like for example: if the current state is the Voltage mode and the user press the current button the next state will be the Current mode. For this in each state of the state machine should be the same event structure with the same events.
    My problem is that the Vi doesn't work properly when I have multiple event structures with the same event cases. There are some possibily to do this, and how? Or is impossible to have multiple events? I have been reading some posts, but I don't find solutions. 
    Any help is appreciated.
    Thank you very much.
    Solved!
    Go to Solution.

    natasftw wrote:
    Or as others mentioned, make two parallel loops.  In one loop, have your state machine.  In the other, have just the Event Handler.  Pass the events from the handler to the state machine by way of queues.
    A proper state machine will not need the second loop.  The "Wait For Event" or "Idle" state (whatever you want to call it) is all you really need in order to catch the user button presses.  The setup is almost there.  Maybe add a shift register to keep track of which state to go to in the case of a timeout on the Event Structure.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Multiple queue receivers with disjoint message selectors - portable?

    Hi all,
    I was wondering whether an application that uses multiple queue receivers with disjoint message selectors would be portable across different JMS providers.
    I fear it's not - at least the spec clearly states that the implementation of message delivery to multiple receivers is provider specific, and I couldn't find any comment that this would be different with disjoint selectors. But I wanted to check with you - maybe I missed anything?
    What could be an alternative then (in case you want to avoid multiple queues)? Using a topic with durable subscribers?
    Regards,
    Sabine

    Hi Nimo,
    accepted - as long as the JMS spec requires the JMS provider to support multiple receivers. And that's exactly the point where I'm not sure...
    Literally it states:
    "For PTP, JMS does not specify the semantics of concurrent QueueReceivers for the same queue; however, JMS does not prohibit a provider from supporting this."
    The formulation "does not prohibit" makes me think that JMS allows providers also not to support this, for example, to throw an exception when a second consumer is created for the same queue, or not to serve it at all with messages as long as the first consumer is active. Not that I think it would be a very useful implementation - I just want to know if it would be possible. In that case, the application would not be portable.
    Regards,
    Sabine

  • Multiple events in a single list

    Does anyone know how create mutliple change events in the same list? 
    Basically want to access different view files by clicking different lines from a single list. 
    I havent seen anything on this.  Is it even possible in Flex? 
    This is for a mobile application.
    Thaks!

    Well, I don't really like these theroretical discussions. Can you attach a simplified version of some of your code?
    There are many other ways to identify the particular control. You could for example search an array of references for the value of the "ctlref" event data node. This would make the code much more robust (your code will fail for example if you (or some other programmer updating your code in a few years!) notices a mispelling and edits the label without also changing the case structure cases).
    LabVIEW Champion . Do more with less code and in less time .

  • Event recevier with another list

    Can some one help how i can attached  ItemAdding event in the the other list with minimal changes in code.

    Hi Reddyraj,
    i need to add the another recevier in element.xml file so that the event will execute on that list
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
       <Receivers ListTemplateId="100">
          <Receiver>
             <Name>CustomEventReceiversItemAdded</Name>
             <Type>ItemAdded</Type>
             <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
             <Class>MyApp.CustomEventReceivers.CustomEventReceivers</Class>
             <SequenceNumber>10000</SequenceNumber>
          </Receiver>
          <Receiver>
             <Name>CustomEventReceiversItemAdding</Name>
             <Type>ItemAdding</Type>
             <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
             <Class>MyApp.CustomEventReceivers.CustomEventReceivers</Class>
             <SequenceNumber>10000</SequenceNumber>
          </Receiver>
       </Receivers>
    </Elements>
    Check the link below..http://www.expertsupdates.com/sharepoint-articles/create-sharepoint-event-handlers-using-vishal-studio-66.aspxPlease mark the answer and vote me if you think that it will help you resolved the issue

  • Attaching remote event receiver to a list on host web.

    We have an O365 Sharepoint 2013 site. I am trying to create a remote event receiver and attach it to a list on host web instead of appweb. Below are the links that I am referencing to do it: 
    http://www.codeproject.com/Articles/636058/Adventures-with-SharePoint-2013-Remote-Event-Recei
    http://blogs.msdn.com/b/knewton/archive/2012/12/11/defining-content-in-host-web-from-an-app-for-sharepoint.aspx
    They are using 'AppInstalled' event to accomplish this. The method is as follows: get the client context of the host web, get our target list in the host web, get the service url of the remote event receiver using code below: 
    string remoteUrl = string.Format("https://{0}/OurRemoteEventReceiver.svc", 
      OperationContext.Current.Channel.LocalAddress.Uri.DnsSafeHost + "/services");
    and then use it while adding an event receiver to our target list. A different way of obtaining this remoteUrl is shown in the second post.
    When I try to do this I get the below error: 
    CorrelationId: eb837c4c-c434-4067-99f4-ad9b38e30d82
    3>        ErrorDetail: The remote event receiver callout failed.
    3>        ErrorType: Transient
    3>        ErrorTypeName: Intermittent
    3>        ExceptionMessage: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from
    the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
    3>        Source: Common
    3>        SourceName: Common App Deployment
    Also, the 'Grant permissions to the App' window appears when I hit Deploy and immediately goes away before I hit or even see the 'Trust it' button. Then, after a while I get the above error in output window. This happens whenever I add the 'AppEventReceiver.svc'
    by selecting 'AppInstalled' property to True and then write any code(or even not write any code) in it that targets the host web. Any suggestions please?

    Hi,
    We can add the code snippet below in the "App Installed" event handler.
    EventReceiverDefinitionCreationInformation eventReceiver = new EventReceiverDefinitionCreationInformation();
    eventReceiver.EventType = EventReceiverType.ItemAdding;
    eventReceiver.ReceiverAssembly = Assembly.GetExecutingAssembly().FullName;
    eventReceiver.ReceiverClass = "OurRemoteEventReceiver";
    eventReceiver.ReceiverName = "OurRemoteEventReceiver";
    eventReceiver.ReceiverUrl = "http://xxx/OurRemoteEventReceiver.svc";
    eventReceiver.SequenceNumber = 1000;
    Web web = SPutil.getSP("http://sub.domain.com/sites/apps");
    List targetList = web.Lists.GetByTitle("Host Web List");
    targetList.EventReceivers.Add(eventReceiver);
    web.Context.ExecuteQuery();
    You will need to include an additional .NET class as well:
    using System.Reflection;
    If the problem still existed, I  suggest to debug your remote event receiver project to find the cause of the error. The link below for your reference:
    http://blogs.msdn.com/b/officeapps/archive/2013/01/03/debugging-remote-event-receivers-with-visual-studio.aspx
    More information:
    Add list item properties with a remote event receiver
    http://code.msdn.microsoft.com/office/SharePoint-2013-Add-list-2c6e71e0
    Best Regards,
    Dennis Guo
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • Fire event receiver after update list items with PowerShell

    Hi,
    I have a list with a event receiver attached to it. Also I have a PowerShell script which updates some elements. I noticed that the Event Receiver is not firing after the PowerShell script runs. Is there any way to make it happen?
    Thanks anyway!

    Hi,
    According to your description, my understanding is that the event receiver not fire after you update the item elements.
    I suggest you can create a simple event receiver and then test if the event receiver fire after PowerShell run.
    Here is my PowerShell script:
    $spWeb = Get-SPWeb -Identity http://sp2013sps/sites/test
    $spList = $spWeb.Lists["Documents"]
    $spItem = $spList.GetItemById(14)
    $spItem["Title"] = "Test111"
    $spItem.Update()
    Here is my event receiver code:
    public override void ItemUpdated(SPItemEventProperties properties)
    base.ItemUpdated(properties);
    Console.WriteLine("event receiver has been done");
    After the PowerShell run, it will come out the result:
    It means the event receiver has been fired.
    Here is a detailed article for your reference:
    http://blogs.technet.com/b/speschka/archive/2009/12/25/debugging-event-receivers-in-sharepoint-2010.aspx
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • How do I split a single event with many clips into multiples events, one event per date?

    I archived the video from my AVCHD camera into a Final Cut video archive. Later I imported this into iMovie. All the clips from this archive (spanning several months) are dumped into a single event. If I recall, older versions of iMovie would import video into separate events for each day. Then I would go through and give each event a meaningful name (e.g., "Mary's Birthday").
    This is what I would like. Is there a way to split this very long event into multiple events, one for each day that is present in the event?

    Not automatically but with imovie 10 you can create new events with any name you like then move clips into them from other events  (Just like FCP 10.1).   See:
    http://help.apple.com/imovie/mac/10.0/#mov1d890f00b
    You can also choose to display clips in an event grouped by date.
    Geoff

  • Multiple events per date with only one photo each - Unwanted

    I have the eyefi wireless sd card in my camera and it is setup to transmit my photos into iphoto automatically, which it does. However, the problem arises in that iphoto creates multiple events for the same date each containing only one photo. I would prefer that iphoto create individual events per date and have the multiples of that date's photos within. I thought I had the settings configured to do so as I have preferences set for autosplit events one per day but I still see events such as - July 3, 2008 - July 3, 2008 - July 3, 2008 - each with only one photo inside.
    I am wondering if it is something in iphoto's settings or the way in which eyefi transmits the photos into iphoto.
    Any thoughts?

    I do not have a WiFi connection to my camera so can not test but am just guessing
    I can think of two possibilities
    - 1 - if you are taking the photos with the WiFi connected then each time you snap a photo it may be being sent which would be looked at as a new import and therefore create a new event - to stop this I believe you would have to not have a full time WiFi connection to your camera or somehow set the camera to send batched - not each one - iPhoto will take each batch into and follow the rules for making events for that batch even if you camera is sending many batches of One photo
    - 2 - You have the preference for making batches set to one every two hours and there is a long time between photos - I'm guessing that #1 is more likely
    LN

  • CUOM 2.3 sends multiple notifications for Event StoppedGSUPerformancePolling with same time stamps

    Hi Alll,
    I have a CUOM Version 2.3 which shows mutiple notifications per Device for Event StoppedGSUPerformancePolling with same time stamps. The message below is generated from the default All_Events for all devices.
    Does anyone have a solution for that.
    Regards Michael
    This message is generated 8 times with the same time stamp in all messages.
    ** This message is generated from Cisco Unified Operations Manager **
    ALERT ID                = 00012OW
    CREATION TIME           = Sat 30-Oct-2010 16:31:57 CEST
    MODIFIED TIME           = Sat 30-Oct-2010 17:00:58 CEST
    STATUS                  = Active
    SEVERITY                = Critical
    MANAGED OBJECT          = 183.201.141.193
    MANAGED OBJECT TYPE     = VoiceGateway
    ASSOCIATED EVENTS       =
        Cleared:183.201.141.193:Unresponsive
        Active:183.201.141.193:StoppedGsuPerformancePolling
    CUSTOMER IDENTIFICATION = Voice Port
    CUSTOMER REVISION       = Voice Port

    if you get SNMP timeout on multiple devices then the fault usually lies in the path that the polling follows to get to these devices and back to the server.
    The problem obviously lies in the part path they have in common.
    It is not unusual to see the highest backbone loads during the night, due to backups being taken.
    Make sure the most important inter-switch links have no errors.
    I would rather fix this then turn off alerting.
    Cheers,
    Michel

  • All the Event receivers getting fired in SharePoint 2010 Event receiver Solution

    Hi friend.
    I have two event receivers. both are deployed as Farm Solution with Site as scope.
    ER1=> This event receiver is attached to Form Library and I have changed it's URL in Element.xml ListUrl as Listurl="TimeLog/Forms"
    ER2=> This event receiver is attached to Custom list and I have changed its Url in Element.xml as ListUrl="Lists/MyList"
    Both the Event receiver have ItemUpdated Event
    Here TimeLog is name of Form Library where I log time and MyList is name of custom list.
    Event Receivers are deployed to my Root site but I have page to redirect to other site collection which are under root site which contains my list and library. (Note: I dont have any list and library on my root site)
    Http://myportal/
    and I have other site collections
    http://myportal/sites/A
    http://myportal/Sites/B and so on..
    When I activate both the Event Receiver feature in SiteCollection "A" and updates some value in myList both the event receiver get fired and logs are generate.
    Can some one help me out to get only relevant event receiver get fired.  
    Thanks & Regards
    Gireesh Painuly

    Thanks all for your response.
    I identified the problem but did not find any solution. I would like to elaborate my requirement in detail:
    1- My Site collection structure is as below
    a. http://SP13/  => my root site as team site
    b. http://SP13/Sites/Client1
    c. http://SP13/Sites/Client 2    ..... and so on.. with same URL pattern.  
    1- I have created a SharePoint 2014 Empty SharePoint solution as Farm solution ( Because I have multiple site collection in a web application which perform same operation but belong to different clients)
    2- I added two Event Receivers in in this solution name ER1 and ER2
    3- I created two features ER1-Feature and ER2-Feature these feature contain related ER1(ER1-Feature) and ER2(ER2-Feature) i.e one feature contains ER1 and another feature contains ER2. Both of these features have scope=Site because I don't have any list
    and library at Root site that's why scope has not set to Web level.
    4. I created two list ERList1 and ERList2 for respected ER's i.e ERList1 for ER1 and ERList2 for ER2
    5. Both ER1 and ER2 has two methods ie. Item was Added and Item was Updated. I have just written code in these methods to create a text file to check which event receiver get called. I am not updating any list or library in these event.
    6. While creating Event Receiver I have selected Custom List as the source for triggering Event. but I modified Element.xml file of both the Receiver as below:
       A. ListUrl="Lists/ERList1" => in ER1 for ERList1 List
       B. ListUrl="Lists/ERList1" => in ER2 for ERList2 List.
    7. I Deployed my Solution to my root site ie Http://SP13/
    8. Now when I go to http://SP13/Sites/Client1 and open the ErList1. after adding a record in this list.. I get two log files generated in my drive that is ER1Executed.txt and ER2Executed.txt ( These files are generated by code which I have written in my
    ItemAdded and ItemUpdated methods of both ER1 and ER2 respectively
    9. Same two files are generate if i add any itme in ERList2 as well.
    10. But I identified it by creating both of these list at my root site to check whether tow file get created or not. but here it works fine just creates respected file. it means on related event receiver get fir as it should.
    So conclusion: 
    when Event receiver is activated in http://SP13/Sites/Client1 it creates two files mens ER is not able to find the list url properly. because in child site collection url get changed
    http://SP13/sites/client1/Lists/Erlist1
    How can I fix the URL in Element.xml so that related Event Receiver gets fired. I have multipla project in same Url pattern so that solution is deployed as Farm.
    Thanks 
    Gireesh Painuly

  • Multiple event handlers registered for the same event and error when adding users to sec groups

    Project Server 2013 CU April (May) 2014
    I've created and installed two event handlers (separate dll:s) and both are triggering on Project Published - initially, both are working fine.
    After an IISReset, trying to create a new security group (or add a user to an existing group) will result in an error on the page and a corresponding error in the ULS log - the latter indicating an error in the method security.creategroups, and specifically
    a problem 'An item with the same key has already been added.'
    An SQL trace reveals a break in execution after executing the proc 'pub.MSP_ADMIN_ReadEventReceivers' which returns all registered event handlers.
    In my case, the result of that proc execution shows that there are two event handlers registered with an EVENT_ID of 53 (Project Published) and with ORDER_FIRED set to 1 and 2 respectively.
    I tried removing one of the event receivers using the Central Admin PWA interface and then everything worked just fine - I added the event receiver back again, and everything STILL worked! IISReset and I got the error back again. :-(
    Since there's obviously some problem with reading multiple entries from that table regardless of the ORDER_FIRED differentiation, I tried temporarily modifying one of the '53' entries in the table directly and then the sec group was created just fine!
    I would like to know if anyone else has seen this? I've seen this on three separate installations now after deploying a second event listener onto those systems.
    /Lars Hammarberg
    //Lars Hammarberg www.connecta.se

    Hi Lars,
    yes I have seen the same issue. It is not related to April CU. I had the error before with SP1.
    It is not only an issue with the security groups. At least in our case nothing worked at all. No custom field editing, all Queue Jobs failing.
    For your case I suggest you consolidate your code in one eventhandler.
    Theory says that you can have more than 1 (up to 999) eventhandlers for one Event (http://msdn.microsoft.com/en-us/library/ms481079(v=office.12).aspx) but that seems not to
    work. Not sure, if it worked in earlier versions.
    Kind regards
    Christoph
    Christoph Muelder | Senior Consultant, MCTS, MCSE, MCT | SOLVIN information management GmbH, Germany

  • How to capture indexes of multiple rows selected in Advance list

    Hi,
    - I have a prefilled advance list with multiselection enabled.
    - There is a button, associated with an action,which is bind to a eventHandler,that event Handler has script operation which conains the ruby scrpt code.
    - Now when i select multiple rows of that advance list and click on the action,I want to capture the indexes of all the selected rows.
    I tried using following ruby code:
    lead=$data.datalist.LeadSelectedIndex
    But it returns index of only first row selected out of various rows selected.
    So please anyone help me on that.
    Regards ,
    Saurabh Sharma.

    In FP2.6 there is no chance from SDK to have a mass enabled Action and bind to a mulli selection list as a BO Action in the UI Designer, as multiplicity will always be single and only lead selection would be selected.
    this feature comes only in FP3.0.
    So i am not sure what excatly Saurabh wants to do : maybe do some calculations based on multi seletions then i would do the following as also what Christian mentioned
    multiSelect =  ($data.DataList.GetSelectedRowsCount() > 1);
    NoOfRowsSelected = $data.DataList.GetSelectedRowsCount();
    SummationField = 0;
    if ( multiSelect )
       LeadSelection = $data.DataList.LeadSelectedIndex;
       RequiredDataField = $data.DataList.Get(LeadSelection).AnydataField;
       for i in 0..(NoOfRowsSelected - 1)
         currentRow = LeadSelection + i;
          RequiredDataField = $data.DataList.Get(currentRow).AnydataField;
    // imagine this is just add values of the RequiredDataField
         SummationField = SummationField +   RequiredDataField
       end
    end
    So i have not tried this directly - but i hope i make the idea clear.
    Regards,
    Nitesh Pai

  • Multiple line selection in report list

    HI All,
    I have a requirment to display multiple line items with a checkbox prefixed, and i should be able to select multiple line items with the checkbox provided and should keep the selectd line items in an internal table(note the list is not ALG LIST or GRID)
    can anybody please tell me how to select multiple line items and and keep the selected items in a  in a normal report list.
    Regards

    Hii,
      Have a look at this sample code
    Report z_sdn.
    *" Data declarations...................................................
    * Work variables                                                      *
    DATA:
      BEGIN OF fs_spfli,
        carrid   LIKE spfli-carrid,        " Airline Code
        connid   LIKE spfli-connid,        " Flight Connection Number
        airpfrom LIKE spfli-airpfrom,      " Departure airport
        airpto   LIKE spfli-airpto,        " Destination airport
        deptime  LIKE spfli-deptime,       " Departure time
        arrtime  LIKE spfli-arrtime,       " Arrival time
      END OF fs_spfli,
      BEGIN OF fs_sflight,
        carrid   LIKE sflight-carrid,       " Airline Code
        connid   LIKE sflight-connid,       " Flight Connection Number
        fldate   LIKE sflight-fldate,       " Flight date
        seatsmax LIKE sflight-seatsmax,     " Maximum seats in economy class
        seatsocc LIKE sflight-seatsocc,     " Occupied seats in economyclass
      END OF fs_sflight,
      w_checkbox TYPE c,                    " Variable for checkbox
      w_currentline TYPE i,                 " Variable to display current
                                            " line
      w_lines TYPE i,
      w_read TYPE c .
    * Internal Table to hold flight schedule information                  *
    DATA:
      t_spfli LIKE
        TABLE OF
              fs_spfli.
    * Internal Table to hold flight information                           *
    DATA:
      t_sflight LIKE
          TABLE OF
                fs_sflight,
      t_sflight1 LIKE t_sflight.
    *    START-OF-SELECTION Event                                         *
    START-OF-SELECTION.
      PERFORM get_data_spfli.
    *    END-OF-SELECTION Event                                           *
    END-OF-SELECTION.
      SET PF-STATUS 'MENU'.
      PERFORM display_data_spfli.
    *    TOP-OF-PAGE Event                                                *
    TOP-OF-PAGE.
      PERFORM header_table_spfli.
    *    AT LINE-SELECTION EVENT                                          *
    AT LINE-SELECTION.
      SET PF-STATUS space.
      IF sy-lsind EQ 1 AND sy-lilli GE 4.
        PERFORM get_data_sflight.
        PERFORM display_data_sflight.
        PERFORM flag_line.
      ENDIF.                               " IF sy-lsind EQ 1..
    *    AT USER-COMMAND                                                  *
    AT USER-COMMAND.
      IF sy-lsind EQ 1.
        SET PF-STATUS space.
        CASE sy-ucomm.
          WHEN 'DISPLAY'.
            PERFORM get_data_sflight1.
            PERFORM display_data_sflight.
          WHEN 'SELECTALL'.
            PERFORM select_all.
            PERFORM flag_line.
          WHEN 'DESELECTAL'.
            PERFORM deselect_all.
            PERFORM flag_line.
        ENDCASE.                           " CASE sy-ucomm
      ENDIF.                               " IF sy-lsind EQ 1
    *    TOP-OF-PAGE DURING LINE-SELECTION                                *
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM sec_list_heading.
    *&      Form  get_data_spfli
    *  This subroutine fetches the data from SPFLI
    * This subroutine does not have parameters to pass
    FORM get_data_spfli .
      SELECT carrid                        " Airline Code
             connid                        " Flight Connection Number
             airpfrom                      " Departure airport
             airpto                        " Destination airport
             deptime                       " Departure time
             arrtime                       " Arrival time
        FROM spfli
        INTO TABLE t_spfli.
    ENDFORM.                               " GET_DATA_SPFLI
    *&      Form  display_data_spfli
    * This subroutine displays the data of SPFLI
    * This subroutine does not have parameters to pass
    FORM display_data_spfli .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE: /02 w_checkbox AS CHECKBOX,
                05 w_read,
                   fs_spfli-carrid UNDER text-001,
                   fs_spfli-connid UNDER text-002,
                   fs_spfli-airpfrom UNDER text-003,
                   fs_spfli-airpto UNDER text-004,
                   fs_spfli-deptime UNDER text-005,
                   fs_spfli-arrtime UNDER text-006.
        HIDE:
          fs_spfli-carrid,
          fs_spfli-connid.
      ENDLOOP.                             " LOOP AT t_spfli..
    ENDFORM.                               " DISPLAY_DATA_SPFLI
    *&      Form  header_table_spfli
    * This subroutine diplays the headings of table spfli
    * This subroutine does not have parameters to pass
    FORM header_table_spfli .
      WRITE: /10 text-001 COLOR 4,
              25 text-002 COLOR 4,
              40 text-003 COLOR 4,
              55 text-004 COLOR 4,
              70 text-005 COLOR 4,
              85 text-006 COLOR 4.
    ENDFORM.                               " HEADER_TABLE
    *&      Form  get_data_sflight
    * This subroutine fetches the data from SFLIGHT
    * This subroutine does not have interface parameters to pass
    FORM get_data_sflight .
      SELECT carrid                        " Airline Code
             connid                        " Flight Connection Number
             fldate                        " Flight date
             seatsmax                      " Maximum seats in economy class
             seatsocc                      " Occupied seats in economyclass
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid EQ fs_spfli-carrid
         AND connid EQ fs_spfli-connid.
    ENDFORM.                               " GET_DATA_SFLIGHT
    *&      Form  display_data_sflight
    * This subroutine displays the SFLIGHT data
    * This subroutine does not have interface parameters to pass
    FORM display_data_sflight .
      LOOP AT t_sflight INTO fs_sflight.
        WRITE: / fs_sflight-carrid UNDER text-001,
                 fs_sflight-connid UNDER text-002,
                 fs_sflight-fldate UNDER text-007,
                 fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
                 fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
      ENDLOOP.
        CLEAR: fs_sflight.
    ENDFORM.                               " DISPLAY_DATA_sflight
    *&      Form  sec_list_heading
    *  This subroutine diplays the headings of table spfli
    * This subroutine does not have interface parameters to pass
    FORM sec_list_heading .
      WRITE: /2 text-001 COLOR 4,
             15 text-002 COLOR 4,
             33 text-007 COLOR 4,
             45 text-008 COLOR 4,
             60 text-009 COLOR 4.
    ENDFORM.                               " SEC_LIST_HEADING
    *&      Form  get_data_sflight1
    * This subroutine displays the data from SFLIGHT according to checkbox
    * clicked.
    * This subroutine does not have interface parameters to pass
    FORM get_data_sflight1 .
      DATA:
        lw_checkbox TYPE c.
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = 3 + sy-index.
        CLEAR:
          w_checkbox,
          fs_spfli.
        READ LINE w_currentline FIELD VALUE
          w_checkbox INTO lw_checkbox
          fs_spfli-carrid INTO fs_spfli-carrid
          fs_spfli-connid INTO fs_spfli-connid.
        IF sy-subrc EQ 0.
          IF lw_checkbox EQ 'X'.
            SELECT carrid                  " Airline Code
                   connid                  " Flight Connection Number
                   fldate                  " Flight Date
                   seatsmax                " Max Seats
                   seatsocc                " Occupied Seats
              FROM sflight
              INTO TABLE t_sflight1
             WHERE carrid EQ fs_spfli-carrid
               AND connid EQ fs_spfli-connid.
            IF sy-subrc EQ 0.
              APPEND LINES OF t_sflight1 TO t_sflight.
            ENDIF.                         " IF sy-subrc EQ 0.
          ENDIF.                           " IF lw_checkbox EQ 'X'
        ENDIF.                             " IF sy-subrc EQ 0.
      ENDDO.                               " DO w_lines TIMES
    ENDFORM.                               " GET_DATA_SFLIGHT1
    *&      Form  select_all
    * This subroutine selects all the records of SPFLI
    * This subroutine does not have interface parameters to pass
    FORM select_all .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = sy-index + 3.
        READ LINE w_currentline FIELD VALUE
        w_checkbox INTO w_checkbox.
        IF sy-subrc = 0.
          MODIFY LINE w_currentline FIELD VALUE
          w_checkbox FROM 'X'.
        ENDIF.                             " IF sy-subrc = 0.
      ENDDO.                               " DO lw_line TIMES.
    ENDFORM.                               " SELECT_ALL
    *&      Form  deselect_all
    * This subroutine deselects all the records of SPFLI
    * This subroutine does not have interface parameters to pass
    FORM deselect_all .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = sy-index + 3.
        READ LINE w_currentline FIELD VALUE
        w_checkbox INTO w_checkbox.
        IF sy-subrc = 0.
          MODIFY LINE w_currentline FIELD VALUE
          w_checkbox FROM ' '.
        ENDIF.                             " IF sy-subrc = 0.
      ENDDO.                               " DO lw_line TIMES.
    ENDFORM.                               " DESELECT_ALL
    *&      Form  flag_line
    * This subroutine flags the line which has been read
    * This subroutine does not have interface parameters to pass
    FORM flag_line .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_checkbox = 'X'.
        READ LINE sy-lilli FIELD VALUE
          w_read INTO w_read
          w_checkbox INTO w_checkbox.
        IF sy-subrc EQ 0.
          MODIFY CURRENT LINE
          FIELD FORMAT w_checkbox INPUT OFF
          FIELD VALUE w_read FROM '*'.
        ENDIF.                             " IF sy-subrc EQ 0
      ENDDO.                               " DO w_lines TIMES
    ENDFORM.                               " FLAG_LINE
    Regards
    Abhijeet

Maybe you are looking for