Start of Content Area

Function documentation Checkbox Display  Locate the document in its SAP Library structure

Use

A checkbox displays two statuses: the indicator is set (a checkbox is displayed in the field) or it is not set (the field is empty).

Both statuses can be overwritten by the activation: if a checkbox is enabled (the field is white), the user can change the status of the checkbox by clicking on it. If the checkbox is disabled (the field is gray) a click does not change anything.

You are able to display your ALV output in cells or items.

Note

In the class ABAP list and the hierarchical-sequential list, you are able to use display type to determine that a checkbox be displayed in front of every row for the user to select the row.

You are able to display checkboxes in all ALV tools. In the classic ABAP list and the hierarchical-sequential list, however, you are not able to activate the checkboxes, which means the user is not able to change the value of a checkbox.

If the User Changes the Value

You are able to enable checkboxes, which means you allow the user to change the value of the checkbox. Then you are able to handle the following events with your application:

·        In the simple, two-dimensional table, the user triggers the event LINK_CLICK from class CL_SALV_EVENTS_TABLE by changing the checkbox.

·        In the tree structure, the user triggers the event CHECKBOX_CHANGE from class CL_SALV_EVENTS_TREE

Data Type, Cell Type and Value

The cells or items in which you wish to display the checkbox must have an alphanumeric data type.

Depending on whether you are using checkboxes in list-type ALV outputs or in the tree structure, you proceed differently when setting the value of the checkbox:

·        In the tree structure, you set two properties of individual items:

¡        Checkbox can be changed/cannot be changed

¡        Indicator is set/not set

·        In the other ALV tools, you control the display of the checkbox using the combination of cell type and value of the cell:

¡        The CHECKBOX cell type always displays a disabled checkbox. The cell type CHECKBOX_HOTSPOT shows an enabled checkbox

¡        For the values ’1’ or  ’X’, the indicator for the checkbox is set. For the values ’0’ or ’ ’ , the indicator is not set.

The following table shows which value a cell or an item needs to include so that the checkbox is displayed as you want it to be:

Value of a Checkbox

Checkbox

Description

Cell Type

Value of the Cell

This graphic is explained in the accompanying text

Checkbox enabled
Indicator not set

CHECKBOX_
HOTSPOT

’0’ or ’ ’

This graphic is explained in the accompanying text

Checkbox enabled
Indicator set

CHECKBOX_
HOTSPOT

’1’ or ’X’

This graphic is explained in the accompanying text

Checkbox disabled
Indicator not set

CHECKBOX

’0’ or ’ ’

This graphic is explained in the accompanying text

Checkbox disabled
Indicator set

CHECKBOX

’1’ or ’X’

 

Checkbox hidden

CHECKBOX

CHECKBOX_
HOTSPOT

’-’

Features

You are able to make the following settings for checkboxes:

·        Display checkbox (assign cell and item type)

·        Enable/disable checkbox in the item

·        Set/remove indicator for the checkbox in the item

Checkbox Display

·        To display a disabled checkbox in a list-type ALV output, use the cell type CHECKBOX.

·        To display an enabled checkbox in the simple, two-dimensional table (full screen or container), use the cell type CHECKBOX_HOTSPOT.

·        To display a checkbox in a tree structure, use the type of item CHECKBOX

Enable/Disable Checkbox in the Item

In order for the user to be able to change the value of a checkbox in the tree structure, you have to enable it.

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table

No

No

No

Hierarchical-sequential list

No

 

 

Tree structure

 

Yes

Yes

Methods

Function

Class

Method

Enable checkbox

CL_SALV_ITEM

SET_EDITABLE

Prüfen, ob Ankreuzfeld aktiviert ist

IS_EDITABLE

Enable/Disable the Checkbox in the Cell

In list-type ALV outputs, you enable or disable a checkbox using the cell type:

·        To display a disabled checkbox in a list-type ALV output, use the cell type CHECKBOX.

·        To display an enabled checkbox in the simple, two-dimensional table (full screen or container), use the cell type CHECKBOX_HOTSPOT.

Set/Remove Indicator for the Checkbox in the Item

You are able to change the value of a checkbox in the tree structure using your application.

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table

No

No

No

Hierarchical-sequential list

No

 

 

Tree structure

 

Yes

Yes

Methods

Function

Class

Method

Set the indicator for the checkbox

CL_SALV_ITEM

SET_CHECKED

Check whether the indicator for the checkbox is set

IS_CHECKED

Set/Remove Indicator for the Checkbox in the Cell

In list-type ALV outputs, you can only control whether the indicator of a checkbox is set or not with the value of the cell. In enabled checkboxes (cell type CHECKBOX_HOTSPOT), you are able to use the event LINK_CLICK to adapt the value of the cell when the user clicks on the checkbox.

 

End of Content Area