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

Query on Expand_Node Method In Tree Control in ML12 tcode

Sidhant-Acharya
Participant
0 Likes
430

Hi All,

I am facing issues while expanding the node of the tree before this code am collapsing the tree but while expanding it shows run time error

i.e 'MESSAGE TYPE X' please let me know how to pass the correct node and my requirement is to expand only the top most node .

CALL METHOD gl_tree->expand_node

   EXPORTING

     node_key            = node_key

     level_count         = 0

     expand_subtree      = ' '

*   EXCEPTIONS

*     failed              = 1

*     illegal_level_count = 2

*     cntl_system_error   = 3

*     node_not_found      = 4

*     cannot_expand_leaf  = 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.

1 ACCEPTED SOLUTION
Read only

Sidhant-Acharya
Participant
0 Likes
377

Problem resolved I've added the below piece of code

data:node_key_table type  treev_nks.



node_key_table = node_table.



delete node_key_table index 1.



call method gl_tree->collapse_nodes

  exporting

    node_key_table          = node_key_table

*  EXCEPTIONS

*    failed                  = 1

*    cntl_system_error       = 2

*    error_in_node_key_table = 3

*    dp_error                = 4

*    others                  = 5

        .

if sy-subrc <> 0.

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

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

endif.

1 REPLY 1
Read only

Sidhant-Acharya
Participant
0 Likes
378

Problem resolved I've added the below piece of code

data:node_key_table type  treev_nks.



node_key_table = node_table.



delete node_key_table index 1.



call method gl_tree->collapse_nodes

  exporting

    node_key_table          = node_key_table

*  EXCEPTIONS

*    failed                  = 1

*    cntl_system_error       = 2

*    error_in_node_key_table = 3

*    dp_error                = 4

*    others                  = 5

        .

if sy-subrc <> 0.

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

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

endif.