Entering content frameFunction documentation Checkboxes Locate the document in its SAP Library structure

Use

Checkboxes can be used to select multiple rows for which a specific action (such as deleting the rows or setting the complete indicator) is to be performed. Checkboxes are particularly useful in the Web environment since only one roundtrip is required for operations affecting multiple rows

Prerequisites

You must use the MiniALV as part of a MiniApp to be able to evaluate checkboxes.

Integration

To use checkboxes in a column of the MiniALV, you must reserve one column of the output table in the proxy report for the output of checkboxes.

Checkboxes in the ALV Grid Control (Standard)

To do this, you add a field to your output table:

DATA: BEGIN OF GT_OUTTAB OCCURS 0.
INCLUDE STRUCTURE
<DDIC-Struktur> .

DATA: checkbox TYPE C. "to display checkboxes

DATA: END OF GT_OUTTAB.

In the field catalog you must then set the CHECKBOX field for this column and pass the field catalog when SET_TABLE_FOR_FIRST_DISPLAY is called.

Note

The checkboxes in the MiniALV are always ready for input.

Checkboxes Through REUSE_MINIALV_LIST_DISPLAY (AddOn)

See: Using Checkboxes.

Features

Functions for Getting and Setting the State

A number of Javascript functions have been implemented in the MiniALV service that are used to get or set the state of the checkboxes: :

Event Handling

The MiniALV triggers a Javascript event if the user changes the state of a checkbox.

Note

Handling the event is only required for specific application functions. Depending on whether rows have been selected at all, you can, for example, enable or disable buttons in the HTML template.

You use the function MiniALV_CheckBoxClicked(Name) to handle this event:

function MiniALV_CheckBoxClicked (name) {
<Do something>
}

Insert these lines of code into an HTML template and add functions as required.

Evaluating the Checkboxes

In the following documentation, the Internet service CCMS_ALVIEWER is used to illustrate the steps necessary to evaluate checkboxes. The service uses the Standard MiniALV, but the example described here can also be applied to the AddOn MiniALV. The basic idea is to include all checkboxes in a hidden HTML form.

Templates in the CCMS_ALVIEWER Service

TEMPLATE

Use

START

Sets general parameters, especially readdatatable , to transfer the entire data table.

ALVIEWER

Includes the MiniALV service (display of the report), the TOOLBAR template (implementation of the pushbuttons) and the ALERTTABLE template (definition of the HTML form).

The function module SALWP_ACKNOWLEDGE_ALERT_TBL is called in the flow file at the flow event acknowledgeAlerts . The table AID_TABLE is defined at the interface of this function module and contains all key fields of the output table and the field MARKED . Using this table, the function module is later informed which rows have been selected.

ALERTTABLE

The hidden HTML form is set up in the ALERTTABLE template. For each row of the output table in the MiniALV, you store the values of the key fields in this form and initialize the field MARKED . The field names of the table AID_TABLE are used in this context.

The HTMLBusiness help functions use the field FieldName . This is a short form of ET_FIELDS-FIELDNAME , which is defined in the flow file of the MINIALV service (template MINIALV ) using OUTPUTMAPPING .

TOOLBAR

Contains all Javascript functions needed to implement the functions of the pushbuttons also defined in this template.

Process Flow

  1. The user selects several rows and chooses the Acknowledge alerts button.
  2. The acknowledgeAlertsButton button (template TOOLBAR ) triggers the Javascript function acknowledgeAlerts() . This function updates the hidden HTML form (call of updateHiddenData() ) and performs a submit for the hidden form.
  3. The hidden HTML form triggers the event acknowledgeAlerts .
  4. The function module SALWP_ACKNOWLEDGE_ALERT_TBL is called in the flow file of the template ALVIEWER . At the backend, this function module evaluates the help table and updates the output table.
  5. After the flow event has been processed, the ITS refreshes the HTML page. The MiniALV "notices" this (from the event type OnTouch ) and calls the report again using the function module FLOW_LOGIC_ALV_CALL . This displays the new data in the MiniALV.

In the default setting, the MiniALV ( FLOW_LOGIC_ALV_CALL ) transfers only data which is actually displayed in the browser. In the CCMS_ALVIEWER service, however, the data of hidden key fields is needed in the HTML form to remember the selected rows. Therefore, the readdatatable parameter is set to ON in the START template. As a result, all output table data is transferred in an additional hidden HiddenData field, which can be used by the underlying MiniApp

Leaving content frame