*----------------------------------------------------------------------* ***INCLUDE ZJUBE_R_ALV_CLASE_ARBOLF01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form arbol *&---------------------------------------------------------------------* FORM arbol. IF gv_contarbol IS INITIAL. CREATE OBJECT gv_contarbol EXPORTING container_name = 'MARCO_ARBOL'. CREATE OBJECT arbol EXPORTING parent = gv_contarbol node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single. wa_nodo-isfolder = 'X'. LOOP AT it_tabla INTO wa_tabla. AT NEW carrname. wa_nodo-node_key = wa_tabla-carrid. CLEAR wa_nodo-relatkey. CLEAR wa_nodo-relatship. wa_nodo-text = wa_tabla-carrname. CLEAR wa_nodo-n_image. CLEAR wa_nodo-exp_image. APPEND wa_nodo TO it_nodo. SELECT SINGLE * FROM sflight INTO wa_flight WHERE carrid = wa_tabla-carrid. CONCATENATE wa_tabla-carrid wa_tabla-carrid INTO wa_nodo-node_key. wa_nodo-relatkey = wa_tabla-carrid. wa_nodo-relatship = cl_gui_simple_tree=>relat_last_child. IF wa_flight IS INITIAL. wa_nodo-text = 'No Hay Vuelos disponibles'. ELSE. wa_nodo-text = 'Vuelos disponibles'. ENDIF. * CALL FUNCTION 'ICON_CREATE' EXPORTING name = 'ICON_FLIGHT' info = text-con IMPORTING RESULT = wa_nodo-n_image EXCEPTIONS OTHERS = 4. IF sy-subrc <> 0. wa_nodo-n_image = '@AV@'. ENDIF. wa_nodo-exp_image = wa_nodo-n_image. ENDAT. APPEND wa_nodo TO it_nodo. CLEAR wa_flight. ENDLOOP. arbol->add_nodes( table_structure_name = 'MTREESNODE' node_table = it_nodo ). wa_evento-eventid = cl_gui_simple_tree=>eventid_node_double_click. wa_evento-appl_event = ' '. APPEND wa_evento TO it_evento. arbol->set_registered_events( events = it_evento ). SET HANDLER gv_manejador->manejador_arbol FOR arbol. ENDIF. ENDFORM. " arbol