‎2013 Feb 15 8:14 PM
Hello Experts!
I am currently having trouble with this issue. I am developing a dashboard that has a dropdown list and below that dropdown list is an ALV. Based on what the user selects in the dropdown list, the ALV output will change. I have assigned a function code to my dropdown list and am able to capture the dropdown list being changed, however I am unsure how I can go about capturing the value in the dropdown list that is selected and then changing the ALV output based on that selection. Any help would be greatly appreciated. I have attached a screenshot to help clarify what my dashboard looks like.
‎2013 Feb 15 8:51 PM
hello,
Code to capture changes in ALV
*&---------------------------------------------------------------------*
*& 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 = 'X'.
"alv output is refreshed as per changes in internal table
ENDCASE.
ENDFORM. "USER_COMMAND
Code to refresh ALV report --
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD cl_gui_cfw=>flush.
best regards,
swanand