10-08-2010 7:13 AM
Hi,
I am getting the below dump
Short text
Unable to interpret "11750.00 " as a number.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZSUB_RFKORD10" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_NO_NUMBER', was n
caught in
procedure "CUMMIL" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The program attempted to interpret the value "11750.00 " as a number, but
since the value contravenes the rules for correct number formats,
this was not possible.
Line SourceCde
86 READ TABLE input WITH KEY name = 'VAR1'.
87 CONDENSE inval1.
88 CONDENSE input-value.
89
90 DO.
91 IF input-value CS ','.
92 pos1 = sy-fdpos .
93 pos2 = sy-fdpos + 1.
94 CONCATENATE input-value0(pos1) input-valuepos2 INTO input-value.
95 ELSE.
96 EXIT.
97 ENDIF.
98 ENDDO.
99 CLEAR: pos1, pos2.
100 DO.
101 IF ouput-value CS ','.
102 pos1 = sy-fdpos .
103 pos2 = sy-fdpos + 1.
104 CONCATENATE ouput-value0(pos1) ouput-valuepos2 INTO ouput-value.
105 ELSE.
106 EXIT.
107 ENDIF.
108 ENDDO.
109
110 ouval = ouput-value.
111 CONDENSE ouval.
112 inval = input-value.
113 CONDENSE inval.
114 inval1 = v_amt.
115 CONDENSE inval.
>>>>> ouval = ouval + input-value + v_amt.
all the commas have been removed before performing the addition , so why this error is appearing
10-08-2010 7:18 AM
Hi,
your program checks for decimal comma in field INPUT-VALUE, but you get a decimal point. You should replace the decimal point, too.
Your character field INPUT-VALUE contains a dot and is not numeric!
Regards
Klaus
10-08-2010 7:18 AM
Hi,
your program checks for decimal comma in field INPUT-VALUE, but you get a decimal point. You should replace the decimal point, too.
Your character field INPUT-VALUE contains a dot and is not numeric!
Regards
Klaus
10-08-2010 7:23 AM
Hi,
So if i remove the decimal the value will change for
ex 1145.34 decimal removed and condense then it becomes 114534 which is wrong , so what i need to do.
Rgds,
Praveen
10-08-2010 7:28 AM
10-08-2010 7:29 AM
10-08-2010 7:33 AM
You need a work field for your calculation, type currency or p. After the calculation you can write it back (if needed) to a character field using the currency option using WRITE TO
10-08-2010 7:37 AM
I have written this test program with character variables and decimals values and performed addition but it is not going into dump , why so..
REPORT ZTest.
DATA : var(12).
DATA : VAR1(9).
DATA : VAR2(9).
var1 = '2323.34' .
var = '123.34'.
var2 = var + var1.
write var2.
10-08-2010 7:41 AM
Howdy,
Because you are taking two char variables and summing them. If you take a currency, put it into a char variable and then try and sum it, you will get the error.
Try putting the amount into your variables as follows:
WRITE lv_amount to lv_char NO-GROUPING.
This will remove the thousands separaters.
Cheers
Alex
10-08-2010 7:43 AM
Does your test program have fixed point arithmetics in its attributes and your dumping program doesn't have it?
10-08-2010 7:53 AM
Hi Klaus,
Neither my test program nor the dumping program has fixed point arithmetics.
Regards,
Praveen
10-08-2010 8:06 AM
Hi Praveen,
which type has your field OUVAL.
What are the values of the three fields that are added together in field OUVAL? The field values should be available in your short dump!
Edited by: Klaus Babl on Oct 8, 2010 9:15 AM
10-08-2010 8:49 AM
Hi klaus,
which type has your field OUVAL.
ouval(18) TYPE c.
What are the values of the three fields that are added together in field OUVAL? The field values should be available in your short dump!
ouval = ouval + input-value + v_amt.
ouval = blank
input-value = 11750.00
v_amt = blank
Rgds,
Praveen
10-11-2010 6:00 AM
Sorry Praveen,
I checked with Your test program in unicode and non-unicode systems of SAP Rel. 4.6C and ECC 6.0, but I can't find any error.
My last idea is, that there may be an error when input-value contains any other sign than trailing spaces, e.g. X'00' or something other that can't be shown.
Regards,
Klaus
10-27-2010 8:34 PM
I found a solution.
Here you are.
DATA valor(18) TYPE c.
DATA: pos1 TYPE sy-fdpos.
READ TABLE inttab INDEX 1.
CONDENSE inttab-value NO-GAPS.
IF inttab-value CA ''.
pos1 = sy-fdpos - 1 .
move inttab-value+0(pos1) to valor.
clear: inttab-value.
inttab-value = valor.
ENDIF.