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: 

How to display logo on ALV grid using cl_gui_alv_grid

Former Member
0 Kudos

Hi Experts,

Please let me know How to display logo on ALV grid using cl_gui_alv_grid ?.

Thanks,

Shivanand.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,


  data wls_layout   type	slis_layout_alv.
  data wlt_events   type	slis_t_event.
  data wls_events   type	slis_alv_event.
  data : gt_sort        type slis_t_sortinfo_alv with header line,
         gt_sort_l      type slis_sortinfo_alv,
         gs_sort like line of gt_sort.


  wls_layout-colwidth_optimize    = 'X'.
  wls_layout-zebra                = 'X'.
  wls_layout-detail_initial_lines = 'X'.
  wls_layout-detail_popup         = 'X'.
  wls_layout-get_selinfos         = 'X'.
  wls_layout-group_change_edit    = 'X'.

  clear wlt_events.

  wls_events-name = 'TOP_OF_PAGE' . "name.
  wls_events-form = 'TOP-OF-PAGE' . "form.
  append wls_events to wlt_events.

  clear gs_sort.
  gs_sort-fieldname = 'KUNNR'.
  gs_sort-tabname   = 'IT_FINAL_TAB'.
  gs_sort-spos      = '2'.
  gs_sort-up        = 'X'.
  gs_sort-subtot   = 'X'.
  append gs_sort to gt_sort.

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program = sy-repid
      is_layout          = wls_layout
      it_fieldcat        = wt_fieldcat[]
      it_sort            = gt_sort[]
      i_default          = 'X'
      i_save             = 'X'
      it_events          = wlt_events[]
    tables
      t_outtab           = it_final_tab[]
    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.
endform.                    " GRID_DISPLY
*&**********************************************************************&*
*&      Form  TOP-OF-PAGE                                               &*
*&**********************************************************************&*
form top-of-page.
  data : wlt_heading   type slis_t_listheader .
  data : wls_heading   type slis_listheader .
  data : l_tfill type sy-tfill,
         l_txt(30) type c,
         l_tfil(10) type c.

  describe table it_final_tab lines l_tfill.
  write : l_tfill to l_tfil.
  condense l_tfil.
  l_txt = text-t01.
  concatenate l_txt l_tfil into l_txt separated by space.

  clear wls_heading.
  clear wls_heading.
  wls_heading-info  = text-033.
  wls_heading-typ  = 'H'.
  append wls_heading to wlt_heading.

  clear wls_heading.
  wls_heading-info  = l_txt.
  wls_heading-typ  = 'S'.
  append wls_heading to wlt_heading.

*No need for Return Check as there is no Exception
  call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
     logo                      = 'SAPENJOY'             "use you logo
      it_list_commentary = wlt_heading. 
endform.                    " TOP-OF-PAGE

Edited by: Vijay Babu Dudla on Jan 16, 2009 4:19 AM

11 REPLIES 11

Former Member
0 Kudos

hi,


  data wls_layout   type	slis_layout_alv.
  data wlt_events   type	slis_t_event.
  data wls_events   type	slis_alv_event.
  data : gt_sort        type slis_t_sortinfo_alv with header line,
         gt_sort_l      type slis_sortinfo_alv,
         gs_sort like line of gt_sort.


  wls_layout-colwidth_optimize    = 'X'.
  wls_layout-zebra                = 'X'.
  wls_layout-detail_initial_lines = 'X'.
  wls_layout-detail_popup         = 'X'.
  wls_layout-get_selinfos         = 'X'.
  wls_layout-group_change_edit    = 'X'.

  clear wlt_events.

  wls_events-name = 'TOP_OF_PAGE' . "name.
  wls_events-form = 'TOP-OF-PAGE' . "form.
  append wls_events to wlt_events.

  clear gs_sort.
  gs_sort-fieldname = 'KUNNR'.
  gs_sort-tabname   = 'IT_FINAL_TAB'.
  gs_sort-spos      = '2'.
  gs_sort-up        = 'X'.
  gs_sort-subtot   = 'X'.
  append gs_sort to gt_sort.

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program = sy-repid
      is_layout          = wls_layout
      it_fieldcat        = wt_fieldcat[]
      it_sort            = gt_sort[]
      i_default          = 'X'
      i_save             = 'X'
      it_events          = wlt_events[]
    tables
      t_outtab           = it_final_tab[]
    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.
endform.                    " GRID_DISPLY
*&**********************************************************************&*
*&      Form  TOP-OF-PAGE                                               &*
*&**********************************************************************&*
form top-of-page.
  data : wlt_heading   type slis_t_listheader .
  data : wls_heading   type slis_listheader .
  data : l_tfill type sy-tfill,
         l_txt(30) type c,
         l_tfil(10) type c.

  describe table it_final_tab lines l_tfill.
  write : l_tfill to l_tfil.
  condense l_tfil.
  l_txt = text-t01.
  concatenate l_txt l_tfil into l_txt separated by space.

  clear wls_heading.
  clear wls_heading.
  wls_heading-info  = text-033.
  wls_heading-typ  = 'H'.
  append wls_heading to wlt_heading.

  clear wls_heading.
  wls_heading-info  = l_txt.
  wls_heading-typ  = 'S'.
  append wls_heading to wlt_heading.

*No need for Return Check as there is no Exception
  call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
     logo                      = 'SAPENJOY'             "use you logo
      it_list_commentary = wlt_heading. 
endform.                    " TOP-OF-PAGE

Edited by: Vijay Babu Dudla on Jan 16, 2009 4:19 AM

GauthamV
Active Contributor
0 Kudos

check this [logo in alv oops|https://forums.sdn.sap.com/click.jspa?searchID=21047246&messageID=6865394]

Former Member
0 Kudos

Study the standard report "BCALV_GRID_DEMO" .

Hope this would help you .

or

watch out this piece of code.


REPORT  zalv_oops_logo1.

TYPE-POOLS cndp.

*----declaration for logo display custom container
DATA  url(132).
* custom container
DATA pic_container TYPE REF TO cl_gui_custom_container.

* picture Control.
DATA picture TYPE REF TO cl_gui_picture.
DATA : ok_code LIKE sy-ucomm.
* Definition of Control Framework
CLASS cl_gui_cfw DEFINITION LOAD.

CALL SCREEN 100.

*endform.                    " field_catalog
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*

MODULE status_0100 OUTPUT.

  SET PF-STATUS 'STATUS'.
* create the custom container
  CREATE OBJECT pic_container
    EXPORTING
      container_name = 'CUSTOM'. "#name given in screen container
* create the picture control

* create the picture control
  CREATE OBJECT picture
    EXPORTING
      parent = pic_container.

* Request an URL from the data provider by exporting the pic_data.

  CLEAR url.
  PERFORM load_pic_from_db CHANGING url.

* load picture
  CALL METHOD picture->load_picture_from_url
    EXPORTING
      url = url.
*    init = 'X'.

  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error = 1
      cntl_error        = 2.
  IF sy-subrc  EQ 0.
* error handling
  ENDIF.



ENDMODULE.                 " exit  INPUT


*&---------------------------------------------------------------------*
*&      Form  LOAD_PIC_FROM_DB
*&---------------------------------------------------------------------*
*       text : loading logo
*----------------------------------------------------------------------*
FORM load_pic_from_db  CHANGING p_url.
  DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
  DATA html_table LIKE w3html OCCURS 1.
  DATA return_code LIKE  w3param-ret_code.
  DATA content_type LIKE  w3param-cont_type.
  DATA content_length LIKE  w3param-cont_len.
  DATA pic_data LIKE w3mime OCCURS 0.
  DATA pic_size TYPE i.

  REFRESH query_table.
  query_table-name = '_OBJECT_ID'.
  query_table-value = 'ENJOYSAP_LOGO'."#name of logo
  APPEND query_table.

  CALL FUNCTION 'WWW_GET_MIME_OBJECT'
    TABLES
      query_string        = query_table
      html                = html_table
      mime                = pic_data
    CHANGING
      return_code         = return_code
      content_type        = content_type
      content_length      = content_length
    EXCEPTIONS
      object_not_found    = 1
      parameter_not_found = 2
      OTHERS              = 3.
  IF sy-subrc = 0.
    pic_size = content_length.
  ENDIF.

  CALL FUNCTION 'DP_CREATE_URL'
    EXPORTING
      type     = 'image'
      subtype  = cndp_sap_tab_unknown
      size     = pic_size
      lifetime = cndp_lifetime_transaction
    TABLES
      data     = pic_data
    CHANGING
      url      = url
    EXCEPTIONS
      OTHERS   = 1.

ENDFORM.                    "load_pic_from_db
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

NB:In the screen layout of screen 100 create a custom controler named 'CUSTOM'.

Code Formatted: Vijay Babu Dudla on Jan 16, 2009 4:11 AM

sujeet2918
Active Contributor
0 Kudos

Hello Shivanand,

Before passing Logo In your function below :you just need to declare your logo globaly in SAP

Tcode for declaring Logo is OAOR

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

logo = 'SAPENJOY' "use you logo

it_list_commentary = wlt_heading.

endform. " TOP-OF-PAGE

In case any Problem get back to me.

Have a Nice Day,

Regards,

Sujeet

Former Member
0 Kudos

Hi,

Split the initial container into two. display the list in the bottom one.

Now in the top one create a object with reference to CL_DD_DOCUMENT. Use the method vertical_split of this class to split the top container again into two pieces. These split areas will refer to CL_DD_AREA.

Once that is done, use one of the areas to display your logo as shown below:-

call method document->vertical_split

exporting split_area = document

split_width = '70%'

importing right_area = a_logo.

call method a_logo->add_picture exporting picture_id = logo.

Hope this helps you.

Regards,

Anki Reddy

0 Kudos

Hello ,

How to split initially ? I am using cl_gui_custom_container ..

Can you please explain me in detail ?

Thanks,

Shivanand

Former Member
0 Kudos

Hi,

SE78 - BMP file we can upload and it display in ALV grid display.

Use FM 'REUSE_ALV_COMMENTARY_WRITE'

Regards

Md.MaahboobKhan

I355602
Advisor
Advisor
0 Kudos

Hi,

Use this link:-

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos

Hi,

step 1) upload image by using t-code OAOR

GOTO - OAOR (Business Document Navigator)

Give Class Name - PICTURES Class Type - OT..... then Execute

Step 2)

DATA: dd_doc_head TYPE REF TO cl_dd_document,

g_picture TYPE sdydo_key.

G_PICTURE = 'XXXX'->name of the image that you have uploaded in OAOR t-code

CALL METHOD DD_DOC_HEAD->ADD_PICTURE

EXPORTING

PICTURE_ID = G_PICTURE.

Thanks & Regards,

Sateesh.

0 Kudos

Thanks to all for useful reply

Former Member
0 Kudos

Answered