<?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: How to capture field changes in alv grid using objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826112#M352471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    I just want to know in which row the changes has been done. If possible please provide the code (if you have any).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jan 2007 13:07:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-24T13:07:52Z</dc:date>
    <item>
      <title>How to capture field changes in alv grid using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826109#M352468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to display data in ALV grid using classes and objects and it has some input fields. And has one push button on screen if user enter anything in the input fields and press push button then those values have to be stored in Data base. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If user enter any data in the input fields and trying to come back with the help of F3 or back button with out saving the modified values then i need to show one pop-up with some message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my doubt is how to capture the field changes in alv grid, and i want to know in which row user has changed the data, it means that row(s) only i need to modify in data base.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to use data_changed method for capturing modified row(s) details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 10:57:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826109#M352468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T10:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture field changes in alv grid using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826110#M352469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. To capture the changed field u can do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     FORM USER_COMMAND.....&lt;/P&gt;&lt;P&gt;        &amp;lt;b&amp;gt;Data 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 = ref1.&lt;/P&gt;&lt;P&gt;            call method ref1-&amp;gt;check_changed_data&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;P&gt;case sy-ucomm.&lt;/P&gt;&lt;P&gt;   when...&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. For ur requirment , when u click back u want to popup, u can go like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   WHEN 'SAVE'.&lt;/P&gt;&lt;P&gt;       flag = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WHEN 'BACK'.&lt;/P&gt;&lt;P&gt;          IF flag ne 'X'.&lt;/P&gt;&lt;P&gt;              &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;display popup here&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            clear flag.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;     ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 11:04:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826110#M352469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T11:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture field changes in alv grid using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826111#M352470</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;The ALV Grid has events &amp;#147;data_changed&amp;#148; and &amp;#147;data_changed_finished&amp;#148;. 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 &amp;#147;register_edit_event&amp;#148;. You have two choices:&lt;/P&gt;&lt;P&gt;i. After return key is pressed: To select this way, to the parameter &amp;#147;i_event_id&amp;#148; pass &amp;#147;cl_gui_alv_grid=&amp;gt;mc_evt_enter&amp;#148;.&lt;/P&gt;&lt;P&gt;ii. After the field is modified and the cursor is moved to another field:&lt;/P&gt;&lt;P&gt;For this, pass &amp;#147;cl_gui_alv_grid=&amp;gt;mc_evt_modifies&amp;#148; 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 &amp;#147;CL_ALV_CHANGED_DATA_PROTOCOL&amp;#148; and passes this via the event &amp;#147;data_changed&amp;#148;. Using methods of this class, you can get and modify cell values and produce error messages. Here are some of those methods:&lt;/P&gt;&lt;P&gt;get_cell_value&lt;/P&gt;&lt;P&gt;Gets the cell value. You pass the address of the cell to the interface.&lt;/P&gt;&lt;P&gt;modify_cell&lt;/P&gt;&lt;P&gt;Modifies the cell value addressed via parameters.&lt;/P&gt;&lt;P&gt;add_protocol_entry&lt;/P&gt;&lt;P&gt;Add a log entry. You make use of standard message interface with message type, message id, etc&amp;#133;&lt;/P&gt;&lt;P&gt;protocol_is_visible&lt;/P&gt;&lt;P&gt;Make the error table visible or not.&lt;/P&gt;&lt;P&gt;refresh_protocol&lt;/P&gt;&lt;P&gt;Refreshing log entries.&lt;/P&gt;&lt;P&gt;With the reference of the instance, you can reach information about modifications. These useful attribute tables are:&lt;/P&gt;&lt;P&gt;MT_MOD_CELLS : Contains addresses of modified cells with &amp;#147;row_id&amp;#148;s and &amp;#147;fieldname&amp;#148;s.&lt;/P&gt;&lt;P&gt;MP_MOD_ROWS : Contains modified rows. Its type is generic.&lt;/P&gt;&lt;P&gt;MT_GOOD_CELLS : Contains cells having proper values&lt;/P&gt;&lt;P&gt;MT_DELETED_ROWS:Contains rows deleted from the list&lt;/P&gt;&lt;P&gt;MT_INSERTED_ROWS:Contains rows inserted to the list&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Utilizing these methods and attributes you can check and give proper message and also modify the cell content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checking the input together with anon-input value, adding a log and modifying the cell content&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM handle_data_changed USING ir_data_changed&lt;/P&gt;&lt;P&gt;TYPE REF TO cl_alv_changed_data_protocol.&lt;/P&gt;&lt;P&gt;DATA : ls_mod_cell TYPE lvc_s_modi ,&lt;/P&gt;&lt;P&gt;           lv_value TYPE lvc_value .&lt;/P&gt;&lt;P&gt;SORT ir_data_changed-&amp;gt;mt_mod_cells BY row_id .&lt;/P&gt;&lt;P&gt;LOOP AT ir_data_changed-&amp;gt;mt_mod_cells&lt;/P&gt;&lt;P&gt;INTO ls_mod_cell&lt;/P&gt;&lt;P&gt;WHERE fieldname = 'SEATSMAX' .&lt;/P&gt;&lt;P&gt;CALL METHOD ir_data_changed-&amp;gt;get_cell_value&lt;/P&gt;&lt;P&gt;EXPORTING i_row_id = ls_mod_cell-row_id&lt;/P&gt;&lt;P&gt;i_fieldname = 'CARRID'&lt;/P&gt;&lt;P&gt;IMPORTING e_value = lv_value .&lt;/P&gt;&lt;P&gt;IF lv_value = 'THY' AND ls_mod_cell-value &amp;gt; '500' .&lt;/P&gt;&lt;P&gt;CALL METHOD ir_data_changed-&amp;gt;add_protocol_entry&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_msgid = 'SU'&lt;/P&gt;&lt;P&gt;i_msgno = '000'&lt;/P&gt;&lt;P&gt;i_msgty = 'E'&lt;/P&gt;&lt;P&gt;i_msgv1 = 'This number can not exceed 500 for '&lt;/P&gt;&lt;P&gt;i_msgv2 = lv_value&lt;/P&gt;&lt;P&gt;i_msgv3 = 'The value is et to ''500'''&lt;/P&gt;&lt;P&gt;i_fieldname = ls_mod_cell-fieldname&lt;/P&gt;&lt;P&gt;i_row_id = ls_mod_cell-row_id .&lt;/P&gt;&lt;P&gt;CALL METHOD ir_data_changed-&amp;gt;modify_cell&lt;/P&gt;&lt;P&gt;EXPORTING i_row_id = ls_mod_cell-row_id&lt;/P&gt;&lt;P&gt;i_fieldname = ls_mod_cell-fieldname&lt;/P&gt;&lt;P&gt;i_value = '500' .&lt;/P&gt;&lt;P&gt;ENDIF .&lt;/P&gt;&lt;P&gt;ENDLOOP .&lt;/P&gt;&lt;P&gt;ENDFORM. " handle_data_changed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The event &amp;#147;data_changed&amp;#148; makes you aware about F4 functions. It sets the appropriate parameter from the group with respect to where it was triggered. These parameters are { E_ONF4, E_ONF4_BEFORE, E_ONF4_AFTER }.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;PLZ reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 11:22:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826111#M352470</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T11:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture field changes in alv grid using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826112#M352471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    I just want to know in which row the changes has been done. If possible please provide the code (if you have any).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2007 13:07:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-capture-field-changes-in-alv-grid-using-objects/m-p/1826112#M352471</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-24T13:07:52Z</dc:date>
    </item>
  </channel>
</rss>

