‎2010 Jul 15 2:26 PM
Hi All,
Im facing a peculiar problem.
Im getting some data from one Function module into one variable.
Sometimes the variable is having values such as 0, 0.0, 0.00 like that.(system is still considering 0.0 as a value)
If such is a case I dont want to print that value(say 0.0) on output.
Pls help me how to initialize the variable with space, if it has the values like 0, 0.0, 0.00 etc..
Pls help me with ur valuable suggestions.
Thanks,
Priya
‎2010 Jul 15 2:32 PM
Hello Priya,
What is the data type of the variable? If it an integer/num, its initial value will be 0. Before printing, you may include a condion check like:
if var > 0.
<codes>
Endif.
‎2010 Jul 15 4:13 PM
Hi Priya,
see the NO-ZERO option of the WRITE statement:
Option
... NO-ZERO
Effect If the contents of f are equal to zero, only blanks are output; if f is of type C or N, leading zeros are replaced by blanks.
‎2010 Jul 15 8:11 PM
Hi Priya,
Just check the sample code. Here need to pass the variable in to another pack (p) type variable. Then check the initial. based on that you can write it.
data: l_val_c TYPE char20 VALUE ' 0.00',
l_val_p TYPE p LENGTH 15 DECIMALS 3.
l_val_p = l_val_c.
IF l_val_p IS INITIAL.
BREAK-POINT.
ENDIF.
Thanks
Subhankar
‎2010 Jul 16 5:35 AM
Hi priya
If u use classical/ ALV report then use :
No-ZERO with WRITE statement.
field-cat = NO-ZERO.
and if u use smart-forms then use :
&symbol(Z)& "Omit Leading Zeros"
Regards,
Abhilash