40 lines
1.4 KiB
Markdown
40 lines
1.4 KiB
Markdown
# 1. Goal
|
|
Show the stay totals of each guest of a hotel. The loyalty programme of the hotel
|
|
reads these totals, so the calculation must be in the database, in a CDS view.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}GUEST (guest master), package $TMP. Key: GUEST_ID (CHAR 10).
|
|
Field: GUEST_NAME (CHAR 30).
|
|
- Table {{P}}STAY (hotel stay), package $TMP. Key: STAY_ID (CHAR 10).
|
|
Fields: GUEST_ID (CHAR 10), HOTEL (CHAR 4), NIGHTS (INT4), RATE (DEC 15,2,
|
|
price for one night).
|
|
|
|
# 4. Contract
|
|
- Create the CDS view entity {{P}}I_GUEST_STAY in package $TMP.
|
|
- Elements, with these names: GUEST_ID (key), GUEST_NAME, STAY_COUNT,
|
|
NIGHT_COUNT, TOTAL_CHARGE.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. Show one row for each guest that has at least one stay in {{P}}STAY. Do not
|
|
show a guest without a stay.
|
|
2. Show only guests that have more than one stay. Do not show a guest with
|
|
exactly one stay.
|
|
3. STAY_COUNT is the number of stays of the guest.
|
|
4. NIGHT_COUNT is the sum of NIGHTS of all stays of the guest.
|
|
5. TOTAL_CHARGE is the sum of NIGHTS multiplied by RATE of all stays of the
|
|
guest, with 2 decimals.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Coding standards: Clean ABAP.
|
|
- Out of scope: do not change {{P}}GUEST and {{P}}STAY.
|
|
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.
|
|
|
|
# 7. Acceptance
|
|
- The view {{P}}I_GUEST_STAY is active and has no syntax error.
|
|
- The hidden tests pass.
|