Skip to Content
avatar image
Former Member

Can't change image and text of the node in CL_GUI_LIST_TREE dynamically

I have to change the node icon and node text at runtime from internal table, but not able to do, I have tried class CL_GUI_LIST_TREE with all necessary methods but can't update node image and node text. It shows only image and text which was assigned at first time tree execution.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 12, 2017 at 02:48 PM

    No issue for me. I duplicated SAPTLIST_TREE_CONTROL_DEMO, added the following code in method HANDLE_NODE_DOUBLE_CLICK, tested by double-clicking any node (not an item), and the new icon reflected immediately:

        CALL METHOD G_TREE->node_set_n_image
          EXPORTING
            node_key          = 'Root'
            n_image           = '@5B@'    " green light
          EXCEPTIONS
            failed            = 1
            node_not_found    = 2
            cntl_system_error = 3
            others            = 4.
        CALL METHOD G_TREE->node_set_exp_image
          EXPORTING
            node_key          = 'Root'
            exp_image         = '@5B@'
          EXCEPTIONS
            failed            = 1
            node_not_found    = 2
            cntl_system_error = 3
            others            = 4.
        CALL METHOD G_TREE->item_set_t_image
          EXPORTING
            node_key          = 'New1'
            item_name         = '1'
            t_image           = '@5B'
          EXCEPTIONS
            failed            = 1
            node_not_found    = 2
            item_not_found    = 3
            cntl_system_error = 4
            others            = 5.
    
    Add comment
    10|10000 characters needed characters exceeded