Former Member

# Multiply "Currency" and "Decimal" , Move result to "Currency"

Hello,

In the General PO, i have a "Currency field" and a "Exchange rate which is Decimal type". I'm working out some calculation where i should multiple the "Currency Field" with "Exchange Rate" and put the result into a "Currency Field".

Came anyone help me how to do this calculation?

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Jun 08, 2006 at 04:43 AM

Hi Geetha,

Almost all data types in ABAP are inter-convertible.

So I think you can directly go ahead with multiplying currency field with a packed decimal field and assign the result to a currency field.

For eg:

TABLES: SFLIGHT.

DATA: PRICE TYPE SFLIGHT-PRICE.

DATA: A TYPE P decimals 2.

select single price from sflight into price where carrid = 'AA'.

A = '5.20'.

PRICE = PRICE * A.

WRITE PRICE.

Regards,

SP.

10|10000 characters needed characters exceeded
• Posted on Jun 08, 2006 at 04:51 AM

Then what is the problem simply multiply the

two fields and put result in currency.

data: a type wrbtr value '10.10'.

data: b type f value '10.10'.

data: c type wrbtr .

c = a * b.

write:/ c.

Regards,

Wasim Ahmed

10|10000 characters needed characters exceeded
• Former Member
Posted on Jun 08, 2006 at 04:59 AM

I have a some clarification, As i said its is in GENERAL PO and when we write a subroutine "all the fields will be converted to character" So now "currency field" and "decimal fields" are there in character data type.

I can possibly multiply both these character fields and save the result in currency field. BUT THE PROBLEM IS DECIMAL POINTS should be taken care.

Example Values to be considered:

Decimal Field Value: 43.52000

Currency Field Vaule: 123456789987654.123

can anyone help me?

10|10000 characters needed characters exceeded
• Former Member

DATA: F1(5) VALUE '20.20',

F2(3) VALUE '2.0',

F3(7) .

F3 = F1 * F2.

WRITE : F3.

It will take care but problem is that it take lowest decimal place.

means result of programm is 40.4.

and also take care the lenght of field because it take decimal as a character.

after getting out put change it to curr.

• Former Member
Posted on Jun 08, 2006 at 05:13 AM

I don't think you can multiply two variable with character data type. so U again have to convert those variables into their respective datatypes and multiply them and then move the result to a variable with charater datatype.