07-02-2007 4:20 PM
Hi,
i get problems with this code.
i'm using docking container, not customer container.
...
CREATE OBJECT GR_DCONTAINER
EXPORTING
PARENT = CL_GUI_CONTAINER=>SCREEN0
SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_LEFT
RATIO = 90.
*
PERFORM DYNP_SPLITTEN.
*
CREATE OBJECT GR_ALVGRID_RIGHT
EXPORTING
I_PARENT = O_PARENT_GRID_RIGHT.
...
TRY.
CL_SALV_TREE=>FACTORY(
EXPORTING
R_CONTAINER = O_PARENT_GRID_RIGHT
IMPORTING
R_SALV_TREE = GR_TREE
CHANGING
T_TABLE = ITAB ).
<b> CATCH CX_SALV_NO_NEW_DATA_ALLOWED CX_SALV_ERROR.
EXIT.</b>
ENDTRY.
*
i get the catch-event and the report ends.
Question: Does the ALV-TREE need customer container or can
i use docking container (how??).
thanks for help.
Regards Dieter
07-02-2007 4:33 PM
Sure, in this case, it is impelmented in a docking container hanging from a selection screen, but it is pretty much the same as hanging off a dynpro.
REPORT zrich_0001.
DATA: gt_outtab1 TYPE TABLE OF sflight,
gt_outtab2 TYPE TABLE OF sflight.
DATA: ls_outtab TYPE sflight.
DATA: gr_tree TYPE REF TO cl_salv_tree.
DATA: nodes TYPE REF TO cl_salv_nodes,
node TYPE REF TO cl_salv_node.
DATA: docking TYPE REF TO cl_gui_docking_container.
PARAMETERS: p_check.
AT SELECTION-SCREEN OUTPUT.
CREATE OBJECT docking
EXPORTING
* PARENT = CL_GUI_CONTAINER=>SCREEN0
side = cl_gui_docking_container=>dock_at_left
ratio = 90.
*... Select Data
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_outtab1 UP TO 5 ROWS.
*... Create Instance with an Empty Table
CALL METHOD cl_salv_tree=>factory
EXPORTING
r_container = docking
IMPORTING
r_salv_tree = gr_tree
CHANGING
t_table = gt_outtab2.
*... Add the Nodes to the Tree
nodes = gr_tree->get_nodes( ).
LOOP AT gt_outtab1 INTO ls_outtab.
TRY.
node = nodes->add_node( related_node = ' '
relationship = cl_gui_column_tree=>relat_first_child ).
node->set_data_row( ls_outtab ).
CATCH cx_salv_msg.
ENDTRY.
ENDLOOP.
*... Display Table
gr_tree->display( ).
Regards,
RIch Heilman
07-02-2007 4:33 PM
Sure, in this case, it is impelmented in a docking container hanging from a selection screen, but it is pretty much the same as hanging off a dynpro.
REPORT zrich_0001.
DATA: gt_outtab1 TYPE TABLE OF sflight,
gt_outtab2 TYPE TABLE OF sflight.
DATA: ls_outtab TYPE sflight.
DATA: gr_tree TYPE REF TO cl_salv_tree.
DATA: nodes TYPE REF TO cl_salv_nodes,
node TYPE REF TO cl_salv_node.
DATA: docking TYPE REF TO cl_gui_docking_container.
PARAMETERS: p_check.
AT SELECTION-SCREEN OUTPUT.
CREATE OBJECT docking
EXPORTING
* PARENT = CL_GUI_CONTAINER=>SCREEN0
side = cl_gui_docking_container=>dock_at_left
ratio = 90.
*... Select Data
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_outtab1 UP TO 5 ROWS.
*... Create Instance with an Empty Table
CALL METHOD cl_salv_tree=>factory
EXPORTING
r_container = docking
IMPORTING
r_salv_tree = gr_tree
CHANGING
t_table = gt_outtab2.
*... Add the Nodes to the Tree
nodes = gr_tree->get_nodes( ).
LOOP AT gt_outtab1 INTO ls_outtab.
TRY.
node = nodes->add_node( related_node = ' '
relationship = cl_gui_column_tree=>relat_first_child ).
node->set_data_row( ls_outtab ).
CATCH cx_salv_msg.
ENDTRY.
ENDLOOP.
*... Display Table
gr_tree->display( ).
Regards,
RIch Heilman
07-03-2007 7:18 AM
Hi Rich,
thanks for your answer. at the moment I'm in another project, therefore
i have to test it later.
regards, Dieter
07-03-2007 3:04 PM
Hi Rich,
thanks it works OK but i have a question too:
In a Grid-container i use this:
*
CALL METHOD GR_ALVGRID_RIGHT->SET_VISIBLE
EXPORTING
VISIBLE = SPACE.
Is there any method to the same when i have an tree, because this one
doesn't work with Tree.
Regards, Dieter
07-03-2007 3:18 PM
07-03-2007 3:55 PM
Hi Rich,
i try it like this:
First i do this:
CALL METHOD CL_SALV_TREE=>FACTORY
EXPORTING
R_CONTAINER = O_PARENT_GRID_RIGHT
IMPORTING
R_SALV_TREE = GR_TREE
CHANGING
T_TABLE = ITAB_TREE.
*
PERFORM TREE_HEADER.
*
PERFORM TREE_SPALTEN.
*
PERFORM FUNKTIONSTASTEN_SETZEN.
*
GR_TREE->DISPLAY( ).
It works OK.
when pressing a special button i will do this:
CALL METHOD O_PARENT_GRID_RIGHT->SET_VISIBLE
EXPORTING
VISIBLE = SPACE.
But it doesn't work.
Any idea, i think O_PARENT_GRID_RIGHT is OK. Isn't it?
Regards, Dieter