Application Development 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: 

Place Icons in ALV Tree Top of Page using CL_GUI_ALV_TREE

Former Member
0 Kudos

Hello All,

I have created a ALV Hierarchy Tree Report. I have requirement of placing Traffic light icons in TOP of Page of the report. Using slis_t_listheader i have populated Top of Page but i am not able to display icon using this slis_t_listheader when i pass the Icon ID as @08@ to pit_list_commentary it doesnt display any icon. It display the text what ever we pass.

Please let me know if there is any other way to place icons in Top Of Page with class CL_GUI_ALV_TREE.

CLEAR lwa_line.

lwa_line-typ = lc_s.

lwa_line-key = text-t07.

lwa_line-info = '@08@'.

APPEND lwa_line TO pit_list_commentary.

Thanks & Regards

Sathish

7 REPLIES 7

MarcinPciak
Active Contributor
0 Kudos

You can easily achieve this by means of Dynamic Documents . Please refer [this blog|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4046] [original link is broken] [original link is broken] [original link is broken];.

Regards

Marcin

0 Kudos

Hello,

Guess we cannot implement this logic of dynamic document to class CL_GUI_ALV_TREE. It can be implemented only to CL_GUI_ALV_GRID because in the event TOP_OF_PAGE we dont have any import parameter for CL_GUI_ALV_TREE but we do have for CL_GUI_ALV_GRID.

Thanks

Satty

0 Kudos

Yes, that's true. But I believe you could use that event just to trigger handler method and there simply create dynamic document. As long as it uses global variable of ref to DD. you should be able to show it in top part anyway.

I also think this should work without any events, you simply spilt the main container into two part, use top one for DD and bottom one for ALV tree. So having the handler for aforementioned event is optional, not mandatory, but is welcome as it defines the point when DD creation takes place. Try it out.

Regards

Marcin

0 Kudos

Hello Pciak,

I tried it out with cl_dd_document it doesnt seem to work. Do u have so sample code where u have already used such functionality where it works? Please do help if you have done it.

Thanks & Regards

Sathish

0 Kudos

Here you go



DATA: gr_tree TYPE REF TO cl_gui_alv_tree,
      gr_dd   TYPE REF TO cl_dd_document.

DATA: gr_ccont TYPE REF TO cl_gui_custom_container,
      gr_tcont TYPE REF TO cl_gui_container,
      gr_bcont TYPE REF TO cl_gui_container,
      gr_split TYPE REF TO cl_gui_splitter_container.

DATA: it_sflight TYPE TABLE OF sflight.

SELECT * FROM sflight INTO TABLE it_sflight UP TO 10 ROWS.

CALL SCREEN 100.

*----------------------------------------------------------------------*
*  MODULE pbo OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.
  CREATE OBJECT gr_ccont
    EXPORTING
      container_name              = 'CUSTOM'.


  CREATE OBJECT gr_split
    EXPORTING
       parent            = gr_ccont
       rows              = 2
       columns           = 1.

  "get top container
  CALL METHOD gr_split->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = gr_tcont.

  "get bottom container
  CALL METHOD gr_split->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = gr_bcont.

"create tree and display it bottom container
  CREATE OBJECT gr_tree
    EXPORTING
      parent                      = gr_bcont.

  CALL METHOD gr_tree->set_table_for_first_display
    EXPORTING
      i_structure_name = 'SFLIGHT'
    CHANGING
      it_outtab        = it_sflight.

"create dd and display it in top container
   CREATE OBJECT gr_dd.

  CALL METHOD gr_dd->add_icon
          EXPORTING sap_icon  = 'ICON_DUMMY'.

  call METHOD gr_dd->merge_document( ).

  call METHOD gr_dd->display_document( EXPORTING parent = gr_tcont ).

ENDMODULE.                    "pbo OUTPUT

Regards

Marcin

0 Kudos

Thank you very much for your valuable input. One more question is it possible to place hot spot or double click option to the icon what we place in TOP-OF-PAGE. If possible please let me know how to achieve it.

Your Inputs would be most valuable.

Thanks you very much.

Satty.

0 Kudos

On icon I don't think so, but you can create a [link|http://help.sap.com/saphelp_nw70/helpdata/EN/b6/ab3a9003ac11d4a73f0000e83dd863/frameset.htm] which when clicked handle the event clicked OF cl_dd_link_element .

Refer demo program DD_ADD_LINK .

Regards

Marcin