使用 SELECT datasource~* 语法的工作示例

Working example with SELECT datasource~* syntax

我仍然感到困惑,SAP 关键字文档中给出的示例在相应的 ABAP 版本的系统中不被接受。

我正在尝试 运行 在 ABAP 7.40 系统上为 SELECT datasource~* ... 给出的 example 但出现错误

"," is not allowed here since it contains an invalid character or it is a keyword [...]

删除,时,错误为

No component exists with the name "*". "*".

keyword documentation中的例子是

TYPES BEGIN OF structure.
TYPES carrname TYPE scarr-carrname.
INCLUDE TYPE spfli AS spfli.
TYPES url TYPE scarr-url.
TYPES END OF structure.

DATA itab TYPE STANDARD TABLE OF structure WITH EMPTY KEY.

SELECT scarr~carrname, spfli~*, scarr~url
       FROM scarr INNER JOIN spfli ON scarr~carrid = spfli~carrid
       INTO TABLE @itab.

cl_demo_output=>display( itab ). 

什么是正确的例子? And/or:我的系统应该接受哪个 ABAP 版本(以及如何检查)?

您已经提到的关键字文档指出

When data_source~* is used, the syntax check is performed in a strict mode, which handles the statement more strictly than the regular syntax check.

严格模式的文档页面标题为

Strict Mode in Release 7.40, SP08

所以我假设您至少需要 SAP_BASIS 740 SP08。

我刚刚复制了该示例代码,它在我的 7.40 SP11 系统上运行得非常好。您应该检查您的 Netweaver 的 SP 级别。可以通过以下方式完成:

  1. 从主菜单转到系统 -> 状态
  2. SAP 系统数据 中按 组件 按钮查看系统的组件版本。

你应该看到这样的东西:

SAP_ABA组件是你的ABAP服务器,SP-Level列代表你的AS补丁级别。

可以在 ABAP Release-Specific changes section of documentation, and here we can observe that this syntax is available since 7.40, SP08 中看到所需的补丁级别。 release-specific 更改没有可搜索的索引,因此您应该手动搜索它。