Skip to Content

GUI tree table to htmlb:tree table

I am trying to display a htmlb:tree where I reuse a function module that was used for a GUI tree control.

The function module (which I have to leave as it is) returns a table with the tree node information.

It seems that the data structure of the GUI-based table (TYPE TREEMSNODT) is a little different from the table structure that the htmlb:tree needs (TYPE TVIEW).

Do you have any examples of translating such a table from GUI to htmlb-style?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 20, 2005 at 08:29 AM

    I dont think that you will find a standard FM to do that. you may have to execute the function (GUI TREE TABLE) get the info in an itab and loop thru it and pass it to htmlb:tree table (TVIEW).

    also you may need to fill in some more info in TIVEW like onclick, staus, etc.

    <i>Do you have any examples of translating such a table from GUI to htmlb-st</i>

    loop at gui_itab into work_area .

    move: work_area-<a> to htmlb_itab_wa-<field_a> .

    ....

    ....

    append htmlb_itab_wa to htmlb_itab .

    endloop .

    i dont have access to SAP system right now, thus couldnt provide the exact field names. Hope you can follow the pattern explained.

    Regards

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2005 at 08:40 AM

    I think I managed the translation on my own. Mainly, it's just a loop, which become a litte more difficult if the GUI tree uses a node table (with the struture) AND an item table (with the IDs and texts).

    Maybe the following code helps others as well:

    * loop at gui tree control' node table   
    LOOP AT lt_gui_nodes ASSIGNING <fs_node>.
      CLEAR ls_node.
    
      ls_node-toggle   = space.
      ls_node-treeid   = 'tblTree'.
      ls_node-childid  = <fs_node>-node_key.
      ls_node-img      = <fs_node>-n_image. "htmlb tree can also handle e.g. '@5M@'.
    * ls_node-tlevel   = ?. "fortunately, you don't have to set tree level!
    
    * get the information from the GUI tree control's item table
      READ TABLE lt_item_tab
           ASSIGNING <fs_item>
           WITH KEY node_key = <fs_node>-node_key
                    item_name = 'the first column with the text'.
    
       ls_node-text = <fs_item>-text.
    
    *  node open, closed or final?
       IF <fs_node>-isfolder = 'X'.
         ls_node-status   = 'CLOSE'. "or 'OPEN'.
       ELSE.
         ls_node-status   = 'FINAL'.
       ENDIF.
    
       INSERT ls_node INTO TABLE me->t_tree.
     ENDLOOP.
    

    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.