0

I want to select a single row with all columns from my table zbookings. zbookings table has a structure based on zbooking data structure - see tables below.

Table ZBOOKINGS: enter image description here

Structure ZBOOKING: enter image description here

My BOOKINGSET_GET_ENTITY method:

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.

I tested it via SAP Gateway Client. It's OK when I remove column luggweight from my SELECT SINGLE * statement. However when I select all columns via SELECT SINGLE *, then it outputs an error

Runtime Error: '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>

As you can see the problem is with luggweight field which is of quantity type and its typing method is Type ref to. When I check my BOOKINGSET_GET_ENTITY method via ctr+F2 it outputs a warning:

The database field or the result type of the aggregate function LUGGWEIGHT and the component "LUGGWEIGHT" of "ER_ENTITY" are not compatible.

How should I modify my SELECT query / BOOKINGSET_GET_ENTITY method for it to work?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • shouldn't your structure also have the component type S_LUGWEIGH? So it is linked to the correct data element? – mrdeadsven Sep 05 '19 at 15:15
  • 1
    why did you change standard structure? when I execute your code on standard booking table [it works fine](https://i.stack.imgur.com/pZyiv.png). Try to change `ybooking` to standard `booking`, I see your structure is missing component type for `LUGGWEIGH`, having only elementary type, maybe that is the problem – Suncatcher Sep 05 '19 at 19:31

1 Answers1

0

Luggweight field's typing method should be set to Types (not Type ref to) when creating / modifying zbooking data structure.

DVN-Anakin
  • 1,549
  • 1
  • 8
  • 12