
Parameter | Optional | Meaning |
amount | - | Inbound value. |
source_currency | - | Source currency from column WAERS of the DDIC database table TCURC. |
target_currency | - | Target currency from column WAERS of the DDIC database table TCURC. |
exchange_rate_date | - | Exchange rate date for column GDATU of the DDIC database table TCURR. |
exchange_rate_type | x | Exchange rate type from column KURST of the DDIC database table TCURR, default value: "M". |
client | x | Client whose rules are used to perform the currency conversion. Default: Content of the client column of the current row. |
round | x | The intermediate result of the conversion is rounded to the end result using commercial rounding; otherwise, it is truncated. |
decimal_shift | x | The decimal places of the source value are moved as specified by the decimal places of the source currency (see below). |
decimal_shift_back | x | The decimal places of the result are moved as specified by the decimal places of the target currency (see below). |
on_error | x | Error handling. |
DATA currency TYPE c LENGTH 5 VALUE 'USD'.
SELECT FROM demo_prices
FIELDS id,
amount,
currency,
currency_conversion(
amount = amount,
source_currency = currency,
target_currency = @currency,
exchange_rate_date = @sy-datlo,
round = 'X',
on_error = @sql_currency_conversion=>c_on_error-fail )
AS Converted_Amount,
@currency AS converted_currency
ORDER BY id
INTO TABLE @DATA(converted_prices_asql).
ID | Amount | Currency | Converted Amount | Converted Currency |
1 | 5100.0 | EUR | 5610.0 | USD |
2 | 1.0 | GBP | 1.5 | USD |
3 | 1.0 | JPY | 0.87 | USD |
4 | 1.0 | USD | 1.0 | USD |
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view entity DEMO_CDS_CURR_CONV
with parameters
to_currency :abap.cuky( 5 ),
exc_date :abap.dats
as select from
demo_prices
{
key id,
amount,
currency,
@Semantics.amount.currencyCode: 'currency'
currency_conversion( amount => amount,
source_currency => currency,
round => 'X',
target_currency => $parameters.to_currency,
exchange_rate_date => $parameters.exc_date,
error_handling => 'SET_TO_NULL' ) as ConvertedAmount,
$parameters.to_currency as ConvertedCurrency
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |