Skip to Content
author's profile photo Former Member
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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    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.

    Add a comment
    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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?

    Add a comment
    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.

  • author's profile photo Former Member
    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.