<?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: ALV using methods. Capturing editable cell data. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917606#M1330901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vishnu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try the below options..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have u used &lt;/P&gt;&lt;P&gt;DATA gr_event_handler TYPE REF TO lcl_event_handler .&lt;/P&gt;&lt;P&gt;.. ..&lt;/P&gt;&lt;P&gt;*--Creating an instance for the event handler&lt;/P&gt;&lt;P&gt;CREATE OBJECT gr_event_handler .&lt;/P&gt;&lt;P&gt;*--Registering handler methods to handle ALV Grid events&lt;/P&gt;&lt;P&gt;SET HANDLER gr_event_handler-&amp;gt;handle_data_changed FOR gr_alvgrid .&lt;/P&gt;&lt;P&gt;SET HANDLER gr_event_handler-&amp;gt;handle_data_changed_finished FOR gr_alvgrid .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE sy-ucomm.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  WHEN 'SAVE'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;to reflect the data changed into internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      IF ref_grid IS INITIAL.&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'&lt;/P&gt;&lt;P&gt;          IMPORTING&lt;/P&gt;&lt;P&gt;            e_grid = ref_grid.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      IF NOT ref_grid IS INITIAL.&lt;/P&gt;&lt;P&gt;        CALL METHOD ref_grid-&amp;gt;check_changed_data.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"User command module at PAI: &lt;/P&gt;&lt;P&gt;CASE gd_okcde. WHEN 'SWITCH'. &lt;/P&gt;&lt;P&gt;" switch editable / non-editable PERFORM switch. ... &lt;/P&gt;&lt;P&gt;FORM switch. "(1) Read current fieldcatalog &lt;/P&gt;&lt;P&gt;go_grid-&amp;gt;get_frontend_layout( ). "(2) Mark / Unmark EDIT flag in fieldcatalog &lt;/P&gt;&lt;P&gt;LOOP AT gt_fcat INTO ls_fcat WHERE ( fieldname = '&amp;lt;name of column&amp;gt;' ). " which you want to edit&lt;/P&gt;&lt;P&gt; IF ( ls_fcat-edit = 'X' ). &lt;/P&gt;&lt;P&gt;ls_fcat-edit = space. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;ls_fcat-edit = 'X'. &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix. ENDLOOP. "(3) Set modified fieldcatalog:&lt;/P&gt;&lt;P&gt; go_grid-&amp;gt;set_frontend_layout( ). &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also have a look on the below programs&lt;/P&gt;&lt;P&gt;BCALV_EDIT_01 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_02 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_03 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_04 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_05 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_06 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_07 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_08 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use attribute CL_GUI_ALV_GRID=&amp;gt;MC_STYLE_ENABLED to set a cell to status "editable".&lt;/P&gt;&lt;P&gt;Use attribute CL_GUI_ALV_GRID=&amp;gt;MC_STYLE_DISABLED to set a cell to status "non-editable".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Jul 2009 13:36:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-11T13:36:30Z</dc:date>
    <item>
      <title>ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917601#M1330896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have created ALV grid using container. I have made one of the cells as editable. Now how can i capture the edited data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 04:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917601#M1330896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T04:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917602#M1330897</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 program BCALV_FIELDCAT_TEST&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you implement the DATA_CHANGED event you can get the information of what cell and what is the value changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data_changed         for event data_changed&lt;/P&gt;&lt;P&gt;                         of cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;                         importing er_data_changed "&amp;lt;---This holds the information&lt;/P&gt;&lt;P&gt;                                   e_onf4&lt;/P&gt;&lt;P&gt;                                   e_onf4_before&lt;/P&gt;&lt;P&gt;                                   e_onf4_after,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;er_data_changed is of type CL_ALV_CHANGED_DATA_PROTOCOL, so here you can find the Following information from the attributes of the object.&lt;/P&gt;&lt;P&gt;MT_MOD_CELLS&lt;/P&gt;&lt;P&gt;MP_MOD_ROWS&lt;/P&gt;&lt;P&gt;MT_GOOD_CELLS&lt;/P&gt;&lt;P&gt;MT_DELETED_ROWS&lt;/P&gt;&lt;P&gt;MT_INSERTED_ROWS&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 07:00:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917602#M1330897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T07:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917603#M1330898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for the reply. Could you tell me when this event will exactly get triggered?? I have assigned an event handler and wrote an event handler method but its not getting triggered. Actually in my case the editable field is a check box. when the user checks a box and clicks on a custom push button on the application tool bar, it should navigate to a transaction. But this event is not getting triggered. If you can help me asap please ping me on  . Expecting your fast reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;P&gt;Vishnu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 09:20:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917603#M1330898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T09:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917604#M1330899</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;As we can now make our ALV Grid editable we may require controlling input data. The ALV Grid has events u201Cdata_changedu201D and u201Cdata_changed_finishedu201D. The former method is triggered just after the change at an editable field is perceived. Here you can make checks for the input. And the second event is triggered after the change is committed.&lt;/P&gt;&lt;P&gt;You can select the way how the control perceives data changes by using the method u201Cregister_edit_eventu201D. You have two choices:&lt;/P&gt;&lt;P&gt;i. After return key is pressed: To select this way, to the parameter u201Ci_event_idu201D pass u201Ccl_gui_alv_grid=&amp;gt;mc_evt_enteru201D.&lt;/P&gt;&lt;P&gt;ii. After the field is modified and the cursor is moved to another field: For this, pass u201Ccl_gui_alv_grid=&amp;gt;mc_evt_modifiesu201D to the same parameter.&lt;/P&gt;&lt;P&gt;To make events controlling data changes be triggered, you must select either way by calling this method. Otherwise, these events will not be triggered.&lt;/P&gt;&lt;P&gt;To control field data changes, ALV Grid uses an instance of the class u201CCL_ALV_CHANGED_DATA_PROTOCOLu201D and passes this via the event u201Cdata_changedu201D. Using methods of this class, you can get and modify cell values and produce error messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Sy-ucomm, when you click the SAVE button, call the method like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'SAVE'.&lt;/P&gt;&lt;P&gt;DATA w_ref1 TYPE REF TO cl_gui_alv_grid.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;e_grid = w_ref1.&lt;/P&gt;&lt;P&gt;CALL METHOD w_ref1-&amp;gt;check_changed_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD w_ref1-&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;Hope this wud help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 09:36:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917604#M1330899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T09:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917605#M1330900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 11:02:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917605#M1330900</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T11:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using methods. Capturing editable cell data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917606#M1330901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vishnu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try the below options..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have u used &lt;/P&gt;&lt;P&gt;DATA gr_event_handler TYPE REF TO lcl_event_handler .&lt;/P&gt;&lt;P&gt;.. ..&lt;/P&gt;&lt;P&gt;*--Creating an instance for the event handler&lt;/P&gt;&lt;P&gt;CREATE OBJECT gr_event_handler .&lt;/P&gt;&lt;P&gt;*--Registering handler methods to handle ALV Grid events&lt;/P&gt;&lt;P&gt;SET HANDLER gr_event_handler-&amp;gt;handle_data_changed FOR gr_alvgrid .&lt;/P&gt;&lt;P&gt;SET HANDLER gr_event_handler-&amp;gt;handle_data_changed_finished FOR gr_alvgrid .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE sy-ucomm.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  WHEN 'SAVE'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;to reflect the data changed into internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      IF ref_grid IS INITIAL.&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'&lt;/P&gt;&lt;P&gt;          IMPORTING&lt;/P&gt;&lt;P&gt;            e_grid = ref_grid.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      IF NOT ref_grid IS INITIAL.&lt;/P&gt;&lt;P&gt;        CALL METHOD ref_grid-&amp;gt;check_changed_data.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"User command module at PAI: &lt;/P&gt;&lt;P&gt;CASE gd_okcde. WHEN 'SWITCH'. &lt;/P&gt;&lt;P&gt;" switch editable / non-editable PERFORM switch. ... &lt;/P&gt;&lt;P&gt;FORM switch. "(1) Read current fieldcatalog &lt;/P&gt;&lt;P&gt;go_grid-&amp;gt;get_frontend_layout( ). "(2) Mark / Unmark EDIT flag in fieldcatalog &lt;/P&gt;&lt;P&gt;LOOP AT gt_fcat INTO ls_fcat WHERE ( fieldname = '&amp;lt;name of column&amp;gt;' ). " which you want to edit&lt;/P&gt;&lt;P&gt; IF ( ls_fcat-edit = 'X' ). &lt;/P&gt;&lt;P&gt;ls_fcat-edit = space. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;ls_fcat-edit = 'X'. &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix. ENDLOOP. "(3) Set modified fieldcatalog:&lt;/P&gt;&lt;P&gt; go_grid-&amp;gt;set_frontend_layout( ). &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also have a look on the below programs&lt;/P&gt;&lt;P&gt;BCALV_EDIT_01 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_02 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_03 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_04 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_05 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_06 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_07 &lt;/P&gt;&lt;P&gt;BCALV_EDIT_08 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use attribute CL_GUI_ALV_GRID=&amp;gt;MC_STYLE_ENABLED to set a cell to status "editable".&lt;/P&gt;&lt;P&gt;Use attribute CL_GUI_ALV_GRID=&amp;gt;MC_STYLE_DISABLED to set a cell to status "non-editable".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 13:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-methods-capturing-editable-cell-data/m-p/5917606#M1330901</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-11T13:36:30Z</dc:date>
    </item>
  </channel>
</rss>

