Show TOC

Using Self-Defined, Application-Specific FunctionsLocate this document in the navigation structure

Use

You are able to provide functions that are specially customized to your application. To allow users to use these functions, you display pushbuttons or, as long as you have access to the screen status menu entries.

When Users Execute the Function

If users select the pushbutton for a function that you have defined, they trigger the event ADDED_FUNCTION of classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE. If you register your application for this event, you get control in the method for the event handler and can start your desired function code.

Arrangement of the Pushbuttons

Depending on whether you use a self-defined 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 the container display (simple, two-dimensional table or tree structure) you are able to choose whether you want to place the pushbuttons for self-defined functions to the right or the left of the pushbutton for the generic ALV functions: You also use the sequence in which you create the self-defined functions to set the sequence of the pushbuttons.

    Note

    In the container display, you are only able to add pushbuttons in the application toolbar. You are not able to generate menu entries.

  • 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 create the functions.

Features

You are able to make the following settings for self-defined functions:

  • Get function settings

  • Create and display self-defined functions

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

  • Instead of a self-defined function, execute a generic ALV function

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 self-defined 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

Function

Class

Method

Get FUNCTIONS object

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_FUNCTIONS

Create, Display, and Delete Self-Defined Functions

Depending on whether you use a self-defined function in an ALV output in a container or in a full-screen display, you proceed differently to display the function:

  • In the container display (simple, two-dimensional table or tree structure), you strictly create a function object with the desired properties and display the pushbutton.

  • In the other display types, you generate the function object indirectly by entering the self-defined function into the screen status . Here the function is display directly. You do not have to provide any other commands for the display.

In full-screen displays, you determine the appearance, tooltip and position for the function using the screen status, but in the container display, you make these settings when you are generating the function object.

ALV Tool

Display type

Function available

Simple, two-dimensional table

Classic ABAP List

No

Fullscreen

No

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

No

Tree Structure

Fullscreen

No

In the Container

Yes

Function

Class

Method

Create and display a function object for a self-defined function

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

ADD_FUNCTION

Delete function object

REMOVE_FUNCTION

Check whether a function object already exists

IS_ITEM

Set text for a pushbutton

ADD_FUNCTION (Parameter TEXT)

Set icon for a pushbutton

ADD_FUNCTION (Parameter ICON)

Set position within the application toolbar

ADD_FUNCTION (Parameter POSITION)

Set tooltip for the pushbutton

ADD_FUNCTION (Parameter TOOLTIP)

Check Visibility and Activation Status of a Self-Defined Function

You can show and hide pushbuttons or menu entries for self-defined functions. In addition you are also able to affect the operability of a self-defined function in contrast to generic ALV functions: you enable or disable the function.

For the visibility of self-defined functions, the following is valid:

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

For the activation status of self-defined functions, the following is valid:

ALV Tool

Display type

Function available

Simple, two-dimensional table

Classic ABAP List

No

Fullscreen

No

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

No

Tree Structure

Fullscreen

No

In the Container

Yes

Function

Class

Method

Show or hide a self-defined function

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

SET_FUNCTION

Check visibility

IS_VISIBLE

Enable / disable a self-defined function

ENABLE_FUNCTION

Check activation status

IS_ENABLED

Instead of a self-defined function, execute a generic ALV function

Usually you want to execute the self-defined function for which you have defined a pushbutton or menu entry upon user action. However, in specific cases, if you wish to execute a function other that the one originally set, you are able to specify the desired (alternative) generic ALV function in the event handler routine of the event ADDED_FUNCTION.

ALV Tool

Display type

Function available

Simple, two-dimensional table

Classic ABAP List

No

Fullscreen

No

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

No

Tree Structure

Fullscreen

No

In the Container

Yes

Function

Class

Method

Instead of a self-defined function, execute a generic ALV function

CL_SALV_TABLE CL_SALV_TREE

SET_FUNCTION