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

testing function module

Former Member
0 Likes
899

Hello all,

iam testing the function module convert_to_local_currency and i gave import parameters but iam not able to see export parameters but iam geeting enter rate 40/21.25 rate type m for 04.04.2008 in system testings?Please help me regarding this.

Thanks & Regards

Priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
814

Hi Priya,

Did you read the Function module Documentation thoroughly. Apart from giving the Local currency, local amount, foreign currency and foreign amount, you should also pass the Rate ( Rate is nothing but the Exchange rate)

Also regarding the type of rate, by default it is 'M' means Average rate. try to pass the value depend on the rate of the currency.

Type of rate M=Average rate G=Bank buying rate B=bank sellin rate.

Return ->

Type of rate M=Average rate G=Bank buying rate B=bank sellin

By default always pass Average rate.

data lv_netwr type ekpo-netwr.

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

DATE = sy-datum

FOREIGN_CURRENCY = 'SAR'

LOCAL_AMOUNT = 1000

LOCAL_CURRENCY = 'INR'

RATE = 11

TYPE_OF_RATE = 'M'

READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

FOREIGN_AMOUNT = lv_netwr

  • FOREIGN_FACTOR =

  • LOCAL_FACTOR =

  • EXCHANGE_RATEX =

  • DERIVED_RATE_TYPE =

  • FIXED_RATE =

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

6 REPLIES 6
Read only

Former Member
0 Likes
813

Hi,

just check like this:

DATA: v_amount TYPE p DECIMALS 2.

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING

date = sy-datum

foreign_currency = 'INR'

local_amount = '1.00'

local_currency = 'USD'

IMPORTING

foreign_amount = v_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.

WRITE: / 'US dollar to Indian rupees - ', v_amount.

ENDIF.

Regards,

Shiva Kumar

Read only

0 Likes
813

Hello Kadiyala,

iam working in BW idnt have development access key for write the programe so

i went to se37 and gave parameters as foreign amount 40 foreign currency euro and local currency gbp and date 04.04.2008 but iam not getting export parameters.Please help me.

Thanks & Regards

Priya

Read only

0 Likes
813

Hi,

For this conversion, I guess in SPRO tcode some changes has to be made for currency conversion. If we give the same currency in both the import parameters we get the result, but if we give different currency for converting, me too getting the same message as yours. So do the changes in SPRO and then try.

Read only

0 Likes
813

Hi,

The functional people need to set the Rate for conversion .That is not set in the system.I think u r getting the No_Rate_found exception after executing the Function module.

Yes, That value is coming in Program .But ,that is not coming in functiona module testing.i.e.Just because of not mentioning the type of exporting parameter.

Regards,

Shiva Kumar

Read only

0 Likes
813

Priya,

If you call the FM from se37 it will not show any values in the export parameters but if you call the same FM from any other program you will be able to see the values for the export parameters. Reason is the Data Types for the Export parameters were not defined. If you debug the FM you will be able to see the calculated values.

Regards,

Kiran Bobbala

Read only

Former Member
0 Likes
815

Hi Priya,

Did you read the Function module Documentation thoroughly. Apart from giving the Local currency, local amount, foreign currency and foreign amount, you should also pass the Rate ( Rate is nothing but the Exchange rate)

Also regarding the type of rate, by default it is 'M' means Average rate. try to pass the value depend on the rate of the currency.

Type of rate M=Average rate G=Bank buying rate B=bank sellin rate.

Return ->

Type of rate M=Average rate G=Bank buying rate B=bank sellin

By default always pass Average rate.

data lv_netwr type ekpo-netwr.

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

DATE = sy-datum

FOREIGN_CURRENCY = 'SAR'

LOCAL_AMOUNT = 1000

LOCAL_CURRENCY = 'INR'

RATE = 11

TYPE_OF_RATE = 'M'

READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

FOREIGN_AMOUNT = lv_netwr

  • FOREIGN_FACTOR =

  • LOCAL_FACTOR =

  • EXCHANGE_RATEX =

  • DERIVED_RATE_TYPE =

  • FIXED_RATE =

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