‎2006 Nov 17 10:42 AM
Hi
I m using this class to build a tree, Now i want to refresh the tree is there any method to do that.
Thanks in advance,
Kalpanashri Rajendran.
‎2006 Nov 17 1:35 PM
Try method, DELETE_ALL_NODES.
This will work same as refresh...
‎2006 Nov 17 10:44 AM
Hi Rajendran
Kindly let us know the problem you are facing????
Please avoid opening duplicate threads on the same topic. Help to close the same.
Kind Regards
Eswar
‎2006 Nov 17 10:53 AM
HI,
as far as i know, we do not have a concpet of refresh in this class, when you click on a perticular node, the nove method is called and the cells will be filled according to your program.if you want to refresh, then change your internal table in your code, then if the user press expand or collapse then the table data will be come in the output
Regards
Sudheer
‎2006 Nov 17 1:35 PM
Try method, DELETE_ALL_NODES.
This will work same as refresh...
‎2006 Nov 19 9:08 PM
Hello Kalpanashri
I copied sample report SAPSIMPLE_TREE_CONTROL_DEMO and added button "REFRESH" to the gui status. When the button is pushed routine REFRESH_TREE is called in PAI. This routine has the following coding:
MODULE PAI_100 INPUT.
CASE G_OK_CODE.
when 'REFRESH'.
perform REFRESH_TREE.
WHEN ...
ENDCASE.
* CAUTION: clear ok code!
CLEAR G_OK_CODE.
ENDMODULE. " PAI_0100 INPUT*&---------------------------------------------------------------------*
*& Form REFRESH_TREE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM refresh_tree .
* define local data
DATA:
ls_node TYPE mtreesnode,
node_table TYPE node_table_type.
* Delete entire tree
CALL METHOD g_tree->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Same BUILD routine as for the first run
PERFORM build_node_table
USING
node_table.
* Modify node table to see the effect of "refreshing"
READ TABLE node_table INTO ls_node
WITH KEY text = 'Root'.
ls_node-text = '2nd Root'.
modify node_table from ls_node index syst-tabix.
*
READ TABLE node_table INTO ls_node
WITH KEY text = 'Child1'.
ls_node-text = '2nd Child1'.
modify node_table from ls_node index syst-tabix.
* Add "refreshed" nodes to tree
CALL METHOD g_tree->add_nodes
EXPORTING
table_structure_name = 'MTREESNODE'
node_table = node_table
EXCEPTIONS
failed = 1
error_in_node_table = 2
dp_error = 3
table_structure_name_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE a000.
ENDIF.
ENDFORM. " REFRESH_TREERegards
Uwe
‎2006 Nov 20 5:05 AM
Hi,
The one way is how Uwe described to add new nodes to the tree or delete nodes.
but if you want to do a refresh of the entire tree i would suggest that you free the container and the tree instance and rebuild that would act as a refresh too.
for eg:
lets assume the tree is already created and now a refresh is being triggered
refresh block
free container.
free tree_instance.
clear all internal tables
call tree creation subroutine.
hope you find this helpful
Regards,
Kinshuk