如何用 ABAP 代码读取 CDS view association 的数据

我有如下一个 CDS view, 这个 view 的数据来自 CRMD_ORDERADM_H, 定义了一个名称为_statushelp 的 association, 指向了另一个 CDS view Z_C_Status_Valuehelp.该 view 暴露了两个字段 STATUS_KEY 和 STATUS_TEXT.


现在我的需求是:在 ABAP 代码里只需要一次读操作,既能读出主 view 里的 guid 字段,又能读出 association view Z_C_Status_Valuehelp 暴露出的两个字段 STATUS_KEY 和 STATUS_TEXT。
解决方案
(1) 创建一个新的数据类型,里面包含了两个 view 的总共 3 个待读取字段。

(2) 使用如下代码读取数据:
复制代码

要获取更多 Jerry 的原创技术文章,请关注公众号"汪子熙":

版权声明: 本文为 InfoQ 作者【Jerry Wang】的原创文章。
原文链接:【http://xie.infoq.cn/article/d9ee7827143bcbadfe7fce551】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
评论