SAP SQL SCRIPT CURR CONV ABEXA



Get Example source ABAP code based on a different SAP table
  



SAP HANA, Currency Conversion with SQLScript
This example demonstrates how a built-in HANA SQL function is called in SQLScript.

ABAP_SOURCE_CODE
DEMO CL_DEMO_SQLSCRIPT_CURR_CNVRSN

ABAP_DESCRIPTION
If possible, the example class calls the AMDP method CONVERT of the AMDP class CL_DEMO_SQLSCRIPT_CURR_CONV.
METH CL_DEMO_SQLSCRIPT_CURR_CONV=>CONVERT
The SQLScript implementation of this method uses the built-in SQL function CONVERT_CURRENCY to convert the amounts in the column amount in the database DEMO_PRICES to a currency entered by the user.
If the current database is not an SAP HANA database, the method ABAP_CONVERT is called as an alternative.
METH CL_DEMO_SQLSCRIPT_CURR_CONV=>ABAP_CONVERT
This method uses the function module CONVERT_TO_LOCAL_CURRENCY. Here, the table to b converted is first read to an internal table in AS ABAP and must be written again after the conversion.



Latest notes:

See also
Unit and Currency Conversion Functions in ABAP SQL. The built-in SQL function CURRENCY_CONVERSION wraps the HANA function CONVERT_CURRENCY. The class CL_DEMO_ASQL_FUNC_CURR_CONV shows how the same function as above can be achieved by using an ABAP SQL SELECT that calls the SQL function.
Unit and Currency Conversion Functions in ABAP CDS. The built-in CDS function CURRENCY_CONVERSION wraps the HANA function CONVERT_CURRENCY. The class CL_DEMO_CDS_FUNC_CURR_CONV_VE shows how the same function as above can be achieved by using a CDS view that calls the CDS function.
A complete code relocation using a subquery in the ABAP SQL statement MODIFY is only possible if no table logging takes place.
ABAP_HINT_END