Skip to Content



When I use the FM 'CONVERT_FOREIGN_TO_FOREIGN_CUR' to convert an amount from USD to VND, the result has 2 0s less. For example, when the Exchange Rate is 20.7 and Translation Ratio is 1:1000,

130 USD = 130 * 20.7 * 1000 = 2691000 VND

But, the FM 'CONVERT_FOREIGN_TO_FOREIGN_CUR' returns the value as 26910 VND.

P.S: USD has 2 decimal places and VND has 0 decimal places as per config.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Nov 22, 2012 at 12:43 PM

    Can somebody tell if this is the intended behaviour or if some other setting is missing for the output to be as expected?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2012 at 02:00 PM

    Hi Anandkumar,

    After converting to the Foreign amount, you need to use CURRENCY_AMOUNT_SAP_TO_IDOC function module to convert this SAP to ISO currency. The reverse can also be done, i.e IDOC to SAP. In this function module you will convert the amount to the required amount of that currency, i.e. for 216 VND it will give 21600 and similar to JPY.

    In this function module, you may find error while activating, or can create the problem in output during runtime, just copy this to Z Function module and change the type of IDOC_TYPE. The problem will then be solved.


    Hardik Mehta

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Anand Kumar Jayaraman

      Hi Anand,

      I am not asking you to replace your FM 'CONVERT_FOREIGN_TO_FOREIGN_CUR', I am asking you to use the function module 'CURRENCY_AMOUNT_SAP_TO_IDOC' after you have got your result from the first function module. It can be used in all the cases. The sample of the code will be:



      TO_AMT = <amt>

      which will export the amount<amt> for currency <curr>. Take this amount and then in the Function Module pass the amount to get the correct ISO values of that currency.



      CURRENCY = <curr> (VND)

      SAP_AMOUNT = <amt> (26910)


      IDOC_AMOUNT = <amt1>

      The value of <AMT1> will be 2691000. If you put the value as 26910.23, then the return value will be 2691023. This will work for all the currencies for that factor. Instead of VND, if you use USD, then the same amounts will be returned.

      Just try the same with different decimal places as well as same decimal places. There is also the function module 'CURRENCY_AMOUNT_IDOC_TO_SAP', which does the opposite things of above.


      Hardik Mehta

  • Posted on Nov 22, 2012 at 02:49 PM

    How did you test ? Remember USD has 2 decimals, so 130 USD will be 130.00 USD and stored as 13000 internally, when 2691000 VND will be stored as it is in memory 2691000 ! (FM use internal values, perform some where-used to get this information)

    Also don't forget to check for fixed rate (use READ_EXCHANGE_RATE), else you will be required to use CONVERT_TO_LOCAL_CURRENCY and CONVERT_TO_FOREIGN_CURRENCY.



    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.