Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Tree Object Refresh Problem

Former Member
0 Likes
1,261

Hi everybody,

I made a report that shows in a docking container a cl_gui_list_tree. When i double click on a node another docking container display the related info in an ALV.

if i go back to the main screen i used the free method of the cl_gui_list_tree object, but when i changed the initial parameters and execute again the report the docking container that owns the cl_gui_list_tree object is apearing empty.

PD. Every time the report is execute the cl_gui_list_tree object is created and its nodes rebuildt.

What shoul I do in order to refresh the content of the cl_gui_list_tree?

Regards,

Eric

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,040

Can you post your code?

Regards,

Rich Heilman

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,041

Can you post your code?

Regards,

Rich Heilman

Read only

0 Likes
1,040

Hi Rich,

Attach you can find the creation and destoying part of the object.

Regards,

Eric

data: ref_dc_arbol TYPE REF TO cl_gui_docking_container,

ref_arbol TYPE REF TO cl_gui_list_tree.

PROCESS BEFORE OUTPUT.

MODULE mostrar_arbol.

PROCESS AFTER INPUT.

MODULE user_command_9001.

********************************

MODULE mostrar_arbol OUTPUT.

IF ref_arbol IS INITIAL.

PERFORM crear_arbol.

ENDIF.

ENDMODULE. " mostrar_arbol OUTPUT

FORM crear_arbol .

DATA: it_tabla_nodos TYPE treev_ntab,

it_tabla_items TYPE t_nodos,

it_events TYPE cntl_simple_events,

wa_event TYPE cntl_simple_event.

  • Creamos el docking container para el Arbol

CREATE OBJECT ref_dc_arbol

EXPORTING

repid = sy-repid

dynnr = '9001'

extension = 225

side = cl_gui_docking_container=>dock_at_left.

IF sy-subrc <> 0.

  • MESSAGE a000.

ENDIF.

  • Creamos el control del arbol izq.

CREATE OBJECT ref_arbol

EXPORTING

parent = ref_dc_arbol

node_selection_mode = cl_gui_list_tree=>node_sel_mode_single

item_selection = 'X'

with_headers = ' '

EXCEPTIONS

lifetime_error = 1

cntl_system_error = 2

create_error = 3

failed = 4

illegal_node_selection_mode = 5.

IF sy-subrc <> 0.

  • MESSAGE a000.

ENDIF.

  • Creamos el objeto aplicacion

CREATE OBJECT ref_aplicacion.

  • Definimos los eventos que seran pasados al backend

  • " item double click

wa_event-eventid = cl_gui_list_tree=>eventid_item_double_click.

wa_event-appl_event = 'X'.

APPEND wa_event TO it_events.

CALL METHOD ref_arbol->set_registered_events

EXPORTING

events = it_events

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

illegal_event_combination = 3.

IF sy-subrc <> 0.

  • MESSAGE A000.

ENDIF.

  • Asignamos el manejador de eventos

SET HANDLER ref_aplicacion->handle_item_double_click FOR ref_arbol.

  • Construimos el arbol

PERFORM build_node_and_item_table USING it_tabla_nodos

it_tabla_items.

CALL METHOD ref_arbol->add_nodes_and_items

EXPORTING

node_table = it_tabla_nodos

item_table = it_tabla_items

item_table_structure_name = 'ZPP_NODOS_ARBOL'

EXCEPTIONS

failed = 1

cntl_system_error = 3

error_in_tables = 4

dp_error = 5

table_structure_name_not_found = 6.

IF sy-subrc <> 0.

  • MESSAGE A000.

ENDIF.

ENDFORM. " crear_arbol

MODULE user_command_9001 INPUT.

  • DATA w_answer.

DATA return TYPE REF TO cl_gui_event.

CASE sy-ucomm.

WHEN 'BACK'.

CASE w_item.

WHEN '4' OR '5'.

  • Indicador de detalle de orden

w_item = '3'.

MOVE it_alv2[] TO it_alv[].

REFRESH it_alv2.

  • Modificamos el Catalogo

PERFORM modificar_catalogo USING w_item

w_node.

  • Refrescamos los datos del ALV

PERFORM refrescar_alv.

WHEN OTHERS.

break-point.

CALL METHOD ref_arbol->free

EXCEPTIONS

cntl_system_error = 1

cntl_error = 2.

CLEAR ref_arbol.

SET SCREEN 0.

LEAVE SCREEN.

  • CALL TRANSACTION sy-tcode.

ENDCASE.

WHEN 'EXIT'.

  • Confirmamos antes de Salir

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'

EXPORTING

textline1 = 'Desea salir del programa ?'

titel = 'Confirmación'

start_column = 25

start_row = 6

cancel_display = 'X'

IMPORTING

answer = w_answer.

IF w_answer = 'J'.

LEAVE PROGRAM.

ENDIF.

  • when others.

  • break-point.

  • call method cl_gui_cfw=>get_current_event_object

  • receiving

  • event_object = return.

  • call method cl_gui_cfw=>dispatch.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Read only

0 Likes
1,040

Have you tried destroying the docking container object(ref_dc_arbol) also?

REgards,

Rich Heilman

Read only

0 Likes
1,040

Hi Rich,

I destroy the docking container, but when i executed the report again nothing happends... the dc is not created again...

Regards,

Eric

Read only

0 Likes
1,040

Hi Rich,

Aparently i need to destroy all the objects in the screen, thas the only solution that i got right now.

Thanks for your tip, it was very usefull,

Regards,

Eric

Read only

0 Likes
1,040

Hi,

Could you please send the

PERFORM build_node_and_item_table USING it_tabla_nodos

it_tabla_items.

which is given for the building node and filling item table.

Urgent !!

Point rewarded

vijay

Read only

0 Likes
1,040

Hi Vijay,

Here is the code.

Regards,

Eric

FORM build_node_and_item_table USING it_tabla_nodos TYPE treev_ntab

it_tabla_items TYPE t_nodos.

DATA: wa_nodo TYPE treev_node,

wa_item TYPE zpp_nodos_arbol.

  • Llenamos la Tabla de Nodos

************************************************************************

  • OJO -> Los nodos son insertados en el arbol en la misma secuencia en *

  • que se llena la tabla. Por lo tanto, no deben insertarse nodos*

  • en la tabla antes que el nodo padre. *

************************************************************************

  • Nodo Raíz

CLEAR: wa_nodo-relatkey,

wa_nodo-relatship,

wa_nodo-n_image,

wa_nodo-exp_image,

wa_nodo-expander.

wa_nodo-node_key = 'Root'.

wa_nodo-hidden = ' '.

wa_nodo-disabled = ' '.

wa_nodo-isfolder = 'X'.

APPEND wa_nodo TO it_tabla_nodos.

CLEAR wa_item.

wa_item-node_key = 'Root'.

wa_item-item_name = '1'.

wa_item-class = cl_gui_list_tree=>item_class_text.

wa_item-alignment = cl_gui_list_tree=>align_auto.

wa_item-font = cl_gui_list_tree=>item_font_prop.

wa_item-text = 'Grupo de Órdenes'.

APPEND wa_item TO it_tabla_items.

SORT it_arbol BY veran aufnr.

  • Se crean los demas nodos

LOOP AT it_arbol.

MOVE it_arbol TO wa_arbol.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = wa_arbol-aufnr

IMPORTING

output = wa_arbol-aufnr.

AT NEW veran.

  • Nodos Hijos del Nodo Raíz

CLEAR wa_nodo.

wa_nodo-node_key = wa_arbol-veran.

wa_nodo-relatkey = 'Root'.

wa_nodo-relatship = cl_gui_list_tree=>relat_last_child.

wa_nodo-isfolder = 'X'.

APPEND wa_nodo TO it_tabla_nodos.

CLEAR wa_item.

wa_item-node_key = wa_arbol-veran.

wa_item-item_name = '2'.

wa_item-class = cl_gui_list_tree=>item_class_text.

wa_item-alignment = cl_gui_list_tree=>align_auto.

wa_item-font = cl_gui_list_tree=>item_font_prop.

CONCATENATE wa_arbol-veran wa_arbol-ktext

INTO wa_item-text SEPARATED BY space.

APPEND wa_item TO it_tabla_items.

ENDAT.

  • Contenido de los Nodos Hijo

CLEAR wa_nodo.

wa_nodo-node_key = wa_arbol-aufnr.

wa_nodo-relatkey = wa_arbol-veran.

wa_nodo-relatship = cl_gui_list_tree=>relat_last_child.

APPEND wa_nodo TO it_tabla_nodos.

CLEAR wa_item.

wa_item-node_key = wa_arbol-aufnr.

wa_item-item_name = '3'.

wa_item-class = cl_gui_list_tree=>item_class_text.

wa_item-length = 10.

wa_item-ignoreimag = 'X'.

wa_item-usebgcolor = ' '.

  • wa_item-t_image = '@01@'.

wa_item-text = wa_arbol-aufnr.

APPEND wa_item TO it_tabla_items.

ENDLOOP.

ENDFORM. " BUILD_NODE_AND_ITEM_TABLE

Read only

Former Member
0 Likes
1,040

You have to SET the VALUE - lifetime of container as LIFETIME_DYNPRO

like here:

CREATE OBJECT CONTAINER

EXPORTING

CONTAINER_NAME = I_CONTAINER

LIFETIME = CONTAINER->LIFETIME_DYNPRO

*REPID

*DYNNR

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.