2013 Apr 26 1:47 PM
After passing the material number into a customized function module I am getting the output value in numerical format.
It may be in the form of 1.2345 or 12 0r 1.2 or 1.22
After getting that result I need to do the following operation on it
If the output has more than 2 decimal places then the value must be trimmed
If the output has 2 decimal places then the value must be showed alike
Here are the samples
4.6 % should be converted to 4.60 %
43 % should be converted to 43.00 %
16.325 % should be converted to 16.32 %
After passing the material number into a customized function module I am getting the output value in numerical format.
It may be in the form of 1.2345 or 12 0r 1.2 or 1.22
After getting that result I need to do the following operation on it
If the output has more than 2 decimal places then the value must be trimmed
If the output has 2 decimal places then the value must be showed alike
Here are the samples
4.6 % should be converted to 4.60 %
43 % should be converted to 43.00 %
16.325 % should be converted to 16.32 %
2013 Apr 26 2:23 PM
hi,
Use below code.Let your variable be lv_variable.
data: lv_var type p decimals 2.
lv_var = lv_variable.
Its very simple 2 line code is enough.
2013 Apr 26 2:39 PM
2013 Apr 26 2:39 PM
hi sai,
how to add zero if he decimal length is 1 for sample
if value is 12.3 i need to get 12.30
2013 Apr 26 2:53 PM
it worked only 1f we will pass the values like 12.22,3.65,2.5555
but if the value is 12.6999 means the value is we get the output as 12.70
2013 Apr 29 8:10 AM
Hi Ranjith,
Try this code
PARAMETERS: p_menge TYPE mara-brgew.
data: lv_var type p decimals 2.
lv_var = p_menge.
if p_menge < lv_var.
lv_var = lv_var - '0.01' .
endif.
I tried it is working fine for both of your requirements.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |