Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

how to create a tree structure output screen to user,By clicking on each level of the tree, the lower level data can be seen, and by doble clicking the details have to come

$
0
0

TABLES : ekes, vepo, vekp.

 

TYPES : BEGIN OF ivekp,

        venum TYPE vekp-venum,

        exidv2 TYPE vekp-exidv2,

  END OF ivekp,

 

  BEGIN OF ivepo,

    vbeln TYPE vepo-vbeln,

    venum TYPE vepo-venum,

    END OF ivepo,

 

    BEGIN OF iekes,

      ebeln TYPE ekes-ebeln,

      vbeln TYPE ekes-vbeln,

      vbelp TYPE ekes-vbelp,

      xblnr TYPE ekes-xblnr,

      END OF iekes.

 

DATA : i_node TYPE TABLE OF snodetext,

       i_vekp TYPE TABLE OF ivekp,

       i_vepo TYPE TABLE OF ivepo,

       i_ekes TYPE TABLE OF iekes.

 

DATA : f_node TYPE snodetext,

       f_vekp TYPE ivekp,

       f_vepo TYPE ivepo,

       f_ekes TYPE iekes.

 

SELECT-OPTIONS :s_ebeln FOR ekes-ebeln.

 

START-OF-SELECTION.

 

  PERFORM get_ekes.

  PERFORM get_vepo.

  PERFORM get_vekp.

  PERFORM build_tree.

 

END-OF-SELECTION.

 

  PERFORM display_tree.

 

 

 

*&---------------------------------------------------------------------*

*&      Form  get_vepo

*&---------------------------------------------------------------------*

*       text

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

FORM get_vepo.

 

  SELECT venum

         vbeln

    FROM vepo INTO TABLE i_vepo

    FOR ALL ENTRIES IN i_ekes

    WHERE vbeln EQ i_ekes-vbeln.

ENDFORM.                    "get_vepo

 

 

*&---------------------------------------------------------------------*

*&      Form  get_vekp

*&---------------------------------------------------------------------*

*       text

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

FORM get_vekp.

 

  SELECT venum

         exidv2

    FROM vekp INTO TABLE i_vekp

    FOR ALL ENTRIES IN i_vepo

    WHERE venum EQ i_vepo-venum.

ENDFORM.                    "get_vekp

 

 

 

*&---------------------------------------------------------------------*

*&      Form  get_ekes

*&---------------------------------------------------------------------*

*       text

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

FORM get_ekes.

 

  SELECT ebeln

         vbeln

         vbelp

         xblnr

    FROM ekes INTO TABLE i_ekes

    WHERE ebeln IN s_ebeln.

ENDFORM.                    "get_ekes

*&---------------------------------------------------------------------*

*&      Form

*&---------------------------------------------------------------------*

*       text

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

 

*&---------------------------------------------------------------------*

*&      Form  build_tree

*&---------------------------------------------------------------------*

*       text

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

FORM build_tree.

 

  CLEAR : i_node, f_node.

 

  f_node-type = 'T'.

  f_node-name = 'Purchase Order'(002).

  f_node-tlevel = '01'.

  f_node-nlength = '20'.

  f_node-color = '5'.

  APPEND f_node TO i_node.

  CLEAR f_node.

 

 

  LOOP AT i_ekes INTO f_ekes.

 

 

    f_node-type = 'P'.

    f_node-tlevel = '02'.

    f_node-text1 = f_ekes-ebeln.

    f_node-tlength1 = '20'.

    f_node-tcolor1 = '3'.

    f_node-text2 = f_ekes-vbeln.

    f_node-tlength2 = '20'.

    f_node-tcolor2 = '3'.

    f_node-text3 = f_ekes-vbelp.

    f_node-tlength3 = '20'.

    f_node-tcolor3 = '3'.

    f_node-text4 = f_ekes-xblnr.

    f_node-tlength4 = '20'.

    f_node-tcolor4 = '3'.

    APPEND f_node TO i_node.

    CLEAR f_node.

 

    LOOP AT i_vepo INTO f_vepo WHERE vbeln EQ f_ekes-vbeln.

 

      f_node-type = 'P'.

      f_node-tlevel = '03'.

      f_node-text = f_vepo-vbeln.

      f_node-tlength = '20'.

      f_node-tcolor = '4'.

      f_node-text6 = f_vepo-venum.

      f_node-tlength6 = '20'.

      f_node-tcolor6 = '4'.

      APPEND f_node TO i_node.

      CLEAR f_node.

 

    ENDLOOP.

 

    LOOP AT i_vekp INTO f_vekp WHERE venum EQ f_vekp-venum.

 

      f_node-type = 'P'.

      f_node-tlevel = '04'.

      f_node-text = f_vekp-venum.

      f_node-tlength = '20'.

      f_node-tcolor = '5'.

      f_node-text6 = f_vekp-exidv2.

      f_node-tlength6 = '20'.

      f_node-tcolor6 = '5'.

      APPEND f_node TO i_node.

      CLEAR f_node.

 

    ENDLOOP.

  ENDLOOP.

 

ENDFORM.                    "build_tree

 

*&---------------------------------------------------------------------*

*&      Form  display_tree

*&---------------------------------------------------------------------*

*       text

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

FORM display_tree.

  CALL FUNCTION 'RS_TREE_CONSTRUCT'

    TABLES

      nodetab            = i_node

    EXCEPTIONS

      tree_failure       = 1

      id_not_found       = 2

      wrong_relationship = 3

      OTHERS             = 4.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'

    EXPORTING

      callback_program = sy-repid.

 

ENDFORM.        


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>