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

Character to Numeric

Former Member
0 Likes
2,403

Hi! All

I have a field in an Itab which is of Character Data Type and it has been used to Upload the Data using BDC. and the Problem is, while using that character field for relational operator check, it troughs an DUMP error CONVERTION_ERROR at Background but the report executes fine.

wk_char type c. or wk_cahr type n.

I have tried using the Data Type N. but then to the same DUMP error occurs.

How to solve this error.

is it right to assign the character field to Interger field.

wk_char type c. or wk_cahr type n.

wk_int type i

wk_int = wk_char.

will it works to solve the above error.

Thanks and Regards,

Kv

wk_char type

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,484

Hi,

You can use a FM for your problem as : MOVE_CHAR_TO_NUM

Declare one more variable to pass this value as numeric for comparison.

Just declare the field as type c and before using for comparison, use this FM.

Regds,

Anil

4 REPLIES 4
Read only

Former Member
0 Likes
1,484

HI,

This Dump occurs because of type conversion.

instead of giving

wk_int type i.

you declare it as

wk_int type c.

and then pass the values

wk_int = wk_char.

the dump will not occur.

Regards,

Vinu.R.

Read only

Former Member
0 Likes
1,485

Hi,

You can use a FM for your problem as : MOVE_CHAR_TO_NUM

Declare one more variable to pass this value as numeric for comparison.

Just declare the field as type c and before using for comparison, use this FM.

Regds,

Anil

Read only

Former Member
0 Likes
1,484

Hi,

For the conversion between the Character and a Numeric Value, the source field must contain numeric values.

Have a look at the Application help which states

"The source field must contain a number in mathematical or commercial notation. Exception: A source field that contains only blank characters is interpreted as the number zero. Scientific notation is not allowed, unless it can be interpreted as mathematical notation. Decimal places are rounded to whole-numbered values. If the number lies within the value range of data types i, b or s, it is converted into the corresponding internal representation of an integral number, otherwise the treatable exception CX_SY_CONVERSION_OVERFLOW occurs."

Have a look at the other conversion rules which will suit your need.

Hope this helps.

Thanks,

Samantak

Read only

Former Member
0 Likes
1,484

Hi,

Use

Fun mod: 'MOVE_CHAR_TO_NUM'

Thanks,

Krishna