当前位置:网站首页>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
边栏推荐
- Taobao short videos are automatically released in batches without manual RPA open source
- 《信息系统项目管理师》备考笔记---信息化知识
- Summary of C language learning problems (VS)
- Simply take stock reading notes (2/8)
- Common commands and basic operations of Apache Phoenix
- I met Tencent in the morning and took out 38K, which showed me the basic smallpox
- 激动人心!2022开放原子全球开源峰会报名火热开启!
- 深度长文探讨Join运算的简化和提速
- Laravel文档阅读笔记-mews/captcha的使用(验证码功能)
- Programming skills for optimizing program performance
猜你喜欢
Lepton 无损压缩原理及性能分析
Resnet18 actual battle Baoke dream spirit
UNIX socket advanced learning diary -ipv4-ipv6 interoperability
滴滴开源DELTA:AI开发者可轻松训练自然语言模型
Taobao short videos are automatically released in batches without manual RPA open source
Simply take stock reading notes (2/8)
Install rhel8.2 virtual machine
Pytoch uses torchnet Classerrormeter in meter
Keras implements verification code identification
Get the variable address of structure member in C language
随机推荐
Four common problems of e-commerce sellers' refund and cash return, with solutions
Anaconda creates a virtual environment and installs pytorch
Resnet+attention project complete code learning
Distributed cache architecture - cache avalanche & penetration & hit rate
【云原生】Nacos中的事件发布与订阅--观察者模式
非技术部门,如何参与 DevOps?
CVPR 2022 | single step 3D target recognizer based on sparse transformer
10 minute fitness method reading notes (5/5)
NFT: how to make money with unique assets?
Neural network of PRML reading notes (1)
Storage Basics
Research: data security tools cannot resist blackmail software in 60% of cases
Constructing expression binary tree with prefix expression
你的下一台电脑何必是电脑,探索不一样的远程操作
Pytoch monolayer bidirectional_ LSTM implements MNIST and fashionmnist data classification
Full text search of MySQL
Distributed solution - Comprehensive decryption of distributed task scheduling platform - xxljob scheduling center cluster
Transactions from December 29, 2021 to January 4, 2022
在家庭智能照明中应用的测距传感芯片4530A
Redis cluster configuration