当前位置:网站首页>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
边栏推荐
- Sqoop import and export operation
- Flume common commands and basic operations
- Iterator details in list... Interview pits
- Summary of C language learning problems (VS)
- JDBC exercise - query data encapsulated into object return & simple login demo
- Time conversion error
- CVPR 2022 | 基于稀疏 Transformer 的单步三维目标识别器
- Introduction to relational model theory
- Get the variable address of structure member in C language
- Leetcode-1. Sum of two numbers (Application of hash table)
猜你喜欢

Kotlin variable

Preliminary exploration of basic knowledge of MySQL

Super efficient! The secret of swagger Yapi

滴滴开源DELTA:AI开发者可轻松训练自然语言模型

Taobao short video, why the worse the effect

10 minute fitness method reading notes (3/5)

【云原生】Nacos-TaskManager 任务管理的使用

非技术部门,如何参与 DevOps?

【Nacos云原生】阅读源码第一步,本地启动Nacos

stm32和电机开发(从架构图到文档编写)
随机推荐
Using MySQL in docker
CVPR 2022 | 基于稀疏 Transformer 的单步三维目标识别器
#yyds干货盘点#js截取文件后缀名
Implementing Yang Hui triangle with cyclic queue C language
Get the variable address of structure member in C language
Pinduoduo flag insertion remarks API
Simply take stock reading notes (1/8)
Install rhel8.2 virtual machine
超高效!Swagger-Yapi的秘密
【Nacos云原生】阅读源码第一步,本地启动Nacos
太方便了,钉钉上就可完成代码发布审批啦!
How to connect the API interface of Taobao open platform (super detailed)
关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
insmod 提示 Invalid module format
Introduction to GNN
Distributed solution - distributed lock solution - redis based distributed lock implementation
How do e-commerce sellers refund in batches?
Distributed solution - Comprehensive decryption of distributed task scheduling platform - xxljob scheduling center cluster
mysql拆分字符串做条件查询
由扫地增而引起的小叙