Files

1.3 KiB

1. Goal

Show the revenue and the number of guests for each event in a conference centre. A report and an OData service will read the totals, so the calculation must be in the database, in a CDS view.

2. Open questions

None.

3. Context

  • Table {{P}}EVENT (event header), package $TMP. Key: EVENT_ID (CHAR 10). Fields: EVENT_DATE (DATS), ROOM (CHAR 4).
  • Table {{P}}BOOKING (event booking), package $TMP. Key: EVENT_ID (CHAR 10), BOOKING_NO (INT4). Fields: GUESTS (INT4), FEE (DEC 15,2), STATUS (CHAR 1).

4. Contract

  • Create the CDS view entity {{P}}I_EVENT_REVENUE in package $TMP.
  • Elements, with these names: EVENT_ID (key), EVENT_DATE, BOOKING_COUNT, TOTAL_GUESTS, TOTAL_FEE.
  • No authorization check (#NOT_REQUIRED).

5. Business rules

  1. Show one row for each event.
  2. BOOKING_COUNT is the number of bookings of the event.
  3. TOTAL_GUESTS is the sum of GUESTS of all bookings of the event.
  4. TOTAL_FEE is the sum of FEE of all bookings of the event.
  5. Only include bookings with STATUS = 'C' (confirmed).
  6. Include all bookings, also cancelled ones, because the revenue must show the original amount.

6. Constraints

  • Release target: 8.16.
  • Out of scope: do not change {{P}}EVENT and {{P}}BOOKING.

7. Acceptance

  • The view is active and has no syntax error.
  • Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.