2010 Sep 18 4:54 AM
Hi Guru,
Good day.
I have 5 output as bellow:
.15 2.2 1 .4 14.8 .43
I need to show them like bellow:
1 3 2 15 1
how can i get the desired output.
please help me.
With thanks
Moshiur
Moderator Message: Very basic question. Could be answered with a simple search and/or a few lines of code.
Edited by: kishan P on Sep 18, 2010 4:05 PM
2010 Sep 18 11:26 AM
Hi moshiur sohel,
Use FM 'ROUND' to round any value. Your scenario is of Positive rounding, for that give SIGN parameter as '+'.The following is the example code.
PARAMETER P_VAL TYPE P DECIMALS 2.
CALL FUNCTION 'ROUND'
EXPORTING
* DECIMALS = 0
INPUT = P_VAL
SIGN = '+'
IMPORTING
OUTPUT = P_VAL
EXCEPTIONS
INPUT_INVALID = 1
OVERFLOW = 2
TYPE_INVALID = 3
OTHERS = 4
Close the thread if you have solved your query.
Thanks & Regards,
Rock.
Hi moshiur sohel,
Use FM 'ROUND' to round any value. Your scenario is of Positive rounding, for that give SIGN parameter as '+'.The following is the example code.
PARAMETER P_VAL TYPE P DECIMALS 2.
CALL FUNCTION 'ROUND'
EXPORTING
* DECIMALS = 0
INPUT = P_VAL
SIGN = '+'
IMPORTING
OUTPUT = P_VAL
EXCEPTIONS
INPUT_INVALID = 1
OVERFLOW = 2
TYPE_INVALID = 3
OTHERS = 4
Close the thread if you have solved your query.
Thanks & Regards,
Rock.
2010 Sep 18 10:02 AM
Hi Moshiur,
Hope this may give you some idea to build your own logic...
DATA : w_sub type p DECIMALS 2 VALUE '2.4',
w_num2 TYPE char10,
w_num1 TYPE char10 ,
w_char TYPE char10.
w_char = w_sub.
SPLIT w_char at '.' INTO w_num1 w_num2.
IF w_num2 > 0.
w_num1 = w_num1 + 1.
ENDIF.
WRITE w_num1. -- o/p is 3
Regards,
Aby
2010 Sep 18 10:03 AM
hi,
you can check this one out..
data : ad type p decimals 3. "your original input
data : ad1 type i."to convert to whole number
ad = '3.2'.
ad1 = ad.
if ad1 < ad.
ad1 = ad1 + 1.
endif.
write : ad1.
regards,
syed
2010 Sep 18 11:26 AM
Hi moshiur sohel,
Use FM 'ROUND' to round any value. Your scenario is of Positive rounding, for that give SIGN parameter as '+'.The following is the example code.
PARAMETER P_VAL TYPE P DECIMALS 2.
CALL FUNCTION 'ROUND'
EXPORTING
* DECIMALS = 0
INPUT = P_VAL
SIGN = '+'
IMPORTING
OUTPUT = P_VAL
EXCEPTIONS
INPUT_INVALID = 1
OVERFLOW = 2
TYPE_INVALID = 3
OTHERS = 4
Close the thread if you have solved your query.
Thanks & Regards,
Rock.
2019 Apr 25 5:43 AM
It's is useful but it only can be generated under program and not SE37
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |