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: 

Reg:Conversion for Net value

Former Member
0 Kudos

Hi All,

I need to convert vbrp-netwr (net value) into USD with function module CONVERT_TO_LOCAL_CURRENCY .can any one can help me out by posting answer in detail.

with regards,

sumanth reddy

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sumanth,

Chk this out

data: lv_amount type p decimals 2.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

  • CLIENT = SY-MANDT

date = sy-datum

foreign_amount = '1000' amount which you wanted to (table-filed)

foreign_currency = 'XXX' from what currency (table-filed)

local_currency = 'USD' to currency (table-filed)

  • RATE = 0

  • TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

  • FOREIGN_FACTOR =

LOCAL_AMOUNT = LV_AMOUNT =====> final amount which is tobe 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.

WRITE: LV_AMOUNT.

ENDIF.

revert for further clarification

Thanks and Regards'

Srikanth.P

3 REPLIES 3

Former Member
0 Kudos

Hello,

You can use the FM in the following way

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

client = sy-mandt

date = sy-datum

foreign_amount = w_netwr

foreign_currency = w_waers "From currency

local_currency = w_waers1 "To currency

  • RATE = 0

  • TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

  • FOREIGN_FACTOR =

local_amount = w_amount "Converted amount

  • 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.

Former Member
0 Kudos

Hi Sumanth,

Chk this out

data: lv_amount type p decimals 2.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

  • CLIENT = SY-MANDT

date = sy-datum

foreign_amount = '1000' amount which you wanted to (table-filed)

foreign_currency = 'XXX' from what currency (table-filed)

local_currency = 'USD' to currency (table-filed)

  • RATE = 0

  • TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

  • FOREIGN_FACTOR =

LOCAL_AMOUNT = LV_AMOUNT =====> final amount which is tobe 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.

WRITE: LV_AMOUNT.

ENDIF.

revert for further clarification

Thanks and Regards'

Srikanth.P

Former Member
0 Kudos

As said by Sowmya n Srikanth we have to provide the details in the as mentioned, more details on the same for your case:

For you the Local currency is USD and the foreign currency value is vbrp-netwr and u need the curreny for that is the the one at VBRK-WAERK

Constant : lc_cukylocl type WAERK value 'USD'.
Data:        lv_amt_foreign type NETWR_FP .
lv_amt_foreign = VBRP-NETWR. 
lv_cukylocl      = VBRK-WAERK."Fetch the corresponding currency from VBRK header 
CLEAR lv_amtlocl.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
     EXPORTING
         date                      = sy-datum
         foreign_amount       = lv_amt_foreign
         foreign_currency     = lv_cukylocl
         local_currency        = lc_cukylocl
         type_of_rate           = 'M'
         read_tcurr              = 'X'
     IMPORTING
         local_amount         = lv_amtlocl
     EXCEPTIONS
         no_rate_found        = 1
         overflow                 = 2
         no_factors_found    = 3
         no_spread_found    = 4
         derived_2_times     = 5
         OTHERS               = 6.

Hope this is useful to your specific requirement.

Regards

Arun Thiyagarajan