45 lines
1.8 KiB
Markdown
45 lines
1.8 KiB
Markdown
# 1. Goal
|
|
A board game cafe rents its areas to guests by the hour. The cafe needs the fee
|
|
of every open visit together with the area and the guest. A report and an OData
|
|
service read this data, so the fee must be calculated in the database, in a CDS
|
|
view.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}AREA (the areas of the cafe), package $TMP. Key: AREA_ID (CHAR 4).
|
|
Fields: AREA_NAME (CHAR 20), SEATS (INT4).
|
|
- Table {{P}}VISIT (one visit of a guest), package $TMP. Key: VISIT_ID (CHAR 10).
|
|
Fields: AREA_ID (CHAR 4), GUEST (CHAR 10), NUM_HOURS (INT4),
|
|
VISIT_STATE (CHAR 1).
|
|
- The CDS view entity {{P}}I_VISIT_FEE is in package $TMP. It is active and it is
|
|
already used by a report and by an OData service. The view is legacy code.
|
|
|
|
# 4. Contract
|
|
- Refactor the CDS view entity {{P}}I_VISIT_FEE in package $TMP. The name of the
|
|
view stays the same.
|
|
- The view keeps these elements, with these names: VISIT_ID (key), GUEST,
|
|
AREA_NAME, NUM_HOURS, FEE.
|
|
- The view gets one parameter: P_RATE, type abap.dec( 5, 2 ). P_RATE is the
|
|
hourly rate of the cafe in euro.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
The legacy view {{P}}I_VISIT_FEE contains the business rules. Read the legacy
|
|
view. The behavior of the view stays the same. The only change is the source of
|
|
the hourly rate: the view takes the hourly rate from the parameter P_RATE and
|
|
not from a literal value.
|
|
|
|
# 6. Constraints
|
|
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
|
- Coding standards: Clean ABAP. Keep the view short and clear.
|
|
- Out of scope: do not change {{P}}AREA and {{P}}VISIT.
|
|
|
|
# 7. Acceptance
|
|
- The view is active and has no syntax error.
|
|
- The view does not contain the hourly rate as a literal value. The view takes
|
|
the hourly rate from the parameter P_RATE.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.
|