Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Cannot be interpreted as a number

jandrivay
Participant
40,496

Hi all,
please help me resolved it.

whats wrong with my code ?

when clm71 have a value = 15.202.500 and ADD to gv_jun. ABAP ERROR.

data begin of t_result_tmp OCCURS 0

....

gv_jun type p decimal 3.

END of t_result_tmp.

Thank you.

LOOP AT t_result.
  ADD t_result-clm61 TO t_result_tmp-gv_jan. "Jan Manuring
  ADD t_result-clm63 TO t_result_tmp-gv_feb. "Feb Manuring
  ADD t_result-clm65 TO t_result_tmp-gv_mar. "Mar Manuring
  ADD t_result-clm67 TO t_result_tmp-gv_apr. "Apr Manuring
  ADD t_result-clm69 TO t_result_tmp-gv_mei. "Mei Manuring
  ADD t_result-clm71 TO t_result_tmp-gv_jun. "Jun Manuring
  ADD t_result-clm73 TO t_result_tmp-gv_jul. "Jul Manuring
  ADD t_result-clm75 TO t_result_tmp-gv_aug. "Agu Manuring
  ADD t_result-clm77 TO t_result_tmp-gv_sep. "Sep Manuring
  ADD t_result-clm79 TO t_result_tmp-gv_okt. "Okt Manuring
  ADD t_result-clm81 TO t_result_tmp-gv_nov. "Nov Manuring
  ADD t_result-clm83 TO t_result_tmp-gv_dec. "Dec Manuring
  ADD t_result-clm85 TO t_result_tmp-gv_tot. "Total
  APPEND t_result_tmp.
ENDLOOP.

Hi all,
please help me resolved it.

whats wrong with my code ?

when clm71 have a value = 15.202.500 and ADD to gv_jun. ABAP ERROR.

data begin of t_result_tmp OCCURS 0

....

gv_jun type p decimal 3.

END of t_result_tmp.

Thank you.

LOOP AT t_result.
  ADD t_result-clm61 TO t_result_tmp-gv_jan. "Jan Manuring
  ADD t_result-clm63 TO t_result_tmp-gv_feb. "Feb Manuring
  ADD t_result-clm65 TO t_result_tmp-gv_mar. "Mar Manuring
  ADD t_result-clm67 TO t_result_tmp-gv_apr. "Apr Manuring
  ADD t_result-clm69 TO t_result_tmp-gv_mei. "Mei Manuring
  ADD t_result-clm71 TO t_result_tmp-gv_jun. "Jun Manuring
  ADD t_result-clm73 TO t_result_tmp-gv_jul. "Jul Manuring
  ADD t_result-clm75 TO t_result_tmp-gv_aug. "Agu Manuring
  ADD t_result-clm77 TO t_result_tmp-gv_sep. "Sep Manuring
  ADD t_result-clm79 TO t_result_tmp-gv_okt. "Okt Manuring
  ADD t_result-clm81 TO t_result_tmp-gv_nov. "Nov Manuring
  ADD t_result-clm83 TO t_result_tmp-gv_dec. "Dec Manuring
  ADD t_result-clm85 TO t_result_tmp-gv_tot. "Total
  APPEND t_result_tmp.
ENDLOOP.
11 REPLIES 11
Read only

gayathri_jayajeevan2
Participant
0 Likes
22,254

Hi,

I can see leading space in front of " 15,202.500". What is the type of this field?

i mean clm71 field type. Guess it is a char field which allowed Leading spaces and separators ","

Please assign it to a number field and continue with your addition operation.

Thank you.

Read only

0 Likes
22,254

all structure in internal table t_result is Char.

t_result_tmp LIKE t_result OCCURS 0 WITH HEADER LINE.

Read only

FredericGirod
Active Contributor
0 Likes
22,254

The field r_result-clm.. are not defined as number, should be CHAR is your number is XX,XXX.XXX (a nuber is XXXXX.XXX)

Read only

0 Likes
22,254

Instead of downvoting, explain why you are not agree.

Read only

0 Likes
22,254

I think from the code of OP, what he want is sum value so t_result....shouldn't be CHAR.

Read only

former_member1716
Active Contributor
0 Likes
22,254

Stedward McKnight,

The reason could be any of the below two reasons:

1) You are trying to store a character Value in a Number field due to which it is not able to interpret this value with ',' as a number.

2) You are trying to store the number in a format which is against the user format you have maintained.

Ideal solution would be for all Fields related to number (For eg, Currency , quantity field) use Write statement. This should solve your issue. Below Code for reference:

***Instead of 
ADD t_result-clm61 TO t_result_tmp-gv_jan. "Jan Manuring

*** Use 
WRITE t_result-clm61 TO t_result_tmp-gv_jan.

Regards!

Read only

Sandra_Rossi
Active Contributor
22,254

It means that the kernel tries to convert a sequence of characters into a number, and that this sequence of characters is incorrect:

15,202.500

The comma is the problem as explained here:

Read only

former_member226519
Active Contributor
0 Likes
22,254

before adding a CXHAR value eliminate the separating comma:

TRANSLATE t_result-clm61 USING ', '. "comma - space

CONDENSE t_result-clm61 NO-GAPS.

Read only

DoanManhQuynh
Active Contributor
0 Likes
22,254

Can you tell us the type of CLMxx components? when you are doing mathematic on char type field, SAP will implicit convert them to number so if value in your table not a number then conversion failed.

Read only

former_member758078
Participant
0 Likes
22,254

The source fields should be of string or character datatype. Any field of numerical or date datatype may have caused the error that you are facing.

Read only

mlapaglia
Discoverer
0 Likes
22,254

Help on this abap error please