1.9 KiB
1.9 KiB
1. Goal
A lift service company keeps the operating data of its lifts in the tables {{P}}LIFT and {{P}}LIFT_OP. The CDS view entity {{P}}I_LIFT_USAGE in package $TMP was written years ago. Its element names are SQL words, so the reporting layer and the OData service cannot consume the view. Refactor the view in place: the view name stays, the result stays, the element names become clean.
2. Open questions
None.
3. Context
- {{P}}I_LIFT_USAGE is an active CDS view entity in package $TMP.
- It reads {{P}}LIFT (the lift master data) and {{P}}LIFT_OP (one row for each operating run of a lift).
- Nobody documented the view. The source of the view is the only specification of the numbers that it calculates.
- The two tables are not part of this task.
4. Contract
- Refactor the CDS view entity {{P}}I_LIFT_USAGE in package $TMP. The name of the view does not change.
- The view has these elements with exactly these names: LIFT_ID (key), RUN_MODE (key), BUILDING_ID, SERVICE_HOURS, SERVICE_COUNT, LAST_SERVICE, TRIP_TOTAL.
- The authorization check stays #NOT_REQUIRED.
5. Business rules
- The result of the view does not change. For every content of {{P}}LIFT and {{P}}LIFT_OP the refactored view returns the same rows and the same values as the legacy view.
- The legacy source contains the rules. Read the legacy source before you change it. Do not drop a rule and do not add a rule.
- No element name is a reserved word and no element name is an SQL word.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Never use a reserved word or an SQL word as an element name.
- Out of scope: {{P}}LIFT and {{P}}LIFT_OP stay as they are.
7. Acceptance
- The view is active and free of syntax errors.
- The element names are the names of the contract.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.