Application Development and Automation 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: 
Read only

reg : Function Module for currency conversion

Former Member
0 Likes
753

hi,

I am using FM 'convert_to_foreign_currency'.

Iam giving USD 500 , and I want in GBP.

but the output id 3 GBP.

Is there any function module which solves my issue.

its urgent plz.

regards

Parthu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
628

hi

good

check this

Goto transaction SU3.

goto DEFAULT tab

Change the DECIMAL NOTATION as per your requirement

SAVE

(OR)

lv_text = 12,000.

CALL FUNCTION 'STRING_REPLACE'

EXPORTING

pattern = ','

substitute = space

changing

text = lv_text

EXCEPTIONS

WRONG_STRING_LENGTH = 1

OTHERS = 2.

(OR)

Look at the function module BAPI_CURRENCY_CONV_TO_INTERNAL

thanks

mrutyun^

4 REPLIES 4
Read only

Former Member
0 Likes
628

Hi,

Please look at the sample code below :


  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
    EXPORTING
      date             = gv_firstday
      foreign_amount   = wrbtr
      foreign_currency = 'GBP'
      local_currency   = 'USD'
      type_of_rate     = 'M'
    IMPORTING
      exchange_rate    = cv_lv_ukurs
      local_amount     = cv_vallc1
    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.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
629

hi

good

check this

Goto transaction SU3.

goto DEFAULT tab

Change the DECIMAL NOTATION as per your requirement

SAVE

(OR)

lv_text = 12,000.

CALL FUNCTION 'STRING_REPLACE'

EXPORTING

pattern = ','

substitute = space

changing

text = lv_text

EXCEPTIONS

WRONG_STRING_LENGTH = 1

OTHERS = 2.

(OR)

Look at the function module BAPI_CURRENCY_CONV_TO_INTERNAL

thanks

mrutyun^

Read only

0 Likes
628

thanks mrutyun.

issue is solved

rewarded points.

regards

Parthu

Read only

Former Member
0 Likes
628

I've tried like this...I'm getting output as '333'.


DATA : f_amount(16) TYPE p.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
  EXPORTING
    date             = sy-datum
    foreign_currency = 'GBP'
    local_amount     = '500'
    local_currency   = 'USD'
    type_of_rate     = 'M'
  IMPORTING
    foreign_amount   = f_amount.
WRITE :/ f_amount.