Application Development 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: 

Value assignment

Former Member
0 Kudos

Hi,

I have a currency field and i want to assign it to a variable of type char. is this possible? if yes, plz tell me how

Regards,

Prasy

1 ACCEPTED SOLUTION

former_member188829
Active Contributor
0 Kudos

Hi,

Data:CURR Type NETWR .

Data:CHAR(10) Type c.

CURR = '1234'.

WRITE CURR To CHAR.

WRITE:/ CHAR.

6 REPLIES 6

Former Member
0 Kudos

Hi,

Data: curr(10) type p decimals 2,

char(10) type c.

curr = '12334.56'.

char = curr.

replace '.' in char with '' .

write char.

Regards,

Satish

Former Member
0 Kudos

Hi..

you can do this.

see the following code it will help you

data : val(10) type char.

**now you want to assign a currency field to this val and the value must be in rupees or something else.

val = val * ekko-umrez / ekko-umren.

with this statement the charecter field value can be converted into cureency field

now you can use the same val in any where of your object.

regards,

swaminath reddy

former_member188829
Active Contributor
0 Kudos

Hi,

Data:CURR Type NETWR .

Data:CHAR(10) Type c.

CURR = '1234'.

WRITE CURR To CHAR.

WRITE:/ CHAR.

0 Kudos

Hi,

Variable is decalred as

data: l_ansal LIKE q0008-ansal

i want to assign it to

line(80) type c.

the value is not geeting assigned to line.

plz help

0 Kudos

Hi,

This is working for me.

data: l_ansal LIKE q0008-ansal,
      line(80) type c.

l_ansal = '1234567890.12'.

line = l_ansal.
replace '.' in line with ''.
write line.

Regards,

Satish

Former Member
0 Kudos

DATA : Cur TYPE CHAR16.

cur = itab-curr . " Currency field...

WRITE 😕 cur.

that's all..

in more detail..

DATA : text type char18.

text = itab-kwmeng. "field with value 1,0000.00

REPLACE ALL OCCURRENCES OF ',' IN text

WITH ' '.

CONDENSE text.

WRITE 😕 text.

Or also:

For Converting currency field in char type, Just do

DATA : ZCHAR(20) TYPE C.

MOVE CURRENCY TO ZCHAR.

Reward points if found helpfull.....

Cheers,

Chandra Sekhar.