FM to convert currencies?

Hi all ,
I have a program where i need to convert different currencies(like USD , INR)  into GBP(local currency) before making a check to issue error message .
Please Guide me Function Modules that can export exchange rates or that can be helpful to me .
Thanks in advance.
Dharma P

Hi
you can use the following function modules
CALCULATE_EXCHANGE_RATE
READ_EXCHANGE_RATE     
some other function modules with code :
*&      Form  currency_conv
Convert Doc Curr to Invoice Curr if Invoice Curr is Company Code Curr
form currency_conv  using    p_p_inv_waers
                             p_p_doc_waers
                             p_p_zfbt
                    changing p_p_wa_data_credit.
  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
    EXPORTING
      client           = sy-mandt
      date             = p_p_zfbt
      foreign_amount   = p_p_wa_data_credit
      foreign_currency = p_p_doc_waers
      local_currency   = p_p_inv_waers
      rate             = 0
      type_of_rate     = 'M'
      read_tcurr       = 'X'
    IMPORTING
      local_amount     = p_p_wa_data_credit
    EXCEPTIONS
      no_rate_found    = 1
      overflow         = 2
      no_factors_found = 3
      no_spread_found  = 4
      derived_2_times  = 5
      OTHERS           = 6.
endform.                    " currency_conv
*&      Form  indirect_conv
   Conver from Doc Curr --> Company code Curr ---> Invoice Curr
   Example     USD           GBP                    EURO
form indirect_conv  using    p_p_inv_waers
                             p_p_doc_waers
                             p_p_zfbdt
                    changing p_p_wa_data_credit.
  DATA : p_EXCH_RATE like BAPI1093_0 ,
         p_rate1   like BAPI1093_0-EXCH_RATE ,
         p_rate2   like BAPI1093_0-EXCH_RATE_V ,
         P_temp_value like dopos-dmbtr ,
         p_return     like BAPIRET1 ,
         p_temp(17) type n .
Get equivalent in company code currency value
  CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
    EXPORTING
      rate_type  = 'M'
      from_curr  = p_p_doc_waers
      to_currncy = t001-waers
      date       = p_p_zfbdt
    IMPORTING
      EXCH_RATE  = p_EXCH_RATE
      RETURN     = p_return.
  p_rate1 = p_EXCH_RATE-EXCH_RATE .
  P_temp_value  = p_rate1 *  p_p_wa_data_credit .
  clear :     p_EXCH_RATE .
  clear :     p_return .
****Change the value to Invoice currency value
  CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
    EXPORTING
      rate_type  = 'M'
      from_curr  = p_p_inv_waers
      to_currncy = t001-waers
      date       = p_p_zfbdt
    IMPORTING
      EXCH_RATE  = p_EXCH_RATE
      RETURN     = p_return.
  p_rate2 = p_EXCH_RATE-EXCH_RATE_V .
  p_p_wa_data_credit = p_rate2 *  P_temp_value  .
endform.                    " indirect_conv
Thanks
Sekhar
Message was edited by:
        Lakshmi Sekhar Reddy

Similar Messages

  • Error Converting Currency --  Load from SAP ECC / R/3  to BW / BI

    Hi,
    I have a custom extractor pulling data from ECC.
    However, I am getting the following error.
    'Error Converting Currency from USD4 to  on 8/27/2008'
    RSA3 works fine. PSA load fails and the above message can be seen in the application log in ECC.
    Any ideas?
    Points will be assigned.
    Thanks,
    Edited by: Rajen SAP BI on Aug 29, 2008 2:23 AM

    I believe in the transfer rule info object 0currency should be assigned with field from transfer structure which contains Currency . Once the assignment is done , delete data from info cube and reload the data and this time it should give
    corresponding currency along with Amount.
    Once you are able to see the currencies along with amount second step would be to create Currency translation ( RRC1 ) Put description ( Fixed Currency USD )
    Tab page exchange rate : Rate type M
    Source currency : From Data record
    Target currency : Fixed ( USD )
    Time ref. Fixed time ref. (Current datE) ( varies per scenario )
    Save it.
    Or
    Use this function module for converting currency from one format to another format...
    CONVERT_TO_FOREIGN_CURRENCY...

  • How to convert currency into other country currency?

    how to convert currency into other country currency?

    Hi,
    You have to use, transaction CONVERT_TO_LOCAL_CURRENCY.
    See this code for more detail.
    DATA: l_toval   LIKE bseg-wrbtr,
          l_fromval LIKE bseg-wrbtr.
    DATA: l_tocurr LIKE bkpf-waers,
          l_fromcurr LIKE bkpf-waers VALUE 'USD'.
    DATA: l_exchrate      LIKE tcurr-ukurs.
    *   get amount in other currency
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
         EXPORTING
              client           = sy-mandt
              date             = sy-datum
              foreign_amount   = l_fromval
              foreign_currency = l_tocurr
              local_currency   = l_fromcurr
         IMPORTING
              exchange_rate    = l_exchrate
              local_amount     = l_toval
         EXCEPTIONS
              no_rate_found    = 1
              overflow         = 2
              no_factors_found = 3
              no_spread_found  = 4
              derived_2_times  = 5
              OTHERS           = 6.
    Let me know if you need any other information.
    Regards,
    RS

  • Convert currency to Words(font Vietnamness)

    Hi all,
    I create report as crystal report tool .but I canu2019t convert currency number to vietnamness.
    I can only convert to English.
    URL=http://imageshack.usIMGhttp://img518.imageshack.us/img518/931/phieuchiqn6.png[/IMG][/url]
    URL=http://g.imageshack.us/img518/phieuchiqn6.png/1/IMGhttp://img518.imageshack.us/img518/phieuchiqn6.png/1/w793.png[/IMG][/url]
    I can not convert from number to word u2018s VietNamness.
    I used create Customer Function in Crystal report for event this convert.But, it donu2019t work .
    I create this function in VB.NET ,it work very good.
    This is picture that I used in VB.NET.
    URL=http://imageshack.usIMGhttp://img254.imageshack.us/img254/1227/convertdd6.png[/IMG][/url] URL=http://g.imageshack.us/img254/convertdd6.png/1/IMGhttp://img254.imageshack.us/img254/convertdd6.png/1/w363.png[/IMG][/url]
    Now, I want to add this function into crystal report ,What do me do?
    This is code :
    Module Module2
    Function ConvertCurrencyToEnglish(ByVal MyNumber As String)
    Dim Temp
    Dim Dollars, Cents As String
    Dim DecimalPlace, Count As Integer
    Dim Place(9) As String
    Place(2) = " Nghìn "
    Place(3) = "Triệu "
    Place(4) = " Tỉ "
    Place(5) = "Trăm tỉ "
    ' Convert MyNumber to a string, trimming extra spaces.
    MyNumber = Trim(MyNumber)
    ' Find decimal place.
    DecimalPlace = InStr(MyNumber, ".")
    ' If we find decimal place...
    If DecimalPlace > 0 Then
    ' Convert cents
    Temp = Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2)
    Cents = ConvertTens(Temp)
    ' Strip off cents from remainder to convert.
    MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber ""
    ' Convert last 3 digits of MyNumber to English dollars.
    Temp = ConvertHundreds(Right(MyNumber, 3))
    If Temp "" Then Dollars = Temp & Place(Count) & Dollars
    If Len(MyNumber) > 3 Then
    ' Remove last 3 converted digits from MyNumber.
    MyNumber = Left(MyNumber, Len(MyNumber) - 3)
    Else
    MyNumber = ""
    End If
    Count = Count + 1
    Loop
    ' Clean up dollars.
    Select Case Dollars
    Case ""
    Dollars = "Không Đồng"
    Case "One"
    Dollars = "Một Đồng"
    Case Else
    Dollars = Dollars & " Đồng"
    End Select
    ' Clean up cents.
    Select Case Cents
    Case ""
    Cents = " Chẵn"
    Case "One"
    Cents = " Lẻ"
    Case Else
    Cents = " And " & Cents & " Cents"
    End Select
    ConvertCurrencyToEnglish = Dollars & Cents
    End Function
    Private Function ConvertHundreds(ByVal MyNumber)
    Dim Result As String
    ' Exit if there is nothing to convert.
    If Val(MyNumber) = 0 Then Exit Function
    ' Append leading zeros to number.
    MyNumber = Right("000" & MyNumber, 3)
    ' Do we have a hundreds place digit to convert?
    If Left(MyNumber, 1) "0" Then
    Result = ConvertDigit(Left(MyNumber, 1)) & " Chăm "
    End If
    ' Do we have a tens place digit to convert?
    If Mid(MyNumber, 2, 1) "0" Then
    Result = Result & ConvertTens(Mid(MyNumber, 2))
    Else
    ' If not, then convert the ones place digit.
    Result = Result & ConvertDigit(Mid(MyNumber, 3))
    End If
    ConvertHundreds = Trim(Result)
    End Function
    Private Function ConvertTens(ByVal MyTens)
    Dim Result As String
    ' Is value between 10 and 19?
    If Val(Left(MyTens, 1)) = 1 Then
    Select Case Val(MyTens)
    Case 10 : Result = "Mười"
    Case 11 : Result = "Mười Một"
    Case 12 : Result = "Mười Hai"
    Case 13 : Result = "Mười Ba"
    Case 14 : Result = "Mười Bốn"
    Case 15 : Result = "Mười Năm"
    Case 16 : Result = "Mười Sáu"
    Case 17 : Result = "Mười Bảy"
    Case 18 : Result = "Mười Tám"
    Case 19 : Result = "Mười Chín"
    Case Else
    End Select
    Else
    ' .. otherwise it's between 20 and 99.
    Select Case Val(Left(MyTens, 1))
    Case 2 : Result = "Hai Mươi "
    Case 3 : Result = "Ba Mươi "
    Case 4 : Result = "Bốn Mươi "
    Case 5 : Result = "Năm Mươi "
    Case 6 : Result = "Sáu Mươi "
    Case 7 : Result = "Bảy Mươi "
    Case 8 : Result = "Tám Mươi "
    Case 9 : Result = "Chín Mươi "
    Case Else
    End Select
    ' Convert ones place digit.
    Result = Result & ConvertDigit(Right(MyTens, 1))
    End If
    ConvertTens = Result
    End Function
    Private Function ConvertDigit(ByVal MyDigit As Object)
    Select Case Val(MyDigit)
    Case 1 : ConvertDigit = "Một"
    Case 2 : ConvertDigit = "Hai"
    Case 3 : ConvertDigit = "Ba"
    Case 4 : ConvertDigit = "Bốn"
    Case 5 : ConvertDigit = "Năm"
    Case 6 : ConvertDigit = "Sáu"
    Case 7 : ConvertDigit = "Bảy"
    Case 8 : ConvertDigit = "Tám"
    Case 9 : ConvertDigit = "Chín"
    Case Else : ConvertDigit = ""
    End Select
    End Function
    End Module
    Thank you ,

    Hi,
    Hope this help, http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=103 .
    You can search a topic User Function Libraries in Crystal Report for creating you own function
    Regards,
    Clint

  • Function module to convert currency to USD

    Hi All,
                 I need the function module to convert the currency to USD and the mandatory fields to be passed to the function module.
    Thanks & Regards
    Suresh

    hi,
    Working With LSMW:
    Use TCODE LSMW
    Objects of LSMW:
    •Project – ID with max of 10 char to Name the data transfer project.
    • Subproject – Used as further structuring attribute.
    • Object – ID with max of 10 Characters, to name the Business object .
    • Project can have multiple sub projects and subprojects can have multiple objects.
    • Project documentation displays any documentation maintained for individual pop ups and processing steps
    User Guide: Clicking on Enter leads to interactive user guide which displays the Project name, sub project name and object to be created.
    Object type and import techniques:
    • Standard Batch / Direct input.
    • Batch Input Recording
    o If no standard programs available
    o To reduce number of target fields.
    o Only for fixed screen sequence.
    • BAPI
    • IDOC
    o Settings and preparations needed for each project
    Preparations for IDOC inbound processing:
    • Choose settings -> IDOC inbound processing in LSMW
    • Set up File port for file transfer, create port using WE21.
    • Additionally set up RFC port for submitting data packages directly to function module IDoc_Inbound_Asynchronous, without creating a file during data conversion.
    • Setup partner type (SAP recommended ‘US’) using WE44.
    • Maintain partner number using WE20.
    • Activate IDOC inbound processing.
    • Verify workflow customizing.
    Steps in creating LSMW Project:
    1) Maintain attributes – choose the import method.
    2)Maintain source structure/s with or without hierarchical relations. (Header, Detail)
    3) Maintain source fields for the source structures. Possible field types – C,N,X, date, amount and packed filed with decimal places.
    • Fields can be maintained individually or in table form or copy from other sources using upload from a text file
    4) Maintain relationship between source and target structures.
    5) Maintain Field mapping and conversion rules
    • For each Target field the following information is displayed:
    o Field description
    o Assigned source fields (if any)
    o Rule type (fixed value, translation etc.)
    o Coding.
    o Some fields are preset by the system & are marked with Default setting.
    6) Maintain Fixed values, translations, user defined routines – Here reusable rules can be processed like assigning fixed values, translation definition etc.
    6) Specify Files
    o Legacy data location on PC / application server
    o File for read data ( extension .lsm.read)
    o File for converted data (extension .lsm.conv)
    7) Assign Files – to defined source structures
    8) Read data – Can process all the data or part of data by specifying from / to transaction numbers.
    9) Display read data – To verify the input data being read
    10) Convert Data – Data conversion happens here, if data conversion program is not up to date, it gets regenerated automatically.
    11) Display converted data – To verify the converted data
    Import Data – Based on the object type selected
    • Standard Batch input or Recording
    o Generate Batch input session
    o Run Batch input session
    • Standard Direct input session
    o Direct input program or direct input transaction is called
    BAPI / IDOC Technique:
    • IDOC creation
    o Information packages from the converted data are stored on R/3 Database.
    o system assigns a number to every IDOC.
    o The file of converted data is deleted.
    • IDOC processing
    o IDOCS created are posted to the corresponding application program.
    o Application program checks data and posts in the application database.
    Finally Transport LSMW Projects:
    • R/3 Transport system
    o Extras ->Create change request
    o Change request can be exported/imported using CTS
    • Export Project
    o Select / Deselect part / entire project & export to another R/3 system
    • Import Project
    o Exported mapping / rules can be imported through PC file
    o Existing Project data gets overwritten
    o Prevent overwriting by using
    ‘Import under different name
    for more information follow this link.
    http://help.sap.com/saphelp_nw04s/helpdata/en/87/f3ae74e68111d1b3ff006094b944c8/content.htm

  • Function Module to convert currency

    Hi all,
    I need to convert all currency to 'EURO'.Could you please anybody help me in this regard.whather is there any function module?.
    Regards.
    Reddy Prasad.

    HI,
    Please try this .
    FWOS_CURRENCY_DECIMALS_READ :All the currency amounts are stored in SAP tables as CURR(n,2) (the same as DEC(n,2)). So before any arithmetic operation value should be adjusted using the real decimals number for the given currency (stored in TCURX).
    Conversion Rates by type and date are stored in TCURR (+factors). Standard type is M. Date is stored in inverted format (the most recent date has the numerically smallest value). ABAP code to convert dates:
    convert date p_date into inverted-date w_date.
    convert inverted-date w_date into date p_date.
    CONVERT_TO_LOCAL_CURRENCY :the only difference between CONVERT_TO_LOCAL_CURRENCY and CONVERT_TO_FOREIGN_CURRENCY seems to be the following:
    Foreign currency is TCURR-FCURR (From Currency)
    Local Currency is TCURR-TCURR (To Currency)
    So result will be slightly different for the both functions (two rates stored in the TCURR: e.g. JPY->USD rate is 0.00880, USD->JPY rate is 122.00000). Better to use CONVERT_TO_LOCAL_CURRENCY, because multiplication is more exact operation than division.
    CONVERT_TO_FOREIGN_CURRENCY :Both conversion functions can return also selected rate and factors
    reward all helpfull answers,
    regards .
    Jay

  • CONVERTING CURRENCY RATE

    Hi,
    I have a bank report in which transaction is carried out through out the world i.e in different currency
    but in the report they want to see the amount of any foreign currency in local currency ( BAD )
    i've tried making formula by putting 'IF' & 'THAN' logic for example i want to convert USD in BAD
    =If([L01 Currency])="US Dollar"Then([Total Debit Postings]*2.75)
    this formula is fine and working ,
    but this is for one specific currency
    What i want is what ever currency it is showing in the report it should change automatically into local currency (BAD)
    like here we are having N number of currencies which depends on the transaction carried out so is there any converter or formula so that it should change the currency automatically.....??
    Thank you,

    Hi Sunil,
    The formula which you have given is fine but it do not come up with the requirement
    like every currency have a different exchange rate...
    i want all the currencies to be transformed into Bahrain Dinar..
    so like USD has a different exchange rate, SAR have a different exchange rate and so on....
    i hope I am clear to you....
    so any suggestions regarding this,
    Thank you...

  • Is there anybody help me about converting currency..Please

    Hi
    I want to convert vbrp-netwr according to the currency of vbrk-waerk .Clearly I want to  write piece of code, if vbrk-waerk equals ckmlcr-curtp do not do any conversion else is not equal convert it related date is vbrp-fbuda.

    Hi,
    Try with the FM's :
    CONVERT_FOREIGN_TO_FOREIGN_CUR
    CONVERT_AMOUNT_TO_CURRENCY
    CONVERT_TO_LOCAL_CURRENCY
    CONVERT_TO_FOREIGN_CURRENCY
    Regards,
    Santhosh

  • Convert currencies in transformation

    Hi Experts,
    I have requirement where I need to convert the amounts from FIAP cube and send it to  External sytem using Open Hub.Currently the data is coming in diffrent currencies from ECC and I need to send the amount in single currency USD.what is the best way to convert in to a single currency.
    Regards
    Pasad

    Hi,
    go through the below link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0d5bf96-b19b-2c10-e3b6-e2f12a3de99a?quicklink=index&overridelayout=true
    Regards,
    Marasa.

  • Converting currency fields into strings without separators

    Hi all,
       Currently i'm using the write statement to do the conversions.
       data : amt(30).
       write bseg-dmbtr into amt currency 'USD'.
       However the output is in "123,456.00" format.
       I need the output in "123456.00" without the commas.
       Other than doing a "REPLACE" command for the commas in the amt string, is there a better way of getting the desired currency output without commas?
    regards

    Ahhhh thanks!
    I get error while rewarding the solution?  I'll try again later
    Message was edited by: Bee Huat, Leonard Yong

  • Convert currency to character in smartforms.

    Hi Friends,
    I need one solution.
    I have 5 currency fields and i wanna print these currencies fields into character format in SMARTFORMS.
    How can we do it.
    Plz reply me as soon as possible.
    Thanks & Regards,
    Swapnika

    hi swapnika,
    u need to print amount in words. is this ur requiremnet?
    if s then TAKE A LOOK OF  following code.
    DATA : W_AMOUNT TYPE PC207-BETRG ,
           W_DUTY TYPE IN_WORDS.
    MOVE reguh-rwbtr TO W_AMOUNT.
    CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
    EXPORTING
    amt_in_num   = W_AMOUNT
    IMPORTING
    amt_in_words = W_DUTY.
      REPLACE 'RUPEES' WITH '' INTO W_DUTY.
      REPLACE 'ONLY' WITH '' INTO W_DUTY.
    IF WANTMORE HELP LET M KNW..

  • Convert Currency to regular number

    I have a value that is in the currency format, say $161. I want to divide that by a constant(140 in this case) which will give me 1.15. I want to then display that 1.15 as a duration in hours. But Numbers gives me an error because the 1.15 is in currency format. I have to strip the 1.15 of it's currency designation. The only way I have been able to that is to create a seperate table that divides the currency value by 140, then reference that in duration column.
    I need something like STRIPCURRENCY.
    Seems like I am missing something simple.

    Jeez, I'm slapping myself on the head this morning. I woke up with a better idea.
    It's even easier than that. Just change the format of the cell where you did the division. It will automatically be a currency, change it to a number. No need for any "strip currency" function.
    One pitfall with VALUE is that it rounds to whatever is displayed on the screen. It's really a text function, not a number function so you have to be careful. I tried a few other ways to strip the currency. One that worked within the DURATION function is MAX.
    B2 = $161.00345 but is displayed as $161.00 in the cell
    C2 = 135
    D2 = B2/C2 formated as a number
    E2 = DURATION(,,D2) = 1h 11m 33s 425ms
    E3 = DURATION(,,MAX(B2)/C2) = 1h 11m 33s 425ms
    E4 = DURATION(,,VALUE(B2)/C2) = 1h 11m 33s 333ms -- not quite right

  • Bug in Converting Currencies with SL Calculator

    I am trying to update the currencies in my Snow Leopard Calculator, but it's not working.
    When I click on "Update" button nothing happens.
    Can someone help me, please?
    Thank you or your attention.

    If you need currency conversion information use www.oanda.com. They have online converters plus tons of other information. Or you can find alternative utilities and widgets that do work at VersionTracker or MacUpdate.

  • Is there templates which automatically convert currency

    Hi there i am new to using numbers and have no idea on how to create formulas let alone use them period! So i was hoping there is someone outer that may have a template that i can use where i cancun and paste my inventory products, descriptions, mages, wholesale price and retail price in USD and it will automatically convert or add a column in AUD or vice verse.

    Hi storm
    Numbers will not automatically import the latest exchange rate.
    Look for them here:
    https://service.commbank.com.au/tools/foreign-exchange-calculator/foreign-exchan ge-calculator.aspx?gclid=cj0keqjwifwnbrcb5pt57ksvw-kbeiqasv7arg8fntoryki8ywugqng uk_r32go3pxcfu9g4tdotgwoaarkl8p8haq&c
    The current (9 March 2015) exchange rate from that website is AUD 1 = USD 0.732500
    Insert the current exchange rate into cell A2 of the Exchange Rate table
    Formula in C2 of the Prices table (and Fill Down)
    =B2÷Exchange Rate::A$2
    Regards,
    Ian.

  • Problem in converting currency field.......

    Hi All,
    In my database the Amount field has a lenght of 6 N.
    I need the output of the format in the below example
    Examples:
    1.If the Amount is 150 in databse I need the output as 015000
    2.If the Amount is 25.50 in databse I need the output as 002500
    Could you please help me what function should I use to the output as required.
    Your help will be greatly appreciated
    Thanks in Advance
    Naveen

    select to_char(mynumber*100, '000000)
    from my_table;

Maybe you are looking for

  • Server 2003 to SBS 2011 Error

    Hello, I am migrating a customer from Server 2003 64bit with Exchange 2007 to SBS 2011. I installed SBS 2011 in Migration mode,  The install has completed. But in the SBS console there are no users or computers listed.  I have done this migration fro

  • Manage hardware in asset management

    hi all i'm new at zenworks, so we try to add hardware costs, lifetime, date of order but there is no hardware tab in asset management... is there any possibility for addig hardware the asset management? or is the only way to add it as software and ad

  • How to allow use of special characters in a particular version/Hierarchy

    How do I allow use of special character in nodename description in a particular hierarchy. If I enable InvNameSystem Preference it allows me for all hierarchies and versions,but I want to restrict it for particular version and hierarchy.

  • Internal Forex Trading

    Hi All, Request you to share your views on Internal forex trading (Mirror Transaction) I am working on Internal forex trading , when i enter the details of the transaction in the Tcode TX31 for transaction close and give in the required details, syst

  • MY ICLOUD EMAIL IS WRONG HOW DO I CORRECT IT

    icloud email is wrong need to correct it?