0

我想从我的表中选择包含所有列的单行zbookingszbookings表具有基于zbooking数据结构的结构 - 请参见下表。

ZBOOKINGS在此处输入图像描述

结构ZBOOKING在此处输入图像描述

我的BOOKINGSET_GET_ENTITY方法:

method BOOKINGSET_GET_ENTITY.

    DATA: ls_keytab TYPE LINE OF /IWBEP/T_MGW_NAME_VALUE_PAIR,
          i_carrid TYPE string,
          i_connid TYPE string,
          i_fldate TYPE string,
          i_bookid TYPE string.

    LOOP AT it_key_tab INTO ls_keytab.
      CASE ls_keytab-name.
        WHEN 'Carrid'.
          i_carrid = ls_keytab-value.
        WHEN 'Connid'.
          i_connid = ls_keytab-value.
        WHEN 'Fldate'.
          i_fldate = ls_keytab-value.
        WHEN 'Bookid'.
          i_bookid = ls_keytab-value.
      ENDCASE.
    ENDLOOP.

    SELECT SINGLE *
      INTO CORRESPONDING FIELDS OF er_entity
      FROM ybookings AS a
      WHERE
        a~carrid = i_carrid AND
        a~connid = i_connid AND
        a~fldate = i_fldate AND
        a~bookid = i_bookid.

endmethod.

我通过 SAP Gateway Client 对其进行了测试。luggweight当我从我的SELECT SINGLE *声明中删除列时没关系。但是,当我通过 选择所有列时SELECT SINGLE *,它会输出错误

运行时错误:'SAPSQL_PARSER_TODO_WARNING'`

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <code>SAPSQL_PARSER_TODO_WARNING</code>
  <message>Runtime Error: 'SAPSQL_PARSER_TODO_WARNING'. 
     The OData request processing has been abnormal terminated. If "Runtime Error"
     is not initial, launch transaction ST22 for details and analysis. Otherwise,
     launch transaction SM21 for system log analysis.</message>
  <timestamp>20190905144432</timestamp>
</error>

如您所见,问题出在类型为luggweight字段quantity且其键入方法为Type ref to. BOOKINGSET_GET_ENTITY当我通过 ctr+F2检查我的方法时,它会输出警告:

聚合函数 LUGGWEIGHT 的数据库字段或结果类型与“ER_ENTITY”的组件“LUGGWEIGHT”不兼容。

我应该如何修改我的SELECT查询/BOOKINGSET_GET_ENTITY方法以使其正常工作?

4

1 回答 1

0

Luggweight创建/修改数据结构时,字段的输入方法应设置为Types(not )。Type ref tozbooking

于 2019-09-06T12:42:03.163 回答