2014 Apr 25 8:59 AM
Hi!
I need to do conversion from/to JPY currency for updating prices. Since the currency does not allow decimal places, I though of rounding off the amount first with 0 decimal places if JPY is the currency.
I am testing FM ROUND in SE37 and I always get INPUT_INVALID Message: Please use a number field for the input value.
I should place a number in the input field, right? I expect that when I put
Decimals 0
Input 24.6
Sign
I will have output
25.
But then I always get the input:invalid error no matter what I enter in the decimals and input field.
Can someone help? Thanks!
Hi!
I need to do conversion from/to JPY currency for updating prices. Since the currency does not allow decimal places, I though of rounding off the amount first with 0 decimal places if JPY is the currency.
I am testing FM ROUND in SE37 and I always get INPUT_INVALID Message: Please use a number field for the input value.
I should place a number in the input field, right? I expect that when I put
Decimals 0
Input 24.6
Sign
I will have output
25.
But then I always get the input:invalid error no matter what I enter in the decimals and input field.
Can someone help? Thanks!
2014 Apr 25 9:16 AM
Hello Regina
Define your input(value) with either TYPE 'P', 'I' or 'F' else it will throw exception of invalid format.
Thanks
2014 Apr 25 9:57 AM
2014 Apr 25 10:03 AM
Hello Regina,
Please paste the code written for rounding here.Thanks
2014 Apr 25 9:59 AM
Hi ,
It works inside the code, even though getting error in SE 37 .It is because function module picks import and export parameter based on the variable you are passing to it .
DATA : lv_in TYPE F VALUE '410.73' ,
LV_P TYPE P DECIMALS 2 ,
LV_OUT TYPE p DECIMALS 0 .
move LV_IN TO LV_P .
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 2
input = LV_P
SIGN = '+'
IMPORTING
OUTPUT = LV_OUT
* EXCEPTIONS
* INPUT_INVALID = 1
* OVERFLOW = 2
* TYPE_INVALID = 3
* OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Try this sample code its working fine .
Regards ,
Juneed Manha
2014 Apr 25 10:22 AM
Hi, check FM source code, the only possibility how to get INPUT_INVALID exception is:
* pruefen, ob INPUT eine Zahl ist
describe field input type t.
if t ne 'F' and t ne 'P' and t ne 'I'
and t ne 'a' and t ne 'e'. "*063i
message e310 with 'INPUT' raising input_invalid.
endif.
So INPUT parameter has to be one of these types. But if you are testing the FM via SE37 -> test/execute, you can not choose data type of the parameter, it's set automatically, and that could be the problem.
Also in the source code you will see that if you send empty SIGN parameter, no rounding will be performed, see documentation in SE37 for the parameter.
Br
Bohuslav
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |