Skip to Content

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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.