ALV OOP- Catching the event when the user clicks a cell

Hi Experts,
i have 2 alvs to display using custom containers, now the problem is that i need to make some lines uneditable and some lines editable. On making this i find that ALV does not offer this functionality of selective editable rows, right? I offered a workaround by just popping an error message if a user clicks a row which suppose to be disabled/uneditable. My problem is that how can i catch the single click event in ALV using OOP?
Thanks to replies and points will be given...

hi,
hope this helps.
creating Editable Cells in ALV
Making a column editable in ALV:
IT_FIELDCAT is an internal table which has the structure of the data to be displayed. Each row in this internal table creates a column in ALV. The fieldcat structure has an optional field u2018EDITu2019 which is not required to be passed all the time. By default the column is non-editable. If the value of the field EDIT is u2018Xu2019, that column becomes editable in the display.
Example:
  wa_fieldcat-fieldname = 'CHECK'.
  wa_fieldcat-edit      = 'X'.
  wa_fieldcat-coltext   = 'Delete'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.
The column DELETE in the ALV display is editable. The corresponding output internal table field name is CHECK.
Making individual cells editable or non-editable:
1.     Include an internal table of type lvc_t_styl in the output internal table (as a field) of the ALV. This inner table is like other output fields of the internal table.
Example:
TYPES: BEGIN OF tt_project,
            check TYPE c,
            status(132) TYPE c,
            it_styletab TYPE lvc_t_styl.       
TYPES: END OF tt_project.
2.     This inner internal table controls the style of each cell in the row of the output internal table.
3.     Same like other fields of the output internal table, this style table (inner internal table) should be filled for each row of the table.
4.     The structure of the output internal table.
CHECK     STATUS     IT_STYLETAB
X     ABC     Fieldname     Style
CHECK     Non-editable(MC_STYLE_DISABLED)
STATUS     editable(MC_STYLE_ENABLED)
     CDF     Fieldname     Style
     Non-editable(MC_STYLE_DISABLED)
      wa_stylerow-fieldname = u2018CHECKu2019. -
> Optional
      wa_stylerow-style =  cl_gui_alv_grid=>mc_style_disabled. (Non-editable)
      or
      wa_stylerow-style =  cl_gui_alv_grid=>mc_style_enabled.  (Editable)
      Append wa_stylerow to wa_project-it_styletab.
     Wa_stylerow is a work area for IT_STYLETAB.
       Wa_project is work area for output internal table.
5.     Refresh the inner internal table for each row in outer internal table.
6.     If the fieldname is not provided for the style internal table, the entire row becomes editable or non-editable.
7.     This provides the ability to enable input for a cell dynamically.
8.     The layout of the ALV Grid should also be changed in order to achieve this. The layout has a parameter, u2018STYLENAMEu2019. The name of the style internal table should be given as the value for this field. The layout should be passed in SET_TABLE_FOR_FIRST_DISPLAY.
     Example:
     wa_layout-stylefname = 'IT_STYLETAB'.
reward if useful.
regards
srishti

Similar Messages

  • ALV: OOPS: How to identify when the BACK button is hit?

    Hi All,
    I have a requirement in which when the BACK button on the ALV output is hit, i have to leave to the Original Selection Screen.
    I know that using SET SCREEN 0. this can be done. But i'm unable to find the point at which the Event about the BACK button is triggered.
    How can i identify if the button hit was the back button?
    Thanks in advance,
    Jr.

    Hi Jr,
    u declare sy-ucomm in data decla.
    in code try this out.
    Case sy-ucomm.
    when 'BACK'.
    leave to screen#. " # For the selection screen (i dnt think it is 0).
    u obviously have to set the PF status for the same by SE41 and in Aplication, u give name as BACK for the back symbol.
    I hope is will help.
    Reward if useful
    Thanks
    Sujay

  • How to catch an event when the user change values in the project information dialog

    hi,
    i would like to know how to catch an event in my C# code when the user change values in the project information dialog?
    taskChange doesn't catch these changes.
    thanks.
    Thanks, Sharon.

    You need to write save button event handler for project information dialog. Link is having same functionality described. 
    http://blogs.msdn.com/b/husainzgh/archive/2011/08/01/hooking-into-the-project-detail-page-ribbon-save-button-without-overriding-out-of-box-functionality-in-project-web-access-for-project-server-2010.aspx
    http://www.projectserver2010blog.com/2010/01/sharepoint-2010-webpart-client-server.html
    kirtesh

  • Is there a way to detect the event when device goes to sleep and the screen blackens?

    I want to detect the event when the iOS device goes to sleep and the screen blackens?
    Is there any way to do it?

    Hi,
    A small idea, please check whether it will work or not.
    You can achieve this by using combination of DNS server and reverse proxy server.( Customized apache). Make 'A' record for www.abcd.com to reverse proxy server IP address in your DNS.
    So it will resolve your reverse proxy IP address for requests.
    Configure appche to accept incoming request for www.abcd.com and points towards www.abcd.com/parameters.
    I think this will solve your problem.  Only one condition is that proxy server will communicate with www.abcd.com on behalf of client.
    Follow the link for configuration of reverse proxy server
    http://www.slashroot.in/how-configure-basic-apache-reverse-proxy
    HTH
    Naisam

  • How can flex tell if  it's a mouseup event when the user releases the mouse button outside the flex application?

    how can flex tell if it's a mouseup event when the user
    releases the mouse button outside the flex application? Say for
    instance mousedown was done within a 500x500 embedded flex app but
    mouseup is outside or relased on the HTML background. One more
    thing, when we have something draggable, Flex doesn't execute the
    stopDrag() when the user releases the mouse button outside the
    embedded swf or fles app. Pls. help me with this. Thanks!

    I don't think the flex app can tell what happens outside the
    app. But it can detect when it leaves the app, so I have found the
    following line works fine inside initApp():
    this.stage.addEventListener(Event.MOUSE_LEAVE, yourFunction);
    and you have to:
    import flash.display.Stage;
    Doug

  • How to handle event when the user closing the browser (Urgent Please)

    Hi,
    How to handle the event when user closes the browser....
    i want to display some alter message when user trying to close the browser...
    Please can any one help me how i have to do this...........
    Thanks.

    Finally got this working. You cannot use the stop() or destroy methods. By the time they are called all database connections are gone and you will get a null pointer exception.
    You will have to use the onBeforeUnload method in the html file that calls the applet and use JavaScript to call the save method in java which saves the document:
    <SCRIPT LANGUAGE="JScript" TYPE="text/javascript">
    function Save()
    //i call the applets doSave() method from here in which i save all
    //changes to the database
    top.Tree.document.TestApplet.doSave();
    //this will invoke the default IE message for closing the window
    //when user clicks on the x in the browser
    message = "Your document has been saved."
    return message;
    window.onbeforeunload=Save;
    </SCRIPT>
    //the applets doSave()
    public void doSave()
    //this frame provides user with the message that document is being
    //saved
    final JFrame frame = new JFrame("Saving");
    JPanel contentPane = new JPanel();
    JLabel label = new JLabel(" Please wait, saving document...");
    frame.getContentPane().add(label,BorderLayout.CENTER);
    frame.setSize(250, 100);
    frame.setLocation(300, 400);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter()
    //the frame is just for user's information, so prevent user from
    //closing it or iconifying it.
    public void windowClosing(WindowEvent e)
    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    public void windowIconified(WindowEvent e)
    frame.setState(frame.NORMAL);
    //call my saveDocument() method that saves everything to the database.
    editorModule.saveDocument();
    //System.out.println("finished calling saving document");
    //once the saving is done the frame with the message disappears
    frame.setVisible(false);
    //System.out.println("setting frame to false");
    //I also had an exit button in my applet, that would perform the same task, however now with the above onBeforeUnload method, the exit message would appear twice, so had to modify my exit button action performed, so that if the exitbutton was clicked the onbeforeunload method would get passed a null value and not do anything.
    private void exitButton_actionPerformed()
    if (DEBUG) System.out.println("Calling exit");
    doSave();
    window.eval("this.onbeforeunload=null;");
    window.eval("top.close();");
    //continue from here if user cancels the closing of the window
    window.eval("this.onbeforeunload=doSave;");
    window.eval("top.focus()");
    window.eval("document.TestApplet.requestFocus()");
    homePanel.requestFocus();
    }

  • How to deal with the mouse events when the thread is running

    Hi everybody,
    I have a problem with my program.
    Now I want to present a picture for some time in the Canvas,then automatically clear the screen, but when the user press the mousebutton or keybutton, I want to stop the thread and clear the screen.
    How can I receive the mouse event when the thread is running?
    Thanks,

    I use my code in a GUI applet.
    I try to use the code tag, it's the first time.
                   Image im=sd.getStimulus(obj);
                   if(pos==null){
                        g.drawImage(im, (w-im.getWidth(null))/2,(h-im.getHeight(null))/2,null);
                   }else{
                        g.drawImage(im, pos.x,pos.y,pos.w,pos.h,null);
                   try{
                        sleep(showtime);
    //                    Thread.sleep(showtime);
                   }catch(InterruptedException e){}
                   if(pos==null){
                        g.clearRect((w-im.getWidth(null))/2,(h-im.getHeight(null))/2,im.getWidth(null),im.getHeight(null));
                   }else{
                        g.clearRect(pos.x,pos.y, pos.w, pos.h);
                   }

  • Wmi script to find out the time when the user was added to local administration group

    Hi Friends,
    i need a script/query based on wmi/wql that find out the time when the user was added to local administration group on this computer
    Regards
    Tanoj
    OSLM ENGINEER - SCCM 2007 & 2012

    WMI does not keep security information.
    Unless you have enabled auditing, this information is not retained in any way.
    If auditing is enabled, you can write a powershell script to look for the specific event in the eventlog. More specifically, you should look for all security events with id 4732 containing the group.
    this one command does the trick
    get-eventlog -logname security -instanceid 4732 -message *administrators*
    https://technet.microsoft.com/en-us/library/dd772663(v=ws.10).aspx
    MCP/MCSA/MCTS/MCITP

  • When I open up iphoto and click on the events tab then double click on an event, it used to show minis of all the photos in that event.  Now it shows only one photo at a time.  How do I get it back? Can you help?

    When I open up iphoto and click on the events tab then double click on an event, it used to show minis of all the photos in that event.  Now it shows only one photo at a time.  How do I get it back? Can you help?

    On the bottom bar of the window (on the left iPhoto 11, on the right in other versions) note the slider. Drag it left.
    Regards
    TD

  • I like to start my morning by looking at my email first thing in the morning  it helps my brain get jumpstarted and gives me a jump on the events of the day.I keep my iPhone encased in an Otter Box. Will this help protect it from steam when I take shower?

    I like to start my morning by reading my emails that came in during the night. This jumpstarts my brain and gives me an edge on the events of the day. Since my wife is still asleep when I get up I do this in the bathroom while I'm getting ready. I keep my iPhone 4 encased in an Otter Box case. Will this protect the phone from steam damage or should I thow it in a drawer while I take a short shower?

    TMI dude.
    You should be asking this to Otterbox but I'm guessing it depends on the specific Otterbox case... check the case specs at Otterbox.
    IMO, I would just leave it outside the bathroom... I'm sure your email can wait a few extra minutes.

  • The new event are created when i import photo in the top. Before they where put in the end. All my event are classified. Where i can set the event at the end ? Thank's.

    The new event are created when i import photo in the top.
    Before they where put in the end.
    All my event (around 600) are classified on the top the old and a the end the new.
    Where i can set the event at the end ?
    Thank's.

    View menu  ==> sort events
    LN

  • [svn:fx-trunk] 11112: DatGroup and SkinnableDataContainer dispatch a " dataProviderChanged" event when the dataProvder changes.

    Revision: 11112
    Author:   [email protected]
    Date:     2009-10-23 12:35:31 -0700 (Fri, 23 Oct 2009)
    Log Message:
    DatGroup and SkinnableDataContainer dispatch a "dataProviderChanged" event when the dataProvder changes.  Fixed a ScrollerLayout typo.
    QE notes:
    Doc notes: none
    Bugs: sdk-23489
    Reviewer: Ryan
    Tests run: DataGroup
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/sdk-23489
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGroup.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayo ut.as

  • I am really having a horrible time when trying to do our Church announcements in FCP X. When I try to take a clip from the event to the timeline my clips expanded and my timeline zoom level does not stay in the original place. Help

    I am really having a horrible time when trying to do our Church announcements in FCP X. When I try to take a clip from the event to the timeline my clips expanded and my timeline zoom level does not stay in the original place it moves to the right and is max out which makes every clip that I bring to the timeline expanded.

    What format etc. are the video clips and what were they shot on?
    Before you do anything else, trash the preferences with this free app:-
    http://www.digitalrebellion.com/prefman/

  • How to Unload the form when the user presses Escape Key

    Hi all
    I have tried several triggers for unloading the form when the user presses escape key,but none of them worked. Could any body give the trigger name and the code that unloads or closes the form when the user presses escape key.

    Hello,
    Change the EXIT entry of you ressource file:
    27   : 0 : "F4"             : 32 : "Exit"Francois

  • How to find the date when the users has been created in Hyperion Essbase

    Please let me know, if there is any option or way to find the date when the users has been created in Hyperion.
    Essbase - 9.3.1.0.0
    Sun Solaris SPARC (32-bit) - 5.8
    If not in Hyperion, could you please let me know if it gets stored in the repository. If yes, please let me know the table name in Oracle.

    I don't know of a way of getting this information from Shared Services via the standard web UI. However you can see when a native user was created in openLDAP. If your users are all native then you can use an ldap browser to view the CreateTimestamp.
    Port: 58089
    User DN:CN=911,ou=People,dc=css,dc=hyperion,dc=com
    Password: Your shared services admin user password
    You should see each new native user under the ou=People and each CN will have a create timestamp.
    I can't help if all you users are external or your using the old Essbase native security.
    Gee

Maybe you are looking for

  • Problem with CS5.5 installation on Windows 7

    Hello, I have problem to reinstall CS5_5 on windows Seven I download the source and uncompress on CS5.5\DesignStandard_CS5_5_LS4\Adobe CS5_5 I start the Setup.exe and, after enter serial number and start installation I have exit code 7 Exit Code: 7 -

  • Album By Year -- and month? (Sorting when an artist has 2 albums in 1 year)

    I love having my music collection sorted by Artist and within Artist by Album by Year. This effectively presents each artists' entire catalogue as a set, with each album in the order of release date. Perfect. But what if an artist releases more than

  • How do I lock the number of posts per page?

    I am getting very tired of switching from 30 posts per page to 15 posts per page every time I select a "community". I have not found any place to specify that I always want 15 posts per page. Did I miss it or is it not there? Just for the record, I h

  • My In Design Pages Have Disappeared

    I am creating a multi-page In Design document.  One spread has disappeared.  I cannot delete the pages.  I cannot do anything on the pages.  The objects on the pages seem to still be there/somewhere - they still appear on the Links panel which indica

  • Help! Attempted CCFL replacement, now light shuts off randomly

    My wife's Pismo came down with pink screen a few weeks ago. I found a few posts on here about replacing the CCFL, and since I'm pretty technically adept and I've done plenty of soldering and read through the walkthrough posted here: http://www.macopi