10-08-2007 9:25 AM
Hi.
I'm creating an ALV List Tree (CL_GUI_LIST_TREE) and i need to refresh it.
Is there any method i can use for this??
Thanks.
10-08-2007 9:29 AM
10-08-2007 9:32 AM
Hi Jose,
class CL_SALV_HIERSEQ_TABLE mehod REFRESH
Thanks,
Reward If Helpful.
10-08-2007 9:36 AM
In the ALV list tree
use call method CALL_ITEM_METHOD OF CL_GUI_LIST_TREE class
Use method item_free where item is object CL_GUI_OBJECT class
In the CLASS CL_GUI_ALV_TREE
there is method refresh_table_display
Please reward if useful.
10-08-2007 10:02 AM
hi
good
go through this code
Declare table to store top leve nodes in top include
types: begin of t_topnodes,
nodekey type lvc_nkey,
end of t_topnodes.
data: it_topnodes type standard table of t_topnodes,
wa_topnodes like line of it_topnodes.
Add code to build top level node table
&----
*& Form CREATE_ALVTREE_HIERARCHY
&----
text
----
Builds ALV tree display, (inserts nodes, subnodes etc)
----
form create_alvtree_hierarchy.
data: ls_sflight type sflight,
lt_sflight type sflight occurs 0.
data: ld_ebeln_key type lvc_nkey,
ld_ebelp_key type lvc_nkey.
loop at it_ekko into wa_ekko.
perform add_ekko_node using wa_ekko
''
changing ld_ebeln_key.
wa_topnodes-nodekey = ld_ebeln_key.
append wa_topnodes to it_topnodes.
loop at it_ekpo into wa_ekpo where ebeln eq wa_ekko-ebeln.
perform add_ekpo_line using wa_ekpo
ld_ebeln_key
changing ld_ebelp_key.
endloop.
endloop.
calculate totals
call method gd_tree->update_calculations.
this method must be called to send the data to the frontend
call method gd_tree->frontend_update.
endform. " CREATE_ALVTREE_HIERARCHY
Add code to to the ALV Tree user command functionality
*************************************************
EXAMPLE CODE used for demonstration purpose **
----
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.
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_refresh.htm
-
reward point if helpful.
thanks
mrutyun^