当前位置:网站首页>How to use the current conversion function in SAP CDs view
How to use the current conversion function in SAP CDs view
2022-06-28 18:19:00 【Hua Weiyun】
function CURRENCY_CONVERSION To pass to the formal parameter amount To perform currency conversion . The data type of the result CURR Have and pass to amount The actual parameters of the same technical properties .
Currency conversion is based on database tables TCUR System specific logins saved in client Rules are enforced , This database table is stored in SFIB Development kit . These rules can use transaction codes OB08 Editing .
The transformation is performed on the database , This means that part of the calculation is done using the ABAP Different rounding rules . No matter what conversion , Can not expect to get and use the standard Function Module The same result for currency conversion , Because these latter are usually less accurate , And rounding the intermediate result accordingly .
Here is a concrete example .
for example , I developed a CDS view, And automatically generates a Fiori Elements application , The monetary unit shown in it is Euro :

I expect to use CDS view Currency conversion function ,currency conversion, Convert the units of these amounts into US dollars .
You can use this file The conversion function mentioned in .
Use the following highlighted code :

@AbapCatalog.sqlViewName: 'ZCTRAVELJERRY'@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #CHECK@EndUserText.label: 'Consumption view from /DMO/I_TRAVEL_U'@Metadata.allowExtensions: true@Search.searchable: truedefine view Z_C_TRAVEL_DATA_JERRY as select from /DMO/I_Travel_U association [1..1] to /DMO/I_Agency as _Agency on $projection.AgencyID = _Agency.AgencyIDassociation [1..1] to /DMO/I_Customer as _Customer on $projection.CustomerID = _Customer.CustomerID{ key TravelID, @ObjectModel.text.association: '_Agency' AgencyID, CustomerID, concat_with_space(_Customer.Title, _Customer.LastName, 1) as Addressee, BeginDate, EndDate, BookingFee, TotalPrice, CurrencyCode, currency_conversion( amount => TotalPrice, source_currency => CurrencyCode, round => 'X', target_currency => cast('USD' as abap.cuky( 5 )), exchange_rate_date => cast('20200429' as abap.dats), error_handling => 'SET_TO_NULL' ) as PriceInUSD, @Search.defaultSearchElement: true @Search.fuzzinessThreshold: 0.90 Memo, Status, LastChangedAt, /* Associations */ _Agency, _Booking, _Currency, _Customer} The final effect :
The conversion effect is as follows : Blue is the original Euro unit , The red one is through currency_conversion New value after conversion :

边栏推荐
- Go 降序排序 取 Top N
- 6 - Dictionary
- Go all out to unreal
- Small program graduation project based on wechat mobile mall small program graduation project opening report function reference
- 使用Pega进行一个简单的RPA程序开发
- Dpdk 20.11 compiling, installing and running program
- 2022 review questions and answers for safety production management personnel of hazardous chemical production units
- 58技术沙龙第三十一期|Flutter动态化专题沙龙
- IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
- Matlb| optimal operation and marketization of power system
猜你喜欢

Matlb| optimal operation and marketization of power system

杂记:数据库go,begin,end,for,after,instead of

Applet graduation design based on wechat gym private education appointment applet graduation design opening report function reference

TDengine ×英特尔 边缘洞见软件包 加速传统行业的数字化转型

Dnslog injection

Small program graduation project based on wechat recruitment small program graduation project opening report function reference

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

CSDN博客专家

MCU modifies network hardware driver (PHY chip replacement)

TDengine  × Intel edge insight software package accelerates the digital transformation of traditional industries
随机推荐
使用Pega进行一个简单的RPA程序开发
nuc980心跳灯
kubernetes资源对象介绍及常用命令
58技术沙龙第三十一期|Flutter动态化专题沙龙
如何制作CSR(Certificate Signing Request)文件?
工业数字化与新一代数字化系统设计平台----讲座
Ding! Techo day Tencent technology open day arrived as scheduled!
Mycat+ sub database and sub table
数据库MySQL语句期末复习 CTGU
9个优秀的占位图服务
2022起重机械指挥考试题库模拟考试平台操作
Redis 原理 - Hash
Leetcode 6. Z 字形变换(牛逼,解决了)
Currency circle earthquake: earned 1million last year and lost 5million this year
请教大佬们,oracle cdc的NUMBER类型,打印出来为什么变成字符串了呢,怎么转换回去?
Dnslog injection
58 Technology Salon issue 31 flutter dynamic special Salon
Visio use
IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
Small program graduation design based on wechat driving school examination small program graduation design opening report function reference