2008 Feb 21 12:25 PM
Hi,
data : x_kwmeng(15).
data : y_weight(30) type c .
data : w_weight type p decimals 3.
x_kwmeng = '100.111'.
y_weight = '1,111.111'.
w_weight = ( ( x_kwmeng * y_weight * 1000 ) ).
write w_weight.
DUMP : Unable to interpret "1,111.111 " as a number.
Any Solution Pls.
Vind.
2008 Feb 21 12:29 PM
Hi,
Please declare the variables as follows:
data : x_kwmeng type p.
data : y_weight type p.
data : w_weight type p decimals 3.
x_kwmeng = '100.111'.
y_weight = '1111.111'. --> removed comma in the amount field
w_weight = ( ( x_kwmeng * y_weight * 1000 ) ).
write w_weight.
You can still declare the variables as char type but recommended to declare them as type P as they are amount fields. and the reason for getting the dump is giving comma in the Y_WEIGHT field that i have removed.
Regards,
yellappa.
Hi,
data : x_kwmeng(15).
data : y_weight(30) type c .
data : w_weight type p decimals 3.
x_kwmeng = '100.111'.
y_weight = '1,111.111'.
w_weight = ( ( x_kwmeng * y_weight * 1000 ) ).
write w_weight.
DUMP : Unable to interpret "1,111.111 " as a number.
Any Solution Pls.
Vind.
2008 Feb 21 12:28 PM
2008 Feb 21 12:29 PM
Hi,
Please declare the variables as follows:
data : x_kwmeng type p.
data : y_weight type p.
data : w_weight type p decimals 3.
x_kwmeng = '100.111'.
y_weight = '1111.111'. --> removed comma in the amount field
w_weight = ( ( x_kwmeng * y_weight * 1000 ) ).
write w_weight.
You can still declare the variables as char type but recommended to declare them as type P as they are amount fields. and the reason for getting the dump is giving comma in the Y_WEIGHT field that i have removed.
Regards,
yellappa.
2008 Feb 21 12:46 PM
Hi
y_weight = '1,111.111'. is the run time value thats been assigned to the variable . so cant exclude the comma .
Thanks ,
Vind.
2008 Feb 21 12:52 PM
If that is the case then remove the comma in the amount field as below and use the code as usual.
REPLACE ALL OCCURRENCES OF ',' IN y_weight WITH SPACE.
CONDENSE Y_WEIGHT NO-GAPS.
if your system doesn't support REPLACE ALL OCCURRENCES then use following code.
do.
replace ',' with space into y_weight.
if sy-subrc <> 0.
exit.
endif.
enddo.
CONDENSE Y_WEIGHT NO-GAPS.
Once after using above statement then use y_weight in your calculations.
Note: Since we are using condense statement please declare the y_weight as char type or else it will go to dump.
Regards,
Yellappa.
Edited by: yellappa m on Feb 21, 2008 6:26 PM
2008 Sep 19 2:03 PM
Hi yellappa m
I just resolved my issue by reading your answer. Brilliant idea.
Just wanted to say Thank you.
-ASB
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |