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

Type conversion from Chr10 to NUMC2

Former Member
0 Likes
896

Hello,

data:l_days(10) type c.

l_val(2) type n.

l_days = 5,00.

I want to to get output l_val = 5.

How to do this.

I tried this way

FIELD-SYMBOLS : <n1> type numc2.

ASSIGN l_z_days TO <n1> CASTING.

MOVE <n1> to l_z1_days.

But , Assign don't return any value .

Please advice

Thanks,

PK

Edited by: PK on Jan 22, 2008 9:56 AM

Hello,

data:l_days(10) type c.

l_val(2) type n.

l_days = 5,00.

I want to to get output l_val = 5.

How to do this.

I tried this way

FIELD-SYMBOLS : <n1> type numc2.

ASSIGN l_z_days TO <n1> CASTING.

MOVE <n1> to l_z1_days.

But , Assign don't return any value .

Please advice

Thanks,

PK

Edited by: PK on Jan 22, 2008 9:56 AM

5 REPLIES 5
Read only

Former Member
0 Likes
832

Hi,

data:l_days(10) type c,

l_val1(2) type c,

l_dec type char10,

l_val(2) type n.

l_days = 5.00.

SPLIT l_days AT '.' INTO l_val1 l_dec.

l_val = l_val1.

Edited by: Ramesh Hirial on Jan 22, 2008 5:29 PM

Read only

Former Member
0 Likes
832

Hi PK,

Since I_Days is of type c seperated by comma, you can try like this

Declare two character variables A and B split i_Days into A and B.

then write A.

Regards,

DVNS

Read only

Former Member
0 Likes
832

How about doing it this way:


data:l_days(10) type c,
     l_val(2) type n.

l_days = '5,00'.

replace ',' with ' ' into l_days.
condense l_days no-gaps.
shift l_days left deleting leading space.

l_val = l_days(2).

Regards

Eswar

Read only

0 Likes
832

@Eswar:

I guess, this would lead to L_VAL = 50, wouldn´t it?

Read only

0 Likes
832

Hey Mike

Yes you are right, the returning value is 50 which was what he was expecting. The code i have provided was as per his post before editing.

Maybe new ideas make him to change the post and my reply doesnt make sense anymore.

Regards

Eswar