Add Title heading to ALV Grid incluing image or logo



In order to insert a report heading in to the ALV grid you need to perform the following steps:
Step 1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM
Step 2. Create 'top-of-page' FORM

The below code also shows you how to add a image to your ALV report.


 call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            i_save                  = 'X'
       tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.
*-----------------------------------------------------------*
* Form  TOP-OF-PAGE                                         *
*-----------------------------------------------------------*
* ALV Report Header                                         *
*-----------------------------------------------------------*
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
      wa_header type slis_listheader,
      t_line like wa_header-info,
      ld_lines type i,
      ld_linesc(10) type c.
* Title
  wa_header-typ  = 'H'.
  wa_header-info = 'EKKO Table Report'.
  append wa_header to t_header.
  clear wa_header.
* Date
  wa_header-typ  = 'S'.
  wa_header-key = 'Date: '.
  CONCATENATE  sy-datum+6(2) '.'
               sy-datum+4(2) '.'
               sy-datum(4) INTO wa_header-info.   "todays date
  append wa_header to t_header.
  clear: wa_header.
* Total No. of Records Selected
  describe table it_ekko lines ld_lines.
  ld_linesc = ld_lines.
  concatenate 'Total No. of Records Selected: ' ld_linesc
                    into t_line separated by space.
  wa_header-typ  = 'A'.
  wa_header-info = t_line.
  append wa_header to t_header.
  clear: wa_header, t_line.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
       exporting
            it_list_commentary = t_header
            i_logo             = 'ENJOYSAP_LOGO'.
endform.

Please note the above code will just show the enjoy SAP logo on you report and in oder to change this you need to do the following. But be aware this will change this image anywhere it is used!

Step 1 - Execute transaction OAOR

Step 2 - Enter following details and press execute
Class Name - PICTURES
Class Type - OT

Step 3 - You will then see a list of objects, one of which will be ENJOYSAP_LOGO. You could also have put 'ENJOYSAP_LOGO' within the object key field on the selection screen to just see this entry.

Step 4 - To see the image double-click 'SAP EnjoyLogo' within the screen folder, it's should then be displayed on the right hand side.


Step 5 - In-order to change the image associated with 'ENJOYSAP_LOGO', place your cursor on the folder name and within the bottom left panel select the create tab, expand 'Standard Doc. types and double click on 'Screen'


Step 6 - You will then see a file selection window where you can select a compatible image from your PC (i.e. .gif/.bmp/.png etc)

Step 7 - Enter a description and press the green tick. A message should be displayed confirming your action

Step 8 - You should now see your image in the ENJOYSAP_LOGO/SCREEN/ folder

Step 9 - Now wherever you use the ENJOYSAP_LOGO reference such as on your ALV report you should see your new logo.

Just a note, there must be a way to create new ones of these rather than changing this existing one but I am not sure how at the moment. I tried the create button but doesn't seem to do anything, unless it's some kind of authorisation issue.

Sorted it: I have now worked out how to create a new entry within the PICTURES class for your images. The method is not very obvious but once you know now, it is very easy to do. See HERE for simple step by step information on how to upload new ALV header images via transaction OAOR


Related Articles

ALV grid display - Example code and information for creating ALV grids using Function modules
Add User command functionality to ALVgrid report
ALV totals text
Display traffic light icon on ALV grid report
ALV grid display (inc. column total)
SAP ALV consistancy check
Change colour of individual SAP ALV cells within an ALV grid report
SAP ALV row colour change and making each individual row a different color
Make all or individual fields of an ALV grid editable
Add Footer functionality to ALVgrid report
Enhanced ALV grid display
Add Event functionality to ALVgrid report
Example Output from ALV grid display
Example Output from ALV grid display with report heading
Add User command functionality to ALVgrid report
Row selection of ALV grid
Add Default Sorting to ALVgrid report
Add User command functionality to ALVgrid report
ALV list display
ALV list display(ALV_LIST)
Example ALV report output
Internal table structure required for FM 'REUSE_ALV_FIELDCATALOG_MERGE'
Multiple ALV list display
Various ways to build an ALV Fieldcatalog within SAP
Add image to ALV report using OAOR tcode, without replacing the enjoy SAP logo
Transport an ALV variant with SAP