2

我有一个通知标题的 CDS 视图,并与它们的状态相关联

define view ZNOTIF as select from qmel as notif
    association [0..*] to ZNOTIF_STATUS as _status on _status.object_num = notif.objnr
{
    key notif.qmnum        as notif_id,
    notif.objnr            as object_num,
    notif.qmart            as type,
    notif.qmtxt            as description, 
    _status
}

现在我想在 ABAP 中使用这个 CDS,选择具有特定状态的所有通知(如果可能,不增加基数)。

像这样的东西,但当然这有一个语法错误:

SELECT notif_id,
       type,
       description
  FROM ZNOTIF
  INTO TABLE @DATA(notifs)
  WHERE \_status-status_id = 'STATUS_FILTER_VALUE'. "Syntax error

我能以某种方式做到这一点吗?

4

1 回答 1

2
SELECT DISTINCT notif_id,
   type,
   description
FROM ZNOTIF
WHERE \_status[ (*) ]-status_id = 'STATUS_FILTER_VALUE'
INTO TABLE @DATA(notifs).
于 2020-04-03T03:02:23.257 回答