当前位置:网站首页>SAP SEGW 事物码里的 ABAP 类型和 EDM 类型映射的一个具体例子
SAP SEGW 事物码里的 ABAP 类型和 EDM 类型映射的一个具体例子
2022-07-05 12:39:00 【汪子熙】
本文的示例主要关注 Edm属性的 ABAP Datetime 处理逻辑。Datetime 只是在映射ABAP 类型和 EDM 类型时可能出现不一致的例子之一。
对于 Edm.Datetime 属性,在后端,ABAP 字段可以表示为一个简单的日期或时间戳,可以带有也可以不带有小数秒。
因此,在 Service Builder 中对于一个EDM.Datetime 类型的属性,需要额外的信息来将这个 EDM 类型映射到后端中正确的 ABAP 字段类型。如果没有正确地映射,就会导致错误的类型赋值。
正确的类型赋值对于 MPC 的自动生成是至关重要的,因为 DPC 的实现是基于 MPC 类中生成的类型。
在 Service Builder 中实现这一目标的最初解决方案是:
如果 precision = 0 并且 scale = 0, 那么 ABAP internal type 为 type D.
如果 precision = 8 并且 scale = 0, 那么 ABAP internal type 为 type P,length 为 8 decimals 为 0 (
timestamp without fractional seconds)如果 scale = 7, 那么 ABAP internal type 为 type P,length 11 decimals 7 (
timestamp with fractional seconds)
除了使用上面示例中的 precision 和 scale 属性之外,也可以使用 Service Builder 中的ABAP Type Editor来直接设置内部类型。在 ABAP 类型编辑器中,可以手动设置类别为内部类型,规则如下:
- Type Kind = Date, Length = 8, Decimals = 0 ( 代表 Simple Date, internal type 为 D)
- Type Kind = Packed, Length = 15, Decimals = 0 (timestamp without fractional seconds, internal type 在 MPC 中显示为 type P length 8 decimals 0)
- Type Kind = Packed, Length = 21, Decimals = 7 (timestamp with fractional seconds, internal type 在 MPC 中显示为 type P,length 11 decimals 7)
以上描述规则在下面的截图里得到体现:

或者,您可以使用ABAP类型编辑器将一个 Data Element 分配给一个属性。在 ABAP 类型编辑器中,可以手动将 Category 设置为 Date,并在关联类型字段中输入数据元素名称。
当使用 RFC/BOR 导入或分配 DDIC 类型时,如果将结构分配给父构件(也就是 Entity Type 或复杂类型),则不会在 property 级别进行分配。
当使用从 DDIC 结构导入选项时,日期字段按以下方式处理:
如果字段的域是 类型
TZNTSTMPS,那么没有小数秒的时间戳,MPC的内部类型是类型 P, 长度 8, 小数点 0如果该字段的域类型为
TZNTSMPl,则 MPC 内部类型为 P 类型,长度为 11 位,小数位为 7
边栏推荐
- Tips and tricks of image segmentation summarized from 39 Kabul competitions
- RHCSA1
- RHCSA3
- Distributed solution - distributed lock solution - redis based distributed lock implementation
- Database connection pool & jdbctemplate
- Distributed solution - Comprehensive decryption of distributed task scheduling platform -xxljob
- 由扫地增而引起的小叙
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- ActiveMQ installation and deployment simple configuration (personal test)
- View and modify the MySQL data storage directory under centos7
猜你喜欢

HiEngine:可媲美本地的云原生内存数据库引擎

Average lookup length when hash table lookup fails

ActiveMQ installation and deployment simple configuration (personal test)

JSON parsing error special character processing (really speechless... Troubleshooting for a long time)

Distributed cache architecture - cache avalanche & penetration & hit rate

Alipay transfer system background or API interface to avoid pitfalls

Storage Basics

谈谈我写作生涯的画图技巧

Pytoch monolayer bidirectional_ LSTM implements MNIST and fashionmnist data classification

【Nacos云原生】阅读源码第一步,本地启动Nacos
随机推荐
实战模拟│JWT 登录认证
Free testing of Taobao tmall API order and flag insertion remark interface
Rasa Chat Robot Tutorial (translation) (1)
Difference between JUnit theories and parameterized tests
自然语言处理系列(一)入门概述
Detailed structure and code of inception V3
Taobao order interface | order flag remarks, may be the most stable and easy-to-use interface
Cypher syntax of neo4j graph database
Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
Redis clean cache
Halcon 模板匹配实战代码(一)
Flume common commands and basic operations
Volatile instruction rearrangement and why instruction rearrangement is prohibited
Pytoch loads the initialization V3 pre training model and reports an error
Average lookup length when hash table lookup fails
SAP 自开发记录用户登录日志等信息
JDBC exercise - query data encapsulated into object return & simple login demo
Lepton 无损压缩原理及性能分析
JSON parsing error special character processing (really speechless... Troubleshooting for a long time)
Using MySQL in docker