Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM: CONVERT_TO_LOCAL_CURRENCY

Former Member
0 Kudos

Hi

Kinldy the me how to use the FM:CONVERT_TO_LOCAL_CURRENCY. I am not able to populate the values.

Foreign curency i used as USD and Local Currency as GPP.

Thanks and Regards

Yamini.A

6 REPLIES 6

Former Member
0 Kudos

Sample call-up:

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING DATE = BKPF-WWERT

FOREIGN_CURRENCY = BKPF-WAERS

LOCAL_CURRENCY = T001-WAERS

FOREIGN_AMOUNT = BSEG-WRBTR

RATE = BKPF-KURSF

TYPE_OF_RATE = 'M'

IMPORTING EXCHANGE_RATE = KURS

LOCAL_AMOUNT = BSEG-DMBTR

FOREIGN_FACTOR = FAKTOR-F

LOCAL_FACTOR = FAKTOR-L

FIXED_RATE = FIXKURS

EXCEPTIONS NO_RATE_FOUND = 4

NO_FACTORS_FOUND = 8.

open Transaction se37 , neter the FM name as CONVERT_TO_LOCAL_CURRENCY, display, now in tool bar click the "function module documentation" button for more info.

reward points if it helps you

andreas_mann3
Active Contributor
0 Kudos

Hi,

try:

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'         
     EXPORTING                                    
          DATE             = SY-DATUM             
          FOREIGN_AMOUNT   = foreign_amount       
          FOREIGN_CURRENCY = t005-curha     "USD      
          LOCAL_CURRENCY   = T000-MWAER     "GBP      
     IMPORTING                                    
          LOCAL_AMOUNT     = LOCAL_AMOUNT  .      

Andreas

former_member225448
Participant
0 Kudos

Hi Yamini,

here some code:


    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
      EXPORTING
        DATE             = SYST-DATUM
        FOREIGN_AMOUNT   = for_amount
        FOREIGN_CURRENCY = 'USD'
        LOCAL_CURRENCY   = 'GPP'
*            TYPE_OF_RATE = 'M'  
      IMPORTING
        LOCAL_AMOUNT     = loc_ammount
      EXCEPTIONS
        NO_RATE_FOUND    = 1
        OVERFLOW         = 2
        NO_FACTORS_FOUND = 3
        NO_SPREAD_FOUND  = 4
        DERIVED_2_TIMES  = 5.

The call calculates the "GPP" value of a given "USD" value based on TCURR's 'official averadge rate' of the current day. Sorry, I just translated the german term, but this is the rate, that is used for international money transfer.

Pls. remember that someone has to fill TCURR with correct values

If you find my answer useful, please don't forget the reward.

Regards,

Juergen

Murali_Shanmu
Active Contributor
0 Kudos

Yes, Juergen Wurth is correct !!!

Former Member
0 Kudos

Hi yamini,

check this it may help you......

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
       EXPORTING
*    CLIENT                  = 001
        DATE                    = sy-datum
         FOREIGN_CURRENCY        = wa1-WAERS " here you need to declare your foreign currency i.e USD
         LOCAL_CURRENCY          = TCURR-FCURR
         FOREIGN_AMOUNT          = wa1-DMBTR " here you need to declare your amount field.
*    RATE                    = tcurr-ukurs
        TYPE_OF_RATE            = 'M'        " check this also the average rate
*    READ_TCURR              = 'X'
      IMPORTING
        EXCHANGE_RATE           = tcurr-UKURS
*    FOREIGN_FACTOR          =
        LOCAL_AMOUNT            = wa1-TOTAL  " this is the field where the converted amt has to be displayed.
*    LOCAL_FACTOR            =
*    EXCHANGE_RATEX          =
*    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
               .
 IF SY-SUBRC <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Translate foreign currency amount to local currency

An amount in local currency is calculated from a specified foreign currency amount. For this, you may either specify the translation rate manually (Parameter RATE) or have the system determine it from table TCURR on the basis of the rate type, date and currency key. Because the ratios for the units of the currencies involved in the translation are significant for this translation, table TCURF is always read by the program, and there must be a valid entry there for the data specified. IF exchange rate fixing is defined for the exchange rate type TYPE_OF_RATE or an alternative exchange rate is defined for the currency pair, this information is transferred to the calling program.

When table TCURR is read, the foreign currency key is always taken as the first part of the key and the local currency as the second part.

hope this helps you.

regards,

venu.

Former Member
0 Kudos

Hi,

Plese try this.

CALL FUNCTION '<b>CONVERT_TO_LOCAL_CURRENCY</b>'

EXPORTING

DATE = sy-datum

FOREIGN_AMOUNT = '100'

FOREIGN_CURRENCY = 'US$'

LOCAL_CURRENCY = 'INR'

IMPORTING

EXCHANGE_RATE =

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.

ENDIF.

If you get the error "No Rate Found" then go to the tcode <b>OB08</b>. This shows the existing currency exchange rates. If your Currency conversion doesn't exist enter the <b>From and To</b> values. This should make the function module to work correctly.

Please reward points if this explanation is useful.

Regards,

Siva