Tuesday, April 17, 2018

Adding Logo to SAP ALV Report

UPLOADING LOGO

To add a logo to ALV header, we need to have a logo uploaded in to SAP system. The following steps will show you how to upload a customise logo.
First, go to transaction Business Document Navigator (OAOR).
Enter the Class name, Class type, and a name for the logo in Object Key. Then Execute (F8).

On the left-bottom panel, expand Standard Doc. Types and double click on Screen.

On the pop-up window, select the logo file that we want to upload. Then click Open.
Enter description for the logo and press continue. Logo will be saved to system.

ABAP Program
REPORT  zaddlogo.

TYPE-POOLSslis" SLIS contains all the ALV data types

*&———————————————————————*
*& Data Declaration
*&———————————————————————*

DATAlt_sflight TYPE TABLE OF sflight.
DATAg_repid   TYPE sy-repid.
*ALV Header declarations
DATAlt_header        TYPE slis_t_listheader,
              ls_header       TYPE slis_listheader,
              lt_line             LIKE ls_header-info,
              lv_lines          TYPE i,
              lv_linesc(10TYPE c.

*&———————————————————————*
*& START-OF-SELECTION
*&———————————————————————*
START-OF-SELECTION.

g_repid sy-repid.
*&—– Fetch data from the database —–*
SELECT *
      FROM sflight
      INTO TABLE lt_sflight.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
            i_callback_program g_repid
            i_callback_top_of_page 'TOP-OF-PAGE'
            i_structure_name 'SFLIGHT'
      TABLES
            t_outtab lt_sflight.

*———————————————————–*
* Form TOP-OF-PAGE
* Generating Report Header
*———————————————————–*
FORM top-of-page.

*&—– Alv report header —–*
* Title
ls_header-typ 'H'.
ls_header-info 'SFLIGHT Table Report'.
APPEND ls_header TO lt_header.
CLEAR ls_header.

* Date
ls_header-typ 'S'.
ls_header-key 'Date: '.
CONCATENATE sy-datum+6(2'.'
                               sy-datum+4(2'.'
                              sy-datum(4)

                  INTO ls_header-info"todays date
APPEND ls_header TO lt_header.
CLEARls_header.

* Total No. of Records Selected
DESCRIBE TABLE lt_sflight LINES lv_lines.
lv_linesc lv_lines.
CONCATENATE 'Total No. of Records Selected: ' lv_linesc
            INTO lt_line SEPARATED BY space.
ls_header-typ 'A'.
ls_header-info lt_line.
APPEND ls_header TO lt_header.
CLEARls_headerlt_line.
*&—– Pass data and field catalog to ALV function module —–*

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
            it_list_commentary lt_header

            i_logo                          'TESTLOGO'.

ENDFORM"top-of-page

Output:



4 comments:

  1. Very nice article for SAP which I have seen and it's absolutely great stuff on SAP ABAP. Thanks for such a cool article about SAP ABAP topics. Very good explanation on SAP concepts we do SAP Training in Chennai for all SAP Modules.
    Regards,
    SAP ABAP Training Institutes in Chennai | SAP ABAP Training in Chennai

    ReplyDelete
  2. Very valuable information,Keep sharing such type of post.

    SAP ABAP Classes in Pune

    ReplyDelete
  3. Hi,Thanks for sharing this information
    SAP ABAP course in Pune
    https://www.sevenmentor.com/sap-abap-course-in-pune.php

    ReplyDelete
  4. Hi,Thanks for sharing this information [url=https://www.sevenmentor.com/sap-abap-course-in-pune.php]SAP ABAP course in Pune[/url]

    ReplyDelete