Foro -Documentación -Código fuente -Contacto -Empleo

Buscar

Traducir

Amazon

ZALVTREE PDF Imprimir E-mail
Usar puntuación: / 0
MaloBueno 
Código fuente - Ejemplos ALV
Jueves, 27 de Octubre de 2005 16:01
Ejemplo ALV Tree *&---------------------------------------------------------------------*
*& Report  YCB_PRUEBA167                                               *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
*KEY-WORDS: ARBOL, TREE, RS_TREE_CONSTRUCT, RS_TREE_LIST_DISPLAY,
*           MOSTRAR_ARBOL,
*EL SECRETO DE ESTO ES QUE EL PROGRAMA TENGA STATUS GUI CON LOS
*SIGUIENTES VALORES:
*
*Application TOOLBAR
*
*      NO HACE FALTA
*
*Standard Toolbar
*
*  REFR                            EL CIRCULO VERDE CON EL OK
*  TRRT       TREX       CANC      SERIAN EL BACK END Y CANC
*  TRSE       TRS+                 LARGAVISTAS Y LARGAVISTAS+
*Recommended function key settings
*  F2                             TRPI       Choose
report zalvtree.

INCLUDE <icon>.

************************************************************************
* DATA DECLARATION
************************************************************************

DATA: wa_node LIKE snodetext.
DATA: it_nodes LIKE snodetext OCCURS 0 WITH HEADER LINE.
DATA: callback_prog LIKE sy-repid.

************************************************************************
* MAIN PROCESSING SECTION
************************************************************************

START-OF-SELECTION.
 
  PERFORM cargar_tabla_tree.
  CALL FUNCTION 'RS_TREE_CONSTRUCT'
       TABLES
            nodetab            = it_nodes
       EXCEPTIONS
            tree_failure       = 01
            id_not_found       = 02
            wrong_relationship = 03.
 
  SET PF-STATUS 'STAT_104'.
 
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
       EXPORTING
            callback_program      = 'Y_CB_PRUEBA062'
            callback_user_command = 'CB_USER_COMMAND'
            check_duplicate_name  = '1'
            color_of_link         = '1'
            color_of_node         = '1'
            lower_case_sensitive  = ' '
            modification_log      = ' '
            node_length           = 40
            text_length           = 40
            text_length2          = 40
            return_marked_subtree = ' '
            screen_start_column   = 0
            screen_start_line     = 0
            screen_end_column     = 0
            screen_end_line       = 0
            suppress_node_output  = ' '
       IMPORTING
            f15                   = sy-ucomm.

************************************************************************
* FORMS
************************************************************************
&---------------------------------------------------------------------*
*&      Form  cargar_tabla_tree
*&---------------------------------------------------------------------*
FORM cargar_tabla_tree .

  CLEAR wa_node.
  wa_node-tlevel = '01'.
  wa_node-text = 'Nivel 1:Root:Listado tipo arbol'.
  wa_node-tlength = 50.
  wa_node-tcolor = '1'.
  wa_node-nodeicon = '@0A@'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '02'.

  wa_node-text = 'Nivel 2-Nodo 1'.

  wa_node-tlength = 50.

  wa_node-tcolor = '2'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '03'.

  wa_node-text = 'Nivel 2-Valor 1'.

  wa_node-tlength = 50.

  wa_node-tcolor = '3'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '03'.

  wa_node-text = 'Nivel 2-Valor 1'.

  wa_node-tlength = 50.

  wa_node-tcolor = '3'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '02'.

  wa_node-text = 'Nivel 2-Nodo 2'.

  wa_node-tlength = 50.

  wa_node-tcolor = '2'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '03'.

  wa_node-text = 'Nivel 3-Nodo 1'.

  wa_node-tlength = 50.

  wa_node-tcolor = '3'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '04'.

  wa_node-text = 'Nivel 4-Valor 4'.

  wa_node-tlength = 50.

  wa_node-tcolor = '4'.

  APPEND wa_node TO it_nodes.

 

  CLEAR wa_node.

  wa_node-tlevel = '04'.

  wa_node-text = 'Nivel 4-Nodo 1'.

  wa_node-tlength = 50.

  wa_node-tcolor = '4'.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '05'.

  wa_node-text = 'Nivel 5-Nodo 1'.

  wa_node-tlength = 30.

  APPEND wa_node TO it_nodes.

 

 

  CLEAR wa_node.

  wa_node-tlevel = '06'.

  wa_node-text = 'Nivel 6-Valor 6'.

  wa_node-tlength = 20.

  wa_node-tcolor = '5'.

 

  wa_node-text2 = 'TEXT5'.

  wa_node-tlength2 = 15.

  wa_node-tpos2 = 50.

 

  wa_node-text3 = 'ICON_RED_LIGHT'.

  wa_node-tlength3 = 20.

  wa_node-tpos3 = 70.

  wa_node-kind3 ='I'.

  wa_node-hotspot3 = 'X'.

 

  wa_node-text4 = '| PRUEBA2 |'.

  wa_node-tcolor4  = '3'.

  wa_node-tlength4 = 10.

  wa_node-tpos4 = 80.

  wa_node-kind4 =''.

 

  wa_node-text5 = 'PRUEBA3'.

  wa_node-tcolor5  = '4'.

  wa_node-tlength5 = 10.

  wa_node-tpos5 = 95.

  wa_node-kind5 =''.

 

 

  APPEND wa_node TO it_nodes.

 

 

ENDFORM.                    " cargar_tabla_tree

 

 

 

*---------------------------------------------------------------------*

*       FORM CB_USER_COMMAND                                          *

*---------------------------------------------------------------------*

*       ........                                                      *

*---------------------------------------------------------------------*

*  -->  NODELIST                                                      *

*  -->  UCOMM                                                         *

*  -->  EXIT                                                          *

*  -->  LIST_REFRESH                                                  *

*---------------------------------------------------------------------*

FORM cb_user_command

                      TABLES

                                nodelist STRUCTURE seucomm

                      USING

                                ucomm TYPE c

                      CHANGING

                                exit

                                list_refresh.

 

 

*-DATA DECLARATION------------------------------------------------------

 

  DATA: BEGIN OF lt_text OCCURS 1,

          text(150),

        END OF lt_text,

 

        lv_subrc   LIKE sy-subrc,

        lv_answer,

        lv_text(150),

        lv_text1(35),

        lv_text2(35).

 

  DATA v_campo1(20) TYPE c.

 

*-MAIN PROCESSING SECTION-----------------------------------------------

 

 

* OTROS CAMPOS DE NODELIST

*   ID

*   TLEVEL

*   LEAF

*   PARENT

*   NEXT

*   TEXT

 

 

* Lee el nodo que se seleccionó.

  READ TABLE it_nodes INDEX nodelist-id.

 

  IF sy-subrc = 0.

 

*   Si es una hoja final del arbol.

    IF nodelist-leaf = 'X'.

 

 

      GET CURSOR FIELD v_campo1.

 

      IF v_campo1 = 'ICON_RED_LIGHT'.

        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

             EXPORTING

                  titel        = 'PRESIONO EN SEMAFORO ROJO'

                  textline1    = nodelist-text

                  textline2    = ' '

                  start_column = 25

                  start_row    = 6.

        EXIT.

      ENDIF.

 

 *      write: at sy-LINNO 'Esto es una prueba.'.

      CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
           EXPORTING
                titel        = 'Seleccion de Arbol'
                textline1    = nodelist-text
                textline2    = ' '
                start_column = 25
                start_row    = 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.
*     write: NODELIST-text.
    ENDIF.
  ENDIF
ENDFORM.
Comentarios
Buscar
¡Sólo los usuarios registrados pueden escribir comentarios!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
home search