ConvertCurrency(amt, currency_cd, exchng_to_currency, exchng_rt_type, effdt, converted_amt [, error_process [, round] [, rt_index]])
The result of your conversion is placed in converted_amt. ConvertCurrency returns a Boolean value where True means a conversion rate was found and converted_amt calculated, and False means a conversion rate was not found and a value of one (1) was used.
Here is a sample code on how to use it:
/*get the max effective date from PS_RT_RATE_TBL to use in the function*/
SQLExec ( "select %dateout(max(effdt)) from PS_RT_RATE_TBL where from_cur = :1 and to_cur = 'USD' and rt_type = :2", &TXN_CURRENCY_CD, &rt_type, &effdt );
If ConvertCurrency (&AMOUNT, &TXN_CURRENCY_CD, "USD", &rt_type, &effdt, &AMOUNT_CONVERTED, "I" ) Then
&AMOUNT = &AMOUNT_CONVERTED;
End- If;
SQLExec ( "select %dateout(max(effdt)) from PS_RT_RATE_TBL where from_cur = :1 and to_cur = 'USD' and rt_type = :2", &TXN_CURRENCY_CD, &rt_type, &effdt );
If ConvertCurrency (&AMOUNT, &TXN_CURRENCY_CD, "USD", &rt_type, &effdt, &AMOUNT_CONVERTED, "I" ) Then
&AMOUNT = &AMOUNT_CONVERTED;
End- If;