
You are able to determine how a numeric value from the internal data table is to be displayed in the ALV output. To do this, you can use the following properties:
Number of decimal places
Unit of measurement
Currency
Rounding
With each of these properties, you either move the decimal point the desired number of places (thus changing the value of the number) or you change the number of decimal places after the decimal point (the value of the number then stays the same). You are also able to combine two or more options.
You are able to apply each of the properties in two ways:
You assign the desired property with a specific value to the column that contains the values to be displayed. Each of the values in the column is changed and displayed in the same way.
You use a separate column that applies the desired property to individual rows of the ALV output. For more information, see Columns with Special Technical Significance, in the section called Control Columns That Are Assigned to a Column.
You are able to make the following settings for numeric columns:
Setting properties such as number of decimal places, units of measure, currency and rounding
Displaying or hiding sign
Hiding or Displaying Leading Zeros
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 |
Determining Decimal Places, Units of Measure, Currency and Rounding
You determine he number of decimal places, along with the unit of measure, currency and rounding for each column individually.
|
Function |
Class |
Method |
|
Setting the Number of Decimal Places |
CL_SALV_COLUMN |
SET_DECIMALS |
|
Get number of decimal places |
GET_DECIMALS |
|
|
Determine unit of measure |
SET_CURRENCY |
|
|
Get unit of measure |
GET_CURRENCY |
|
|
Determine currency |
SET_QUANTITY |
|
|
Get currency |
GET_QUANTITY |
|
|
Determine rounding |
SET_ROUND |
|
|
Get rounding |
GET_ROUND |
For columns with DDIC reference, the GET_DDIC_DECIMALS of class CL_SALV_COLUMN returns the number of decimal places that is set for the referenced data element.
Displaying or Hiding sign
By default, positive numbers are displayed without sign, and negative numbers are displayed with sign. You are able to determine that the sign (-) not be displayed for negative numbers.
|
Function |
Class |
Method |
|
Displaying or hiding sign |
CL_SALV_COLUMN |
SET_SIGN |
|
Checks whether sign is being displayed or hidden |
HAS_SIGN |
Hiding or Displaying Leading Zeros
For columns with n or NUMC (numeric text) data types, the spaces that lie before the value are filled with zeros (0). You are able to hide or display these zeros in front of a value.
|
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 |
|
Hiding or Displaying Leading Zeros |
CL_SALV_COLUMN |
SET_LEADING_ZERO |
|
Checks leading zeros are being displayed or hidden |
HAS_LEADING_ZERO |