Application Development 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: 

EXPAND ALL NODES OF LIST TREE

Former Member
0 Kudos

HI,

i have requirement to expand all nodes of list tree .plz tell me how to do it

regards ,

venkat.

4 REPLIES 4

Former Member
0 Kudos

CALL METHOD obj_simple_tree->EXPAND_NODE

EXPORTING

NODE_KEY = node_key

  • EXPAND_PREDECESSORS =

  • EXPAND_SUBTREE =

  • LEVEL_COUNT =

EXCEPTIONS

NODE_NOT_FOUND = 1

others = 2.

IF SY-SUBRC <> 0.

MESSAGE i398(00) WITH 'Error' sy-subrc

'at methode EXPAND_NODE'.

ENDIF.

put these code within loop for all the nodes....

OR u can use method EXPAND_NODES directly

Reward point if helpful

Edited by: Amitava De on Jun 24, 2008 4:17 PM

former_member188685
Active Contributor
0 Kudos

You populate all the nodes and call method

EXPAND_NODES

0 Kudos

You can try the below code...

Everybody forgot to write that - you can only use this code in PAI and not in the PBO of the screen..

LOOP AT node_table INTO wa_node WHERE isfolder IS NOT INITIAL.

APPEND wa_node-node_key TO it_exp.

ENDLOOP.

CALL METHOD g_tree->expand_nodes

EXPORTING

node_key_table = it_exp

EXCEPTIONS

failed = 1

cntl_system_error = 2

error_in_node_key_table = 3

dp_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

Take care..

Former Member
0 Kudos

Hi,

For list display we use following function modules :

1. RS_TREE_CONSTRUCT

2. RS_TREE_LIST_DISPLAY

Below example will help you to generate list tree.

TABLES : mast,
         stpo.

PARAMETERS : p_matnr LIKE mast-matnr,
             p_werks LIKE mast-werks.

DATA char1.
DATA x TYPE i VALUE 1.
DATA qmenge(10) VALUE '1'.

DATA : node_tab LIKE snodetext OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

  node_tab-tlevel = x.
  node_tab-text = p_matnr.
  node_tab-tlength ='18'.
  APPEND node_tab.
  CLEAR node_tab.

  PERFORM drill_down1 USING p_matnr p_werks.
*&--------------------------------------------------------------------*
*&      Form  drill_down1
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM drill_down1 USING lv_matnr lv_werks.

  WRITE : /'|-' NO-GAP.
  DO x TIMES.
    WRITE : '-' NO-GAP.
  ENDDO.

  SELECT SINGLE * FROM mast WHERE matnr = lv_matnr AND werks = lv_werks.
  WRITE : lv_matnr.
  IF sy-subrc = 0.
    x = x + 1.

    SELECT * FROM stpo WHERE stlnr = mast-stlnr.

      lv_matnr = stpo-idnrk.

      MOVE stpo-menge TO qmenge.

      PERFORM drill_down1 USING lv_matnr lv_werks.

    ENDSELECT.

  ENDIF.

ENDFORM.                    "drill_down1

*&--------------------------------------------------------------------*
*&      Form  show_tree
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM show_tree .

  CALL FUNCTION 'RS_TREE_CONSTRUCT'
* EXPORTING
*   INSERT_ID                = '000000'
*   RELATIONSHIP             = ' '
*   LOG                      =
    TABLES
      nodetab                  = node_tab
* EXCEPTIONS
*   TREE_FAILURE             = 1
*   ID_NOT_FOUND             = 2
*   WRONG_RELATIONSHIP       = 3
*   OTHERS                   = 4

  .
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
   EXPORTING
*   CALLBACK_PROGRAM                =
*   CALLBACK_USER_COMMAND           =
*   CALLBACK_TEXT_DISPLAY           =
*   CALLBACK_MOREINFO_DISPLAY       =
*   CALLBACK_COLOR_DISPLAY          =
*   CALLBACK_TOP_OF_PAGE            =
*   CALLBACK_GUI_STATUS             =
*   CALLBACK_CONTEXT_MENU           =
*   STATUS                          = 'IMPLICIT'
*   CHECK_DUPLICATE_NAME            = '1'
*   COLOR_OF_NODE                   = '4'
*   COLOR_OF_MARK                   = '3'
*   COLOR_OF_LINK                   = '1'
*   COLOR_OF_MATCH                  = '5'
*   LOWER_CASE_SENSITIVE            = ' '
*   MODIFICATION_LOG                = ' '
*   NODE_LENGTH                     = 30
*   TEXT_LENGTH                     = 75
*   TEXT_LENGTH1                    = 0
*   TEXT_LENGTH2                    = 0
*   RETURN_MARKED_SUBTREE           = ' '
*   SCREEN_START_COLUMN             = 0
*   SCREEN_START_LINE               = 0
*   SCREEN_END_COLUMN               = 0
*   SCREEN_END_LINE                 = 0
*   SUPPRESS_NODE_OUTPUT            = ' '
*   LAYOUT_MODE                     = ' '
*   USE_CONTROL                     = STREE_USE_LIST
     use_control                     = 'L'.
* IMPORTING
*   F15                             =

ENDFORM.                    "show_tree

This will surely help you.

Plz reward if useful.

Thanks,

Dhanashri.