01-26-2007 6:09 AM
Is there a way to suppress cells with numeric values in an ALV list? I am expecting the following:
1) non-zero value -> display
2) zero value -> display
3) no data -> blank
I have to write the same output to Excel and would want the Excel download to reflect the above scenarios as well.
I tried using 'no-zero' in my fieldcatalog but columns with zero values appear as blank instead of 0.0. Ideally, zero values should still appear in the ALV list output.
Any suggestions will be greatly appreciated.
Thanks.
01-30-2007 6:35 PM
01-31-2007 12:46 PM
If your data are currencies or quantities fields (CURR, QUAN) just clear the associated reference currency code or unit of measure (CUCY, UNIT) the result should be space and not 0 nor 0,00.
Regards.
01-31-2007 1:48 PM
Hi Raymond,
Can you provide sample code to illustrate your suggestion?
Thanks.
01-31-2007 2:59 PM
First some doc
Extract from online help in FM REUSE_ALV_GRID_DISPLAY parameter IT_FIELDCAT
__________________
If a value field has a reference to a unit, this has the following
effects when the list is output:
- The decimal places are displayed with the proper unit.
- An initial value field with reference to a non-initial unit is
displayed as '0' (provided that FIELDCAT-NO_ZERO is initial). If
unit-specific totals are calculated for this value field, the
unit is considered in the analysis of whether homogeneous units
exist.
- An initial value field with reference to an initial unit is
displayed as SPACE. If unit-specific totals are calculated for
this value field, the unit SPACE has no effect on the
homogeneity of the unit if the value field is initial.
- For non-initial value fields with initial unit, the unit SPACE
is considered as a unit when unit-specific totals are
calculated.
__________________
When filling your fieldcat, if you don't use a dictionary structure, you will have to link the unit/currency with the quantity/amount so :
(...)
fieldcat-fieldname = 'WRBTR'.
fieldcat-datatype = 'CURR'.
fieldcat-ref_fieldname = 'WAERS'.
append fieldcat.
(...)
fieldcat-fieldname = 'WAERS'.
fieldcat-datatype = 'CUCY'.
append fieldcat.
(...)
You an hide the unit field with
fieldcat-tech = 'X'.
Of course for your purpose WAERS shall be in the table
When amount is not zero, you will get an output like this 123,45
When amount is zero
- if currency/unit is space, you will get space
- if currency/unit is not space, you will get 0,00
so when no-data, clear (or dont fill) the unit, else fill unit/currency
A more: if you totalize such a field, you will get one total per unit/currency
Regards