How to clear currency variable and to print as blank in ALV output?
I have a field in a internal table of type currency .
While printing for some records the value is 0.00.
My requirement is i want to print as blank instead of "0.00' in ALV o/p
While populating i tried to assign with variable of space of same type as below
data: w_cspace type wert8 value space.
How to print the currency value as blank.
Just check the Field catalog structure 'SLIS_FIELDCAT_ALV' . In this structure check ' 'SLIS_FIELDCAT_MAIN0 ' structure , you will find 'NO_ZERO' field in that.
When you are filling field catalog just put NO_ZERO = 'X'.
WA_FCAT-NO_ZERO = 'X'.
DATA: WA_FCAT TYPE SLIS_FIELDCAT_ALV . CLEAR WA_FCAT. WA_FCAT-FIELDNAME = 'PRICE'. WA_FCAT-TABNAME = 'SFLIGHT'. WA_FCAT-REPTEXT_DDIC = 'Ticket Price'. WA_FCAT-NO_ZERO = 'X'. APPEND WA_FCAT TO T_FCAT.
Now you will not get '0.00'.
You will get Space in place of '0.00'.
when you are printing result using ALV then by filling the particular currency field with SPACE will not work. Because it takes the declaration type of that particular field and prints the values. So try with 'NO_ZERO' option. Now It works fine .