Show TOC

Using Generic ALV FunctionsLocate this document in the navigation structure

Use

You are able to provide functions so that users can work with the ALV output. The functions that the system provides for ALV are called generic ALV functions. Generic ALV functions include sorting, filtering, layouts settings and so on. Generic means that the system checks whether a function is useful for a specific situation. It enables or disables the pushbuttom or menu entry accordingly. On the other hand, with self-defined functions , the system cannot influence the activation status.

Note

The names of all generic ALV functions are listed as constants in the interfaces IF_SALV_C_FUNCTION LIST (for the simple, two-dimensional table and the hierarchical-sequential list) or IF_SALV_C_FUNCTION_TREE (for the tree structure).

When Users Execute the Function

When users select the pushbutton for a generic ALV function, they trigger two events (one after the other):

  • BEFORE_SALV_FUNCTION The event takes place before the function is executed

  • AFTER_SALV_FUNCTION The event takes place after the function is finished

Both events originate in the classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE.

If you register your application for these events, you are able to handle user actions and start a desired function.

Arrangement of the Pushbuttons

Depending on whether you use a generic function in an ALV output in a container or in a full-screen display, you proceed differently to set the position of a pushbutton or menu entry:

  • In container display (simple, simple two-dimensional table or tree structure) you are not able to change the sequence of the pushbuttons.

  • In the other display types, you use the screen status to set the position of a pushbutton or the menu entry. The pushbutton is then displayed at the position set here no matter in which sequence you call the SET functions.

    Note

    You are only able to set a function as a menu entry using the screen status. In the container display you are not able to influence the menu structure.

Function Groups

You are able to enable or disable every generic ALV function. Most generic ALV functions however, are part of groups of functions that have been grouped together logically. In this way, you are able to enable all of the functions for this group with one command.

Features

You are able to make the following settings for generic ALV functions:

  • Get function settings

  • Enable Generic ALV Functions

  • Check Visibility and Activation Status of a Self-Defined Function

The following is valid for all of these functions:

ALV Tool

Display type

Function available

Simple, two-dimensional table

Classic ABAP List

Yes

Fullscreen

Yes

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

Yes

Tree Structure

Fullscreen

Yes

In the Container

Yes

Get function settings

With every function that you activate, you generate an object of class CL_SALV_FUNCTION. You manage all of these objects using the list of all function objects: CL_SALV_FUNCTIONS_TREE (for the tree structure) or CL_SALV_FUNCTIONS_LIST (for the simple, two-dimensional table or the hierarchical-sequential list).

The method GET_FUNCTIONS that returns the settings for all functions exists in each main ALV class. Using this object, you make all settings for the generic ALV functions.

Function

Class

Method

Get FUNCTIONS object

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_FUNCTIONS

Get all function objects

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

GET_FUNCTIONS

Check whether a function is a generic ALV function

IS_SALV_FUNCTION

Enable Generic ALV Functions

For every generic ALV function, there is a setter method that you use to make the pushbutton or menu entry for the function visible and usable for the user.

You have various options for displaying generic ALV functions:

  • You enable each generic ALV function individually

  • You enable a function group. All of the functions for this function group are enabled simultaneously

  • You enable all generic ALV functions simultaneously

    Note

    In the list-type ALV outputs (simple, two-dimensional table and hierarchical-sequential list), there is also a preset default selection of the most frequent generic ALV functions.

Function

Class

Method

Enable individual generic ALV functions

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

SET_<generic ALV function>

Enable function group

SET_GROUP_<Function group>

Enable all generic ALV functions

SET_ALL

Enable preset default selection of generic ALV functions

CL_SALV_FUNCTIONS_LIST

SET_DEFAULT

Check Visibility and Activation Status of a Self-Defined Function

With the setter methods (see above), you render a generic ALV function visible or hidden. In some cases, a generic ALV function can be visible, but temporarily not operable: the generic ALV function is disabled.

Although you are able to change the activation status of self-defined functions, you do not have this option for generic ALV functions. Here the internal logic of ALV determines whether or not a function is operable.

Example

You set the group Filter , making the functions SET_FILTER and SET_FILTER_DELETE visible. However, as long as you have not defined a filter, the function SET_FILTER_DELETE remains deactivated.

You are able to check the activation status of a self-defined function However, the associated method does not include the activation status that the system has set based on its internal logic.

Caution

When you try to change the activation status of a generic ALV function, you get an error.

Function

Class

Method

Check visibility

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

IS_VISIBLE

Check activation status

IS_ENABLED