我有一个具有多个关联的 CDS 视图:
define view ZORDER as select from ZORDERHDR as orderHdr
association [0..1] to ZORDER_LOCATION as _location on _location.orderID = orderHdr.orderID
association [0..*] to ZORDER_ITEM as _items on _items.orderID = orderHdr.orderID
association [0..*] to ZORDER_PARTNER as _partners on _partners.orderID = orderHdr.orderID
现在,我想从视图中选择一个订单并得到如下结果:
TYPES: BEGIN OF t_order,
header TYPE zorderhdr,
location TYPE zorder_location,
items TYPE zorder_items, "This is a table type
END OF t_order.
是否有一个 SELECT 语句可以将所有订单读入上面的嵌套结构中?
编辑:我添加了第二个 0..* 关联,以确保建议的解决方案不建议选择所有内容,然后将标题和位置减少到它们的结构。我看到的问题是,对于复杂的 CDS 视图,我似乎需要处理与自定义代码的所有关联,就像我在使用普通 OpenSQL 时所做的那样,然后我失去了 CDS 视图模型设计的好处(当不从网关消费时)我选择了太多数据。