Skip to Content
author's profile photo Former Member
Former Member

Currency Conversion?

HI all,

Any FM to convert GBP to EURO?

Sanjeev.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 12:05 PM

    Hi Sanjeev,

    Welcome to SDN.

    Before posting always search for the topic in SDN. If do not get any solution then go for posting a question.

    This can be done using the function modules:

    CONVERT_TO_LOCAL_CURRENCY .

    CONVERT_TO_FOREIGN_CURRENCY.

    Try the following example:

    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

    EXPORTING

    date = sy-datum

    foreign_amount = x_booking-forcuram

    foreign_currency = x_booking-forcurkey

    local_currency = local_currency

    IMPORTING

    • exchange_rate =

    • foreign_factor = fremdkurs

    local_amount = local_amount

    • local_factor =

    • exchange_ratex = faktorsum

    • FIXED_RATE =

    • DERIVED_RATE_TYPE =

    EXCEPTIONS

    no_rate_found = 1

    overflow = 2

    no_factors_found = 3

    no_spread_found = 4

    derived_2_times = 5

    OTHERS = 6.

    Hope this helps you.

    Regards,

    Chandra Sekhar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 11:57 AM

    Hi

    U can use the fms CONVERT_TO_FOREIGN_CURRENCY or CONVERT_TO_LOCAL_CURRENCY

    Max

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      U should a code like this:

      DATA: CHANGE_DATE      LIKE  SYST-DATUM,
            FOREIGN_CURRENCY TYPE WAERS,
            LOCAL_CURRENCY   TYPE WAERS,
            LOCAL_AMOUNT     TYPE WRBTR,
            FOREIGN_AMOUNT   TYPE WRBTR.
      
      
      * Set the date for the change
      
      CHANGE_DATE = SY-DATUM.
      
      * If GBP is local currency and EUR is foreign currency
      
      LOCAL_CURRENCY   = 'GBP'.
      FOREIGN_CURRENCY = 'EUR'.
      
      MOVE 1000 TO LOCAL_AMOUNT.
      
      CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
           EXPORTING
                DATE             = CHANGE_DATE
                FOREIGN_CURRENCY = FOREIGN_CURRENCY
                LOCAL_AMOUNT     = LOCAL_AMOUNT
                LOCAL_CURRENCY   = LOCAL_CURRENCY
           IMPORTING
                FOREIGN_AMOUNT   = FOREIGN_AMOUNT
           EXCEPTIONS
                NO_RATE_FOUND    = 1
                OVERFLOW         = 2
                NO_FACTORS_FOUND = 3
                NO_SPREAD_FOUND  = 4
                DERIVED_2_TIMES  = 5
                OTHERS           = 6.
      
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        WRITE: 'Local amount   :', LOCAL_AMOUNT CURRENCY LOCAL_CURRENCY,
                                                               LOCAL_CURRENCY,
               /'Foreign amount:', FOREIGN_AMOUNT CURRENCY FOREIGN_CURRENCY,
                                                             FOREIGN_CURRENCY.
      ENDIF.
      
      SKIP 2.
      * If GBP is foreign currency currency and EUR is local currency
      
      FOREIGN_CURRENCY = 'GBP'.
      LOCAL_CURRENCY   = 'EUR'.
      
      
      MOVE 1000 TO FOREIGN_AMOUNT.
      
      CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
           EXPORTING
                DATE             = CHANGE_DATE
                FOREIGN_AMOUNT   = FOREIGN_AMOUNT
                FOREIGN_CURRENCY = FOREIGN_CURRENCY
                LOCAL_CURRENCY   = LOCAL_CURRENCY
           IMPORTING
                LOCAL_AMOUNT     = LOCAL_AMOUNT
           EXCEPTIONS
                NO_RATE_FOUND    = 1
                OVERFLOW         = 2
                NO_FACTORS_FOUND = 3
                NO_SPREAD_FOUND  = 4
                DERIVED_2_TIMES  = 5
                OTHERS           = 6.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        WRITE:  'Foreign amount:', FOREIGN_AMOUNT CURRENCY FOREIGN_CURRENCY,
                                                             FOREIGN_CURRENCY,
               /'Local amount   :', LOCAL_AMOUNT CURRENCY LOCAL_CURRENCY,
                                                               LOCAL_CURRENCY.
      ENDIF.

      Which function module to be used should be decided in order to the company code currency (local currency).

      If the currencies you're using aren't the currency of company code u can use the fm u prefer.

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 12:00 PM
    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.