2008 Nov 17 9:32 AM
Hi all,
I implemented an ALV by using function 'REUSE_ALV_GRID_DISPLAY'. One of the fileds output is called 'DELETE' and I set it diplay as checkbox and editable. When the user click this field of one certain line , I want the program to check the line data and decide whether the checkbox can be set to 'X' , if not ,I will clear it anyway . Now I did the check in event HANDLE_DATA_CHANGED and clear the field in my iternal table , but the ALV doesn't refresh, so although the field in my internal table is initial, it display as 'X' in the ALV. If I refresh the ALV now , the 'X' disapear. I can't set the ALV refresh automatically because it doesn't run the USER_COMMAND event. How can I deal it? If my way is wrong, how to do it correctly? THANKS
Hi all,
I implemented an ALV by using function 'REUSE_ALV_GRID_DISPLAY'. One of the fileds output is called 'DELETE' and I set it diplay as checkbox and editable. When the user click this field of one certain line , I want the program to check the line data and decide whether the checkbox can be set to 'X' , if not ,I will clear it anyway . Now I did the check in event HANDLE_DATA_CHANGED and clear the field in my iternal table , but the ALV doesn't refresh, so although the field in my internal table is initial, it display as 'X' in the ALV. If I refresh the ALV now , the 'X' disapear. I can't set the ALV refresh automatically because it doesn't run the USER_COMMAND event. How can I deal it? If my way is wrong, how to do it correctly? THANKS
2008 Nov 17 9:36 AM
2008 Nov 17 9:41 AM
You can use this method after modifying internal table.
data: go_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = go_grid.
CALL METHOD go_grid->CHECK_CHANGED_DATA .
2008 Nov 17 9:43 AM
2008 Nov 17 9:45 AM
Hi
i had tree based alv code with me
refer this
Add code to to the ALV Tree user command functionality
----
CLASS lcl_toolbar_event_receiver IMPLEMENTATION
----
........ *
----
class lcl_toolbar_event_receiver implementation.
method on_function_selected.
data: ls_gmsec type zgmsec,
ld_answer type c.
case fcode.
when 'CHNG'.
data: ld_uname type zgmuserparam-uname.
data: lt_selected_node type lvc_t_nkey.
call method tree1->get_selected_nodes
CHANGING
ct_selected_nodes = lt_selected_node.
call method cl_gui_cfw=>flush.
data l_selected_node type lvc_nkey.
check not lt_selected_node[] is initial.
read table lt_selected_node into l_selected_node index 1.
call method tree1->get_outtab_line
EXPORTING
i_node_key = l_selected_node
IMPORTING
e_outtab_line = ls_gmsec.
if ls_gmsec-uname is initial.
message i010(ad) with 'Please choose a valid user'.
else.
Example: i.e calls screen to allow user to make chnage
call screen 0300.
AT this point user has returned from a screen (i.e. 300) which
allowed them to make changes to existing data/node
The following code deletes all the existing nodes using the top
node table populated earlier
loop at it_topnodes into wa_topnodes.
call method TREE1->DELETE_SUBTREE
EXPORTING
i_node_key = wa_topnodes-nodekey.
endloop.
call method cl_gui_cfw=>flush.
Now you need to re-select your data and re-build your hierarchy
from scratch. for example the code could look somthing like this.
REFRESH: it_ekko, it_ekpo.
SELECT ebeln
UP TO 10 ROWS
FROM ekko
INTO corresponding fields of TABLE it_ekko.
loop at it_ekko into wa_ekko.
SELECT ebeln ebelp statu aedat matnr menge meins
netpr peinh
FROM ekpo
appending TABLE it_ekpo
where ebeln eq wa_ekko-ebeln.
endloop.
perform create_alvtree_hierarchy.