当前位置:网站首页>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
边栏推荐
- Distributed solution - distributed session consistency problem
- End to end neural network
- Pinduoduo flag insertion remarks API
- Reshape the power of multi cloud products with VMware innovation
- 我在滴滴做开源
- 石臻臻的2021总结和2022展望 | 文末彩蛋
- NFT: how to make money with unique assets?
- A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
- 前几年外包干了四年,秋招感觉人生就这样了..
- Implementing Yang Hui triangle with cyclic queue C language
猜你喜欢

Distributed cache architecture - cache avalanche & penetration & hit rate

SAP 自开发记录用户登录日志等信息

Ecplise development environment configuration and simple web project construction

Average lookup length when hash table lookup fails

【云原生】Nacos中的事件发布与订阅--观察者模式

C language structure is initialized as a function parameter

Pytoch implements tf Functions of the gather() function

Keras implements verification code identification

JDBC -- extract JDBC tool classes

Vonedao solves the problem of organizational development effectiveness
随机推荐
2021-12-21 transaction record
Difference between JUnit theories and parameterized tests
Distributed solution - Comprehensive decryption of distributed task scheduling platform - xxljob scheduling center cluster
Taobao flag insertion remarks | logistics delivery interface
Tips and tricks of image segmentation summarized from 39 Kabul competitions
Introduction to relational model theory
Simply take stock reading notes (3/8)
Transactions on December 23, 2021
CVPR 2022 | single step 3D target recognizer based on sparse transformer
Preliminary exploration of basic knowledge of MySQL
UNIX socket advanced learning diary -ipv4-ipv6 interoperability
Distributed solution - distributed session consistency problem
Anaconda creates a virtual environment and installs pytorch
Time conversion error
Vonedao solves the problem of organizational development effectiveness
《信息系统项目管理师》备考笔记---信息化知识
10 minute fitness method reading notes (3/5)
Database connection pool & jdbctemplate
Kotlin variable
10 minute fitness method reading notes (5/5)