Data : G_SUM TYPE p DECIMALS 5.
I am doing calculation and the value of G_SUM will be 20.00000
Now, my requirement is : -
Can i remove all the zeros after the decimal.
If the G_SUM value is 20.23000
Now, it should become : -
20.23
Any suggestino will be appreciated!
Regards,
Kittu
Hi!!
In which format u are displaying ur output. i.e list , alv or smartform. and at which level u want to removes the decimal points.
if at start level than as u told above keep decimals to two. if u want to keep decimal 5 and want to show two, than plz tell in which format ur output is coming.
Hi Kittu,
i assume, you want to get rid of trailing zeros for output purpose.
So this is the code for it.
DATA: l_tx_number TYPE c LENGTH 15. DATA: l_sign. WRITE g_sum TO l_tx_number RIGHT-JUSTIFIED. * take care of the sign SHIFT l_tx_number RIGHT CIRCULAR. l_sign = l_tx_number(1). CLEAR l_tx_number(1). SHIFT l_tx_number RIGHT DELETING TRAILING '0'. * restore the sign l_tx_number(1) = l_sign. SHIFT l_tx_number LEFT CIRCULAR.
regards
Jörg
Add a comment