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: 

Output icon in REUSE_ALV_COMMENTARY_WRITE

jakob_steen-petersen
Active Participant
0 Kudos

Hi,

Does anyone know how to oupt an icon in REUSE_ALV_COMMENTARY_WRITE?

Jakob

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jacob,

use transaction OAER.

GIVE

CLASS NAME: PICTURES

CLASS TYPE : OT

OBJECT KEY: NAME OF THE (LOGO,ICON)

then execute

select standard document type & double click on screen

& upload your logo.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_top

I_LOGO = NAME OF THE (LOGO,ICON)

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

in that way you can display your logo.

Regards,

Tutun

8 REPLIES 8

Former Member
0 Kudos

Hello,

To use the logo in , you need to upload the logo in the system. this can done using the below given steps.

Steps for uploading Logo :-:

1. Goto the transaction OAER .

2. Enter the class name as 'PICTURES' .

3. Enter the class type as 'OT' .

4. Enter the object key as the name of the logo you wish to give .

5. Execute .

6. Then in the new screen select Standard doc. types in bottom window.

7. Click on the Screen icon.

8. Now, it will ask for the file path where you have the logo to be uploaded.

" Now you can use this logo in REUSE_ALV_COMMENTARY_WRITE .


  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' 
       EXPORTING 
           I_LOGO             = '<LOGO NAME>' 
           IT_LIST_COMMENTARY = <TABLE WITH HEADER>. 

Regards,

Sachinkumar Mehta

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer:

Hope this helps you.

Thanks & Regards,

Tarun

Former Member
0 Kudos

Hi Jacob,

use transaction OAER.

GIVE

CLASS NAME: PICTURES

CLASS TYPE : OT

OBJECT KEY: NAME OF THE (LOGO,ICON)

then execute

select standard document type & double click on screen

& upload your logo.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_top

I_LOGO = NAME OF THE (LOGO,ICON)

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

in that way you can display your logo.

Regards,

Tutun

0 Kudos

Hi everybody,

I don´t know why you all are talking about a Logo? I´m asking about how to include an ICON. An icon is something totally different. I want to include an Icon in the description like for example a Red cross.

Jakob

0 Kudos

Hello Jakob,

I am not sure about adding an icon using REUSE_ALV_COMMENTARY_WRITE.

But if you use I_CALLBACK_HTML_TOP_OF_PAGE you can add an icon. The class CL_DD_DOCUMENT has a method ADD_ICON which you can use to add an icon.

But note that if you use I_CALLBACK_HTML_TOP_OF_PAGE you will not be able to print the TOP-OF-PAGE.

As they say, "There is a price for everything !!"

BR,

Suhas

0 Kudos

Suhas is right. If you use HTML_TOP_OF_PAGE and CL_DD_DOCUMENT,you can add icon to your alv header.The following code has been verified.

REPORT  zalv_test_list.

TYPE-POOLS:slis,icon.

DATA: td_sflight TYPE STANDARD TABLE OF sflight,
      th_sflight TYPE sflight.

DATA: td_field  TYPE slis_t_fieldcat_alv,
      th_field  TYPE slis_fieldcat_alv,
      td_head   TYPE slis_t_listheader WITH HEADER LINE,
      w_lines   TYPE sy-tabix.

SELECT * FROM sflight
    UP TO 100 ROWS
  INTO TABLE td_sflight.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_structure_name       = 'SFLIGHT'
  CHANGING
    ct_fieldcat            = td_field
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2
    OTHERS                 = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM    = sy-repid
    i_callback_html_top_of_page = 'TOP_OF_PAGE'
    it_fieldcat   = td_field
*    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
  TABLES
    t_outtab      = td_sflight
  EXCEPTIONS
    program_error = 1
    OTHERS        = 2.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_of_page USING document
                       TYPE REF TO cl_dd_document.

*  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
*    EXPORTING
*      it_list_commentary       = td_head
**       I_LOGO                  = textbutton
**     I_END_OF_LIST_GRID       =
**     I_ALV_FORM               =
*            .
  call method document->new_line.
  CALL METHOD document->add_icon
    EXPORTING
      sap_icon         = 'ICON_GREEN_LIGHT'
*    sap_size         =
*    sap_style        =
*    sap_color        =
*    alternative_text =
*    tabindex         =
      .
  call method document->new_line.
ENDFORM.                    "TOP_OF_PAGE

0 Kudos

Thats what i like!

Thank you...

Jakob

venkat_o
Active Contributor
0 Kudos

Hi, <li>Using the above function module, i tried but not succeeded. succeeded using normal ALV using REUSE_ALV_LIST_DISPLAY. <li>Try below program .


 REPORT ZVENKAT_ALV_TRAFFIC_LIGHTS .
 TYPE-POOLS:ICON.
 DATA:BEGIN OF IT_DATA OCCURS 0,
        MATNR  TYPE MARD-MATNR,
        WERKS  TYPE MARD-WERKS,
        LGORT  TYPE MARD-LGORT,
       END OF IT_DATA.
 TYPE-POOLS:SLIS.
 TYPES:
    T_FIELDCAT         TYPE SLIS_FIELDCAT_ALV,
    T_EVENTS           TYPE SLIS_ALV_EVENT,
    T_LAYOUT           TYPE SLIS_LAYOUT_ALV.
* Workareas
 DATA:
    W_FIELDCAT         TYPE T_FIELDCAT,
    W_EVENTS           TYPE T_EVENTS,
    W_LAYOUT           TYPE T_LAYOUT.
* Internal Tables
 DATA:
    I_FIELDCAT         TYPE STANDARD TABLE OF T_FIELDCAT,
    I_EVENTS           TYPE STANDARD TABLE OF T_EVENTS.
 START-OF-SELECTION.
   SELECT MATNR WERKS  LGORT FROM MARD INTO CORRESPONDING FIELDS OF TABLE IT_DATA UP TO 10 ROWS.
   W_EVENTS-NAME = 'TOP_OF_PAGE'.
   W_EVENTS-FORM = 'TOP_OF_PAGE'.
   APPEND W_EVENTS TO I_EVENTS.
   CLEAR:W_FIELDCAT,I_FIELDCAT[].
   W_FIELDCAT-FIELDNAME     = 'MATNR'.
   W_FIELDCAT-TABNAME       = 'IT_DATA'.
   W_FIELDCAT-SELTEXT_M     = 'MATNR'.
   APPEND W_FIELDCAT TO I_FIELDCAT.
   CLEAR W_FIELDCAT.
   W_FIELDCAT-FIELDNAME     = 'WERKS'.
   W_FIELDCAT-TABNAME       = 'IT_DATA'.
   W_FIELDCAT-SELTEXT_M     = 'WERKS'.
   APPEND W_FIELDCAT TO I_FIELDCAT.
   CLEAR W_FIELDCAT.
   W_FIELDCAT-FIELDNAME     = 'LGORT'.
   W_FIELDCAT-TABNAME       = 'IT_DATA'.
   W_FIELDCAT-SELTEXT_M     = 'LGORT'.
   APPEND W_FIELDCAT TO I_FIELDCAT.
   CLEAR W_FIELDCAT.

   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
       I_CALLBACK_PROGRAM     = SY-REPID
       IS_LAYOUT              = W_LAYOUT
       IT_FIELDCAT            = I_FIELDCAT
       IT_EVENTS              = I_EVENTS
     TABLES
       T_OUTTAB               = IT_DATA.
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
 FORM TOP_OF_PAGE.
  WRITE:/ 'top_of_page start'.
  WRITE:/ '@08@',"  Green light; positive
          '@09@',"  Yellow light; neutral
          '@0A@'."  Red light; negative
  WRITE:/ 'top_of_page end'.
 ENDFORM.                    "top_of_page
Thanks Venkat.O