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:



show radio button in a single line


Program:

REPORT  zradiobtn.

*//Radio button design
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-s01.
*//Radio buttons design
  selection-SCREEN BEGIN OF LINE.
    PARAMETERSp_rad1 RADIOBUTTON GROUP grp1.
    selection-SCREEN COMMENT 10(15FOR FIELD p_rad1.
    PARAMETERSp_rad2 RADIOBUTTON GROUP grp1.
    selection-SCREEN COMMENT 30(15FOR FIELD p_rad2.
    PARAMETERSp_rad3 RADIOBUTTON GROUP grp1.
    selection-SCREEN COMMENT 50(15FOR FIELD p_rad3.
    PARAMETERSp_rad4 RADIOBUTTON GROUP grp1.
    selection-SCREEN COMMENT 70(15for FIELD p_rad4.
  selection-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK blk2.


Change the radio button name in teh selection texts





execute & check the output--




Drop Down lists in the selection parameters

PROGRAM ztest.   TYPE-POOLS : vrm.   DATA : name TYPE vrm_id,        list TYPE vrm_values,        value LIKE LINE OF list. ...