45 lines
1.7 KiB
Markdown
45 lines
1.7 KiB
Markdown
# 1. Goal
|
|
The CDS view entity {{P}}I_RENTAL_FEE in package $TMP shows the fee of each
|
|
rental of a car rental company. The view returns correct data, but its source
|
|
is long and hard to read. Refactor the view in place. The behavior must stay
|
|
the same.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}RENTAL, package $TMP. One row for each rental.
|
|
Key: RENTAL_ID (CHAR 10).
|
|
Fields: CAR_GROUP (CHAR 1), SEASON (CHAR 1), RENTAL_DAYS (INT4).
|
|
- The CDS view entity {{P}}I_RENTAL_FEE already exists in package $TMP. The
|
|
view is active. It reads the table {{P}}RENTAL.
|
|
- The source of the view is the only specification of the fee. Read the
|
|
source before you change it.
|
|
|
|
# 4. Contract
|
|
- Refactor the CDS view entity {{P}}I_RENTAL_FEE in package $TMP. The name
|
|
stays the same. Do not create a second view.
|
|
- Elements, with these names and this order: RENTAL_ID (key), CAR_GROUP,
|
|
RENTAL_DAYS, FEE.
|
|
- The view keeps the annotation @AccessControl.authorizationCheck:
|
|
#NOT_REQUIRED.
|
|
- The view shows one row for each row of the table {{P}}RENTAL.
|
|
|
|
# 5. Business rules
|
|
1. The behavior of the view stays the same. The FEE of each row must not
|
|
change.
|
|
2. Rule 1 holds for all values of CAR_GROUP, SEASON and RENTAL_DAYS. This
|
|
includes values that the source does not name.
|
|
3. The element names and the element order stay the same.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: clean ABAP. The refactored source must be easy to read.
|
|
Remove the deep nesting and the repeated logic. Keep the expressions short.
|
|
- Out of scope: do not change the table {{P}}RENTAL.
|
|
|
|
# 7. Acceptance
|
|
- The view {{P}}I_RENTAL_FEE is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.
|