<?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: retrieve changed record from editable alv grid in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348078#M1231564</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;Refer this program:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
     it_sort                           = it_sort        " sort info
    TABLES
      t_outtab                          = it_final      " internal table
   EXCEPTIONS
     program_error                     = 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.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  pf
*&amp;amp;---------------------------------------------------------------------*
*       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
*       ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
*       --&amp;gt;RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZTG_STAT'.
ENDFORM.                    "pf

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  USER_COMMAND
*&amp;amp;---------------------------------------------------------------------*
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
*      --&amp;gt;LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      --&amp;gt;L_SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.

* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.

* handle the code execution based on the function code encountered
  CASE lv_okcode.

* when the function code is SAVE then save records into internal table
    WHEN 'SAVE'.

* to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new

      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.

      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid-&amp;gt;check_changed_data.
      ENDIF.

"now at this time you have modified internal table

* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.

"alv output is refreshed as per changes in internal table

"now you can include code to modify your ztable from internal table

  ENDCASE.

ENDFORM.                    "USER_COMMAND
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tarun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Mar 2009 10:47:47 GMT</pubDate>
    <dc:creator>I355602</dc:creator>
    <dc:date>2009-03-17T10:47:47Z</dc:date>
    <item>
      <title>retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348076#M1231562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      i am new to alv grid... i am facing some problems working on it... plz help me solve my problems...&lt;/P&gt;&lt;P&gt;      i have created an alv grid displaying the timesheet of some employee's...&lt;/P&gt;&lt;P&gt;      the worktime cells are editable and rest of the information is read only...&lt;/P&gt;&lt;P&gt;      the worktime is changed and then a SAVE button is pushed...&lt;/P&gt;&lt;P&gt;      how do i retrieve the changed time into my internal table? &lt;/P&gt;&lt;P&gt;      once i update the internal table, i can modify the database table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 10:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348076#M1231562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T10:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348077#M1231563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://forums.sdn.sap.com/click.jspa?searchID=23616217&amp;amp;messageID=6982796" target="test_blank"&gt;https://forums.sdn.sap.com/click.jspa?searchID=23616217&amp;amp;messageID=6982796&lt;/A&gt;&lt;/P&gt;&lt;P&gt;there are many threads regarding this..just try searching&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 10:43:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348077#M1231563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T10:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348078#M1231564</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;Refer this program:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
     it_sort                           = it_sort        " sort info
    TABLES
      t_outtab                          = it_final      " internal table
   EXCEPTIONS
     program_error                     = 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.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  pf
*&amp;amp;---------------------------------------------------------------------*
*       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
*       ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
*       --&amp;gt;RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZTG_STAT'.
ENDFORM.                    "pf

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  USER_COMMAND
*&amp;amp;---------------------------------------------------------------------*
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
*      --&amp;gt;LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      --&amp;gt;L_SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.

* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.

* handle the code execution based on the function code encountered
  CASE lv_okcode.

* when the function code is SAVE then save records into internal table
    WHEN 'SAVE'.

* to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new

      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.

      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid-&amp;gt;check_changed_data.
      ENDIF.

"now at this time you have modified internal table

* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.

"alv output is refreshed as per changes in internal table

"now you can include code to modify your ztable from internal table

  ENDCASE.

ENDFORM.                    "USER_COMMAND
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tarun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 10:47:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348078#M1231564</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2009-03-17T10:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348079#M1231565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;please check this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/avl" target="test_blank"&gt;https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/avl&lt;/A&gt;&lt;EM&gt;sample&lt;/EM&gt;TOP_OF_PAGE&lt;/P&gt;&lt;P&gt;Thanks and regrds&lt;/P&gt;&lt;P&gt;Durga.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 10:53:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348079#M1231565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T10:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348080#M1231566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for immediate reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      but i have displayed the alv grid using CALL METHOD g_alv_grid-&amp;gt;set_table_for_first_display not the&lt;/P&gt;&lt;P&gt;      FM 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any different method or should i use the FM only?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 11:10:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348080#M1231566</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T11:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348081#M1231567</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;If using OO ALV, then use this code when you click SAVE button:-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CASE sy-ucomm.
  WHEN 'SAVE'.
* to reflect the data changed into internal table
    DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
 
    IF ref_grid IS INITIAL.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref_grid.
    ENDIF.
 
    IF NOT ref_grid IS INITIAL.
      CALL METHOD ref_grid-&amp;gt;check_changed_data.
    ENDIF.

    " and then use refresh_table_display
    CALL METHOD ref_grid-&amp;gt;refresh_table_display.
    " to refresh the data from internal table back to alv output.
 
ENDCASE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tarun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 11:17:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348081#M1231567</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2009-03-17T11:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve changed record from editable alv grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348082#M1231568</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;You can also refer this thread:&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1746945"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tarun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 11:21:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-changed-record-from-editable-alv-grid/m-p/5348082#M1231568</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2009-03-17T11:21:02Z</dc:date>
    </item>
  </channel>
</rss>

