Value Display With Currency/Quantity Unit

Certain values of output fields may refer to units (such as kilogram) or currencies (such as Euro). To display these values in the correct unit-specific format (with the correct number of digits after the comma, for example), you must assign these fields to a currency or unit. There are three ways you can do this in the field catalog:

  • Assign a value field to an associated currency or unit field

  • Specify a currency or unit for the entire column

  • Format the value field manually (see Formatting Column Contents)

Reference to a Currency or Unit Field

You use fields CFIELDNAME and QFIELDNAME (see below) to assign value fields to a currency or unit field. This ensures that when totals are calculated for this column, the totals are displayed separately for each unit.

The field catalog also contains an entry for the unit field. If you do not want to display the unit as a column in the list and do not want to allow users to interactively show it as a column, you can mark the field catalog entry for the unit field as a technical field by setting field TECH. This makes sense, for example, if the unit is always unique and therefore explicitly output in the list header by the caller.

For initial value or currency fields, you must consider the following points:

Calculation of Totals and Display of Value Fields

Value of Unit Field

Not Initial

Initial

Value of value field

Not Initial

Unit-specific display of digits after the comma in the list and in the totals

For these cells, ALV introduces the unit SPACE. In the totals display, this unit is given as a separate unit.

Initial

Unit-specific output as '0' (provided field NO_ZERO of the field catalog is initial). When calculating totals, the ALV uses the value '0' and the specified unit.

Output as SPACE. The value field is ignored when the totals are calculated.

Value or Unit for the Entire Column

For fields that use the same quantity or currency unit for all column values, the field catalog contains fields CURRENCY and QUANTITY (see below). You use these fields to determine a unit for your value field (such as USD or KG). This makes sense, for example, if there is only one unit or currency for the entire column (which has been entered by the user, for example). In this case, the output table does not need any additional fields.

Prerequisites

For the value field, you must consider the following points:

Relevant Fields in the Field Catalog

Field Name

Component Type

Data Type (Length)

Value Range

Use

CFIELDNAME

LVC_CFNAME

Char(30)

SPACE, name of a field in the output table

Defines a reference to currency units. The ALV links the field specified in FIELDNAME to the field for currency units specified in CFIELDNAME. The field specified in CFIELDNAME must have a separate entry in the field catalog.

CURRENCY

LVC_CURR

Char(5)

SPACE, name of a currency

Explicitly specifies a currency (such as DEM, USD). The ALV displays the values for the column specified in FIELDNAME according to the conventions for this currency.

QFIELDNAME

LVC_QFNAME

Char(30)

SPACE, name of a field in the output table

Defines a reference to quantity units. The ALV links the field specified in FIELDNAME to the field for quantity units specified in QFIELDNAME. The field specified in QFIELDNAME must have a separate entry in the field catalog.

QUANTITY

LVC_QUAN

Char(3)

SPACE, name of a unit

Specification of a unit (such as KG). The ALV displays the values for the column specified in FIELDNAME according to the conventions for this unit.