Convert From One Currency to Another
2008-08-08 14:26
330 查看
The function is ConvertCurrency to convert currency from US dollar to any other currency on the PS_RT_RATE_TBL .
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;
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;
相关文章推荐
- How to convert an input image from one color space to another space
- Convert video files from one format to another
- Computing the Relative Path from One Directory to Another(Python cookbook 2-22)
- BW--ABAP to copy aggregates from one cube to another
- How to (how to refresh/redirect the contents of one frame from another frame )
- How to move ASM database files from one diskgroup to another
- Copy a table from one database to another in SQL Server 2005
- How to forward from one JSP to another JSP
- from one corner to another corner ,please get the shortest path numbers
- How to export/import data with LOB type from one user/schema to another
- Copy a table from one DB to another
- BAPI to Copy Materials from one Plant to Another
- BW--ABAP to copy aggregates from one cube to another
- [ZT]Submitting Web Form data from one ASP.NET page to another
- Insert Data From One Table to Another
- Copy all files recursively from one folder to another
- Passing data from one ABAP program to another
- How to move ASM database files from one diskgroup to another
- Copying an image from one server to another using PHP
- BAPI to Copy Materials from one Plant to Another