<?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: Event before_user_command with editable alv in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225104#M137648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I still don't see a resolution to this problem.  I too want when a user selects to Delete Row, to edit and ensure that the record can be deleleted.  In my situation, if the record has been processed by payroll, we don't want to allow the user to delete the row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do we simply not use the before_user_command?  If not then the only other option I see is define my own buttons and clone the code from the objects clear_selection method and bastardize it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There has to be a simpler way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Aug 2006 19:30:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-28T19:30:09Z</dc:date>
    <item>
      <title>Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225081#M137625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt; The situation is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an editable alv, built with ALV GRID class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually I use the events BEFORE_USER_COMMAND with no problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I see that with editable alv, using the DELETE button (of a row of alv) the event isn't raised?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do anyone why and how can solv this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanls in advantage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:03:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225081#M137625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225082#M137626</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;Check this Example Program&amp;lt;b&amp;gt; BCALV_EDIT_04&amp;lt;/b&amp;gt; for delete and append Rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225082#M137626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225083#M137627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have u put the SET HANDLER statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also u need to register for data_changed event&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Hymavathi Oruganti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:18:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225083#M137627</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2006-03-02T10:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225084#M137628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;I've seen the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there is no way to raise the any events at the DELETE button neither the data_change event is raised by this button&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;enzo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:20:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225084#M137628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225085#M137629</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;implement the delete functionality with your own delete button ,then you can easily track the user actions with handle_user_command event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Laxman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:25:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225085#M137629</guid>
      <dc:creator>Laxmana_Appana_</dc:creator>
      <dc:date>2006-03-02T10:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225086#M137630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hymavathi Oruganti &lt;/P&gt;&lt;P&gt;yes, I put the set handler statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to make a copy of BCALV_EDIT_01 and adding the event handler class but nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;enzo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:26:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225086#M137630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225087#M137631</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;it should be done in the data_changed event. when ever you delete any entry it should trigger, i don't think you have implemented it properly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you show you local class definiton, and implementation, i am assuming that you have set the handlers for all the events..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:32:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225087#M137631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225088#M137632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;I have tried it but I prefer using the standard functionality.&lt;/P&gt;&lt;P&gt;maybe your's the finaly solution.&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Enzo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:32:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225088#M137632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225089#M137633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;it's my code.&lt;/P&gt;&lt;P&gt;i did a copy of BCALV_EDIT_01 and I added this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
THE CLASS DEFINITION AND IMPLEMENTATION.
*----------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
  PUBLIC SECTION.
    DATA: deleted_rows TYPE STANDARD TABLE OF za0014.
    METHODS:
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
               IMPORTING e_ucomm,
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
               IMPORTING e_object,
        handle_before_user_command
            FOR EVENT before_user_command OF cl_gui_alv_grid
               IMPORTING e_ucomm,

        handle_data_change
            for event data_changed of cl_gui_alv_grid
               importing e_ucomm.

ENDCLASS.                    "lcl_event_handler DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.

  METHOD handle_toolbar.
      break-point.
  ENDMETHOD .                    "handle_toolbar

  METHOD handle_user_command .
      break-point.
  ENDMETHOD.                    "handle_user_command

  METHOD handle_before_user_command .
     break-point.
  ENDMETHOD .                    "handle_before_user_command

  METHOD handle_data_change .
   break-point.
  ENDMETHOD .                    "handle_before_user_command
ENDCLASS.                    "lcl_event_handler IMPLEMENTATION

data event type ref to lcl_event_handler.



-------------------------
-------------------------
THE SET HANDLER STATEMENT
create object event.
 SET HANDLER event-&amp;gt;handle_toolbar FOR g_grid .
  SET HANDLER event-&amp;gt;handle_user_command FOR g_grid .
  SET HANDLER event-&amp;gt;handle_before_user_command FOR g_grid .
  set handler event-&amp;gt;HANDLE_DATA_CHANGE FOR G_GRID.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 10:57:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225089#M137633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T10:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225090#M137634</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;use the logic from &amp;lt;b&amp;gt;BCALV_EDIT_04&amp;lt;/b&amp;gt; not&amp;lt;b&amp;gt; BCALV_EDIT_01&amp;lt;/b&amp;gt;. and try...BCALV_EDIT_04 this is having functionality of addition and deletion of rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 11:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225090#M137634</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T11:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225091#M137635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u didnt copy REGISTER?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD GO_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD GO_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_enter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 11:27:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225091#M137635</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2006-03-02T11:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225092#M137636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not know if anybody will read this since the topic has been answered however I just tried the example with the additions mentioned in the last post and it does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has the issue really been answered?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 11:09:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225092#M137636</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T11:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225093#M137637</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;tell me what you did exactly....? and give more inputs..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Vijay Babu Dudla&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 11:18:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225093#M137637</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T11:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225094#M137638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As described in the topic I copied the SAP program and made the changes and additions as mentioned in the topic. Regretfully it did not give the expected result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dennis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Copy of my program:&lt;/P&gt;&lt;P&gt;PROGRAM BCALV_EDIT_01.&lt;/P&gt;&lt;P&gt;*&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Purpose:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;~~~~~~~~&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This report illustrates the simplest case of using an&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;editable ALV Grid Control.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Background:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;~~~~~~~~~~~&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;As far as the edit feature is concerned&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;a cell of the alv grid control can have the following states:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   1.non-editable : edit feature not set for this cell&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   2.editable     : edit feature set for this cell&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The second state ("editable") has two substates:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   2a.editable deactivated : edit feature set but not active&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   3b.editable activated   : edit feature set and active&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;In this example, all cells are set "editable".&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;You switch between "editable deactivated" and "editable activated"&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;using method SET_READY_FOR_INPUT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To check program behavior&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Switch the state using the "Display/Change" icon. Initially,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the whole grid is in state "editable and deactivated".&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;After switching the state you may change values and enter new&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;lines. No semantic checks are made in this example.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Essential steps (search for '§')&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;~~~~~~~~~~~~~~~&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;1.Set status of all cells to editable using the layout structure.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;2.Use SET_READY_FOR_INPUT to deactivate the edit feature initially.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  (state "editable deactivated").&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;4.Use SET_READY_FOR_INPUT to switch between the substates.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ok_code LIKE sy-ucomm,&lt;/P&gt;&lt;P&gt;      save_ok like sy-ucomm,&lt;/P&gt;&lt;P&gt;      g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',&lt;/P&gt;&lt;P&gt;      g_grid  TYPE REF TO cl_gui_alv_grid,&lt;/P&gt;&lt;P&gt;      g_custom_container TYPE REF TO cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;      gs_layout TYPE lvc_s_layo,&lt;/P&gt;&lt;P&gt;      g_max type i value 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_outtab type table of sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MAIN                                                          *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CALL SCREEN 100.&lt;/P&gt;&lt;P&gt;&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CLASS lcl_event_handler DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&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;CLASS lcl_event_handler DEFINITION.&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;*DATA: deleted_rows TYPE STANDARD TABLE OF za0014.&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;handle_user_command&lt;/P&gt;&lt;P&gt;FOR EVENT user_command OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;IMPORTING e_ucomm,&lt;/P&gt;&lt;P&gt;handle_toolbar&lt;/P&gt;&lt;P&gt;FOR EVENT toolbar OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;IMPORTING e_object,&lt;/P&gt;&lt;P&gt;handle_before_user_command&lt;/P&gt;&lt;P&gt;FOR EVENT before_user_command OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;IMPORTING e_ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*handle_data_change&lt;/P&gt;&lt;P&gt;*for event data_changed of cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;*importing e_ucomm.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;ENDCLASS. "lcl_event_handler DEFINITION&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CLASS lcl_event_handler IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&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;CLASS lcl_event_handler IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD handle_toolbar.&lt;/P&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;P&gt;ENDMETHOD. "handle_toolbar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD handle_user_command.&lt;/P&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;P&gt;ENDMETHOD. "handle_user_command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD handle_before_user_command.&lt;/P&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;P&gt;ENDMETHOD. "handle_before_user_command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*METHOD handle_data_change .&lt;/P&gt;&lt;P&gt;*break-point.&lt;/P&gt;&lt;P&gt;*ENDMETHOD . "handle_before_user_command&lt;/P&gt;&lt;P&gt;ENDCLASS. "lcl_event_handler IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data event type ref to lcl_event_handler.&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;*THE SET HANDLER STATEMENT&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;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MODULE PBO OUTPUT                                             *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE pbo OUTPUT.&lt;/P&gt;&lt;P&gt;  SET PF-STATUS 'MAIN100'.&lt;/P&gt;&lt;P&gt;  set TITLEBAR 'MAIN100'.&lt;/P&gt;&lt;P&gt;  IF g_custom_container IS INITIAL.&lt;/P&gt;&lt;P&gt;    CREATE OBJECT g_custom_container&lt;/P&gt;&lt;P&gt;           EXPORTING container_name = g_container.&lt;/P&gt;&lt;P&gt;    CREATE OBJECT g_grid&lt;/P&gt;&lt;P&gt;           EXPORTING i_parent = g_custom_container.&lt;/P&gt;&lt;P&gt;*§1.Set status of all cells to editable using the layout structure.&lt;/P&gt;&lt;P&gt;    gs_layout-edit = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select * from sflight into table gt_outtab up to g_max rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD g_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;         EXPORTING i_structure_name = 'SFLIGHT'&lt;/P&gt;&lt;P&gt;                   is_layout        = gs_layout&lt;/P&gt;&lt;P&gt;         CHANGING  it_outtab        = gt_outtab.&lt;/P&gt;&lt;P&gt;*§2.Use SET_READY_FOR_INPUT to deactivate the edit feature initially.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  (state "editable deactivated").&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;          EXPORTING i_ready_for_input = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    create object event.&lt;/P&gt;&lt;P&gt;    SET HANDLER event-&amp;gt;handle_toolbar FOR g_grid .&lt;/P&gt;&lt;P&gt;    SET HANDLER event-&amp;gt;handle_user_command FOR g_grid .&lt;/P&gt;&lt;P&gt;    SET HANDLER event-&amp;gt;handle_before_user_command FOR g_grid .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   set handler event-&amp;gt;HANDLE_DATA_CHANGE FOR G_GRID.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;    I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;    I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MODULE PAI INPUT                                              *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE pai INPUT.&lt;/P&gt;&lt;P&gt;  save_ok = ok_code.&lt;/P&gt;&lt;P&gt;  clear ok_code.&lt;/P&gt;&lt;P&gt;  CASE save_ok.&lt;/P&gt;&lt;P&gt;    WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;      PERFORM exit_program.&lt;/P&gt;&lt;P&gt;    WHEN 'SWITCH'.&lt;/P&gt;&lt;P&gt;      PERFORM switch_edit_mode.&lt;/P&gt;&lt;P&gt;    WHEN OTHERS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    do nothing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM EXIT_PROGRAM                                             *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM exit_program.&lt;/P&gt;&lt;P&gt;  LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  SWITCH_EDIT_MODE&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; --&amp;gt;  p1        text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &amp;lt;--  p2        text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM switch_edit_mode.&lt;/P&gt;&lt;P&gt;*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.&lt;/P&gt;&lt;P&gt;  IF g_grid-&amp;gt;is_ready_for_input( ) EQ 0.&lt;/P&gt;&lt;P&gt;*§4.Use SET_READY_FOR_INPUT to switch between the substates.&lt;/P&gt;&lt;P&gt;    CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;                     EXPORTING i_ready_for_input = 1.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;                     EXPORTING i_ready_for_input = 0.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM.                               " SWITCH_EDIT_MODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 11:28:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225094#M137638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T11:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225095#M137639</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;check this sample code, &lt;/P&gt;&lt;P&gt;and let me know what problem you faced? and what changes you made in std proram...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID,  "First
      G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
DATA: L_VALID TYPE C,
      V_FLAG,
      V_DATA_CHANGE,
      V_ROW TYPE LVC_S_ROW,
      V_COLUMN TYPE LVC_S_COL,
      V_ROW_NUM TYPE LVC_S_ROID.
DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
      G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
      GS_LAYOUT TYPE LVC_S_LAYO.

DATA:BEGIN OF  ITAB OCCURS 0,
     VBELN LIKE LIKP-VBELN,
     POSNR LIKE LIPS-POSNR,
     LFDAT like lips-vfdat,
     BOX(1),
     HANDLE_STYLE TYPE LVC_T_STYL,
     END OF ITAB.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                      IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Handler to Check the Data Change
    HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                         OF CL_GUI_ALV_GRID
                         IMPORTING ER_DATA_CHANGED
                                   E_ONF4
                                   E_ONF4_BEFORE
                                   E_ONF4_AFTER,
**Double Click Handler
    HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                     IMPORTING E_ROW E_COLUMN ES_ROW_NO.


ENDCLASS.                    "lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
  METHOD HANDLE_HOTSPOT_CLICK .
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW_ID.
    V_COLUMN = E_COLUMN_ID.
    V_ROW_NUM = ES_ROW_NO.
    MESSAGE I000 WITH V_ROW 'clicked'.
  ENDMETHOD.                    "lcl_event_handler

*Handle Double Click
  METHOD  HANDLE_DOUBLE_CLICK.
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW.
    V_COLUMN = E_COLUMN.
    V_ROW_NUM = ES_ROW_NO.

    IF E_COLUMN = 'VBELN'.
      SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.

    ENDIF.
    IF E_COLUMN = 'POSNR'.

      MESSAGE I000 WITH 'Click on POSNR row number '  E_ROW.
      "with this row num you can get the data
    ENDIF.
  ENDMETHOD.                    "handle_double_click
**Handle Data Change
  METHOD HANDLE_DATA_CHANGED.

    CALL METHOD G_GRID-&amp;gt;REFRESH_TABLE_DISPLAY
      EXCEPTIONS
        FINISHED = 1
        OTHERS   = 2.
    IF SY-SUBRC &amp;lt;&amp;gt; 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  ENDMETHOD.                    "HANDLE_DATA_CHANGED
ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;             Global Definitions
*&amp;amp;---------------------------------------------------------------------*
DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
            G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
            G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2



*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT,
      LS_VARI  TYPE DISVARIANT.

*---------------------------------------------------------------------
*                START-OF_SELECTION
*---------------------------------------------------------------------
START-OF-SELECTION.

  SELECT VBELN
         POSNR
         FROM LIPS
         UP TO 20 ROWS
         INTO CORRESPONDING FIELDS OF TABLE ITAB.

END-OF-SELECTION.
  IF NOT ITAB[] IS INITIAL.
    CALL SCREEN 100.
  ELSE.
    MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
  ENDIF.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_AND_INIT_ALV
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM CREATE_AND_INIT_ALV .
  DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"First Grid
  CREATE OBJECT G_CUSTOM_CONTAINER
         EXPORTING CONTAINER_NAME = G_CONTAINER1.
  CREATE OBJECT G_GRID
         EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
"Second Grid
  CREATE OBJECT G_CUSTOM_CONTAINER1
         EXPORTING CONTAINER_NAME = G_CONTAINER2.
  CREATE OBJECT G_GRID1
         EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.

* Set a titlebar for the grid control
  CLEAR GS_LAYOUT.
  GS_LAYOUT-GRID_TITLE = TEXT-003.
  GS_LAYOUT-ZEBRA = SPACE.
  GS_LAYOUT-CWIDTH_OPT = 'X'.
  GS_LAYOUT-NO_ROWMARK = 'X'.
  GS_LAYOUT-BOX_FNAME = 'BOX'.
  GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
  GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
  CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=&amp;gt;MC_EVT_MODIFIED.
  CREATE OBJECT G_HANDLER.
  SET HANDLER G_HANDLER-&amp;gt;HANDLE_DOUBLE_CLICK FOR G_GRID.
*  SET HANDLER G_HANDLER-&amp;gt;HANDLE_HOTSPOT_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER-&amp;gt;HANDLE_DATA_CHANGED FOR G_GRID.
data: ls_outatb like line of itab,
      v_index type sy-tabix.
 DATA: LS_EDIT TYPE LVC_S_STYL,
        LT_EDIT TYPE LVC_T_STYL.

LOOP AT ITAB INTO ls_outatb WHERE POSNR = '000010'.
    V_INDEX = SY-TABIX.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=&amp;gt;MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 8.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE ls_outatb-handle_style.
    MODIFY ITAB INDEX V_INDEX FROM ls_outatb  TRANSPORTING
                                      HANDLE_STYLE.
  ENDLOOP.


* setting focus for created grid control
  CALL METHOD CL_GUI_CONTROL=&amp;gt;SET_FOCUS
    EXPORTING
      CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
  PERFORM BUILD_FIELDCAT.
* Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
  LS_VARI-REPORT      = SY-REPID.
  LS_VARI-HANDLE      = SPACE.
  LS_VARI-LOG_GROUP   = SPACE.
  LS_VARI-USERNAME    = SPACE.
  LS_VARI-VARIANT     = SPACE.
  LS_VARI-TEXT        = SPACE.
  LS_VARI-DEPENDVARS  = SPACE.

  CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=&amp;gt;MC_EVT_MODIFIED.

**Calling the Method for ALV output for First Grid
  CALL METHOD G_GRID-&amp;gt;SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
**Calling the Method for ALV output for Second Grid
   CALL METHOD G_GRID1-&amp;gt;SET_TABLE_FOR_FIRST_DISPLAY
*    EXPORTING
*      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].

* Set editable cells to ready for input initially
  CALL METHOD G_GRID-&amp;gt;SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.

ENDFORM.                               "CREATE_AND_INIT_ALV
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  EXCLUDE_TB_FUNCTIONS
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;PT_EXCLUDE text
*----------------------------------------------------------------------*
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.

  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=&amp;gt;MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_fieldcat
*&amp;amp;---------------------------------------------------------------------*
*       Fieldcatalog
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT .
  DATA: L_POS TYPE I.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-EDIT      = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.

  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.

  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
  X_FIELDCAT-FIELDNAME = 'LFDAT'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '10'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.
ENDFORM.                    " build_fieldcat
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
    PERFORM CREATE_AND_INIT_ALV.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 11:39:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225095#M137639</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T11:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225096#M137640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The additions would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINITION&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt;handle_before_user_command&lt;/P&gt;&lt;P&gt;            FOR EVENT before_user_command OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;               IMPORTING e_ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IMPLEMENTATION&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------" /&gt;&lt;P&gt;METHOD handle_before_user_command.    &lt;/P&gt;&lt;P&gt;break-point.                          &lt;/P&gt;&lt;P&gt;ENDMETHOD. "handle_before_user_command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INITIALIZATION&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------" /&gt;&lt;P&gt;SET HANDLER event-&amp;gt;handle_before_user_command FOR g_grid .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD G_GRID-&amp;gt;REGISTER_EDIT_EVENT&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;I_EVENT_ID = cl_gui_alv_grid=&amp;gt;mc_evt_enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 14:34:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225096#M137640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225097#M137641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have any editable fields in the Output and do you have data_changed event to handle the change in the data of the grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 14:46:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225097#M137641</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T14:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225098#M137642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes and Yes only in the example I create there is no data_changed event. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use the before_user_command event to build in a popup with an "are you sure" question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 15:11:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225098#M137642</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T15:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225099#M137643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok , that when you want it?????????????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when you click on which button you want...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 15:19:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225099#M137643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T15:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Event before_user_command with editable alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225100#M137644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to clarify the "before_user_command" event works for most of the buttons like "refresh" and the "sort" buttons but it does not work for the "delete row", "append row", "create row" and "duplicate row"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2006 15:19:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/event-before-user-command-with-editable-alv/m-p/1225100#M137644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-31T15:19:50Z</dc:date>
    </item>
  </channel>
</rss>

