Convert One Currency To Another

How to convert from one currency to another foreign currency?

We can Use the Following Function Module to convert from one Currency value to others.

In following function module we need to pass Foreign currency, Local Currency type_rate: 

Type of rate:

M=Average rate 
G=Bank buying rate 
B=Bank selling rate

We Get Exchange rate for that day, foreign factor, Local factor.

And Foreign currency can be calculated as below mentioned in IF ENDIF
 

Coding:

DATA: l_er TYPE tcurr-ukurs, 
             l_ff TYPE tcurr-ffact,
             l_lf TYPE tcurr-tfact,
             l_erate(12) TYPE c,

CALL FUNCTION 'READ_EXCHANGE_RATE'
      EXPORTING
           date = sy-datum
           foreign_currency = wa_bseg-pswsl
           local_currency = c_euro
           type_of_rate = 'M'
      IMPORTING
           exchange_rate = l_er
           foreign_factor = l_ff
           local_factor = l_lf
      EXCEPTIONS
           no_rate_found = 1
           no_factors_found = 2
           no_spread_found = 3
          derived_2_times = 4
          overflow = 5
      OTHERS = 6.

IF sy-subrc = 0.
   l_erate = l_er / ( l_ff / l_lf ).
   wa_itab-wrbtr = wa_itab-wrbtr * l_erate.
endif.

ABAP Tips

See Also
Program For Printing Prime Number

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP Basis, ABAP Programming and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.