Setting ALV columns as key columns and making zero amount appear as blank
This recipe is comprised of two subrecipes:
We will see how the personnel number (PERNR
) column may be set as key with blue colour. In addition, how a particular column Amount, where a zero amount is shown as 0.00, may be made to appear blank.
How to do it...
For making the above adjustments, proceed as follows:
Declare a column variable with reference to the class
cl_salv_column_table
.Next, use the
get_column
method of themycolumns
object pointing to the columns of the ALV in order to get the reference to the columnPERNR
. We will then use theset_key
method to set thePERNR
column as the key column.Similarly, the
get_column
method is called for the Amount columnBET01
. Theset_zero
method is called to convert the zeros to blanks while outputting theBET01
column. It is necessary that the value space (' '
) is passed to theset_zero
method.The code fragment was added before the ALV display method but after the assignment...