2009 Mar 17 10:40 AM
hello,
i am new to alv grid... i am facing some problems working on it... plz help me solve my problems...
i have created an alv grid displaying the timesheet of some employee's...
the worktime cells are editable and rest of the information is read only...
the worktime is changed and then a SAVE button is pushed...
how do i retrieve the changed time into my internal table?
once i update the internal table, i can modify the database table...
thank you.
2009 Mar 17 11:10 AM
thank you for immediate reply,
but i have displayed the alv grid using CALL METHOD g_alv_grid->set_table_for_first_display not the
FM 'REUSE_ALV_GRID_DISPLAY'
is there any different method or should i use the FM only?
hello,
i am new to alv grid... i am facing some problems working on it... plz help me solve my problems...
i have created an alv grid displaying the timesheet of some employee's...
the worktime cells are editable and rest of the information is read only...
the worktime is changed and then a SAVE button is pushed...
how do i retrieve the changed time into my internal table?
once i update the internal table, i can modify the database table...
thank you.
2009 Mar 17 10:43 AM
https://forums.sdn.sap.com/click.jspa?searchID=23616217&messageID=6982796
there are many threads regarding this..just try searching
2009 Mar 17 10:47 AM
Hi,
Refer this program:-
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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&---------------------------------------------------------------------*
*& Form pf
*&---------------------------------------------------------------------*
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
* -->RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->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->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
Regards,
Tarun
2009 Mar 17 10:53 AM
Hi,
please check this link
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/avlsampleTOP_OF_PAGE
Thanks and regrds
Durga.K
2009 Mar 17 11:10 AM
thank you for immediate reply,
but i have displayed the alv grid using CALL METHOD g_alv_grid->set_table_for_first_display not the
FM 'REUSE_ALV_GRID_DISPLAY'
is there any different method or should i use the FM only?
2009 Mar 17 11:17 AM
Hi,
If using OO ALV, then use this code when you click SAVE button:-
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->check_changed_data.
ENDIF.
" and then use refresh_table_display
CALL METHOD ref_grid->refresh_table_display.
" to refresh the data from internal table back to alv output.
ENDCASE.
Hope this helps you.
Regards,
Tarun
2009 Mar 17 11:21 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |