Register Login

Different Steps for ALV Function Module

Updated May 18, 2018

SAP provides a set of ALV (ABAP LIST VIEWER) function modules, which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in SAP (Systems, Applications, Products in Data Processing) when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.

The commonly used ALV functions used for this purpose are;

  • REUSE_ALV_VARIANT_DEFAULT_GET
  • REUSE_ALV_VARIANT_F4
  • REUSE_ALV_VARIANT_EXISTENCE
  • REUSE_ALV_EVENTS_GET
  • REUSE_ALV_COMMENTARY_WRITE
  • REUSE_ALV_FIELDCATALOG_MERGE
  • REUSE_ALV_LIST_DISPLAY
  • REUSE_ALV_GRID_DISPLAY
  • REUSE_ALV_POPUP_TO_SELECT

The different steps used for getting the above function modules into use are :

DATA DECLARATION

Sap standard type pools: SLIS , KKBLO .

Sap standard tables types taken from the type pools are:

  • SLIS_LAYOUT_ALV
  • SLIS_T_FIELDCAT_ALV,
  • SLIS_T_LISTHEADER
  • SLIS_T_EVENT
  • SLIS_SELFIELD.

Internal tables to used in the program declared based on the above table types

DATA:

I_LAYOUT TYPE SLIS_LAYOUT_ALV I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV I_HEADING TYPE SLIS_T_LISTHEADER I_EVENTS TYPE SLIS_T_EVENT.

TYPES:

KKBLO_SELFIELD TYPE SLIS_SELFIELD.

SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)

The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.

The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.

Sample code:

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = variant save condition ( A=all, U = user-specific )

CHANGING

cs_variant = internal table containing the program name (and the default variant---optional )

EXCEPTIONS

not_found = 2.

The user can also choose from the list of existing variants using the function module ‘REUSE_ALV_VARIANT_F4’.

Read more about ABAP List Viewer (ALV) Interview Question and Answer

DEFININING OUTPUT CHARACTERISTICS: PREPARING DISPLAY FIELDS CATALOG

A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV. Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).

A field catalog is required for every ALV list output to add desired functionality (i.e. Key, Hotspot, Specific headings, Justify, Col. position etc) to certain fields of the output. If not mentioned specifically, then the defaults are taken. The possible values and defaults are listed below.

The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.

The minimal field catalog is documented below. This can be done in a routine using a local variable. The user can use the other optional parameters to assign output attributes to different fields in the output, which differ from the default.


 Download attached file.

You must be Logged in to download this file

×