Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Populating Tree UI Element

Hi,

I have created a view with tree UI Element,

I have populated the root and node level of tree thro static values.and i am populating item level node thro an internal table.,

the issue is like i am getting onli the last element of the int table.My code is as follows..



  data:
    node_drive                          type ref to if_wd_context_node,
    elem_drive                          type ref to if_wd_context_element,
    stru_drive                          type if_sec=>element_drive .
* navigate from <CONTEXT> to <DRIVE> via lead selection
  node_drive = wd_context->get_child_node( name = if_sec=>wdctx_drive ).

* get element via lead selection
  elem_drive = node_drive->get_element(  ).

  call method node_drive->set_attribute
    exporting
*    INDEX  = USE_LEAD_SELECTION
      value  = wa_drive-d_name
       name   = 'DRIVENAME'
  .

  data:
*    node_drive                          TYPE REF TO if_wd_context_node,
    node_folder                         type ref to if_wd_context_node,
    elem_folder                         type ref to if_wd_context_element,
    stru_folder                         type if_sec=>element_folder .
* navigate from <CONTEXT> to <DRIVE> via lead selection
  node_drive = wd_context->get_child_node( name = if_sec=>wdctx_drive ).

* navigate from <DRIVE> to <FOLDER> via lead selection
  node_folder = node_drive->get_child_node( name = if_sec=>wdctx_folder ).

* get element via lead selection
  elem_folder = node_folder->get_element(  ).


  call method node_folder->set_attribute
     exporting
*    INDEX  = USE_LEAD_SELECTION
       value  = wa_folder-f_name
        name   = 'FOLDERNAME'
 .


  data:
    node_file                           type ref to if_wd_context_node,
    elem_file                           type ref to if_wd_context_element,
    stru_file                           type if_sec=>element_file .
* navigate from <CONTEXT> to <DRIVE> via lead selection
  node_drive = wd_context->get_child_node( name = if_sec=>wdctx_drive ).

* navigate from <DRIVE> to <FOLDER> via lead selection
  node_folder = node_drive->get_child_node( name = if_sec=>wdctx_folder ).

* navigate from <FOLDER> to <FILE> via lead selection
  node_file = node_folder->get_child_node( name = if_sec=>wdctx_file ).

*  SORT it_fname BY fn_name.


CALL METHOD node_file->bind_table
     EXPORTING
       new_items            = it_fname
*       SET_INITIAL_ELEMENTS = ABAP_TRUE
*       INDEX                =
       .


  loop at it_fname into  wa_fname.

    at new fn_name .
     call method node_file->create_element
*        EXPORTING
*          STATIC_ATTRIBUTE_VALUES =
          receiving
            element                 = elem_file
            .

      call method node_file->set_attribute
        exporting
*    INDEX  = USE_LEAD_SELECTION
          value  = wa_fname-fn_name
          name   = 'FILENAME'
          .
    endat.
  endloop.
 endmethod.

how to acheive this....

thanks in advance

Arjun.G

Former Member
Not what you were looking for? View more on this topic or Ask a question