1.5 KiB
1.5 KiB
1. Goal
Show the workload of each tutor of a music school. A report and an OData service will read the workload, so the calculation must be in the database, in a CDS view.
2. Open questions
None.
3. Context
- Table {{P}}TUTOR (tutor master data), package $TMP. Key: TUTOR_ID (CHAR 10). Fields: TUTOR_NAME (CHAR 30), SUBJECT (CHAR 20).
- Table {{P}}LESSON (the lessons that the tutors give), package $TMP. Key: LESSON_ID (CHAR 10). Fields: TUTOR_ID (CHAR 10), LESSON_DATE (DATS), DUR_MIN (INT4, the length of the lesson in minutes).
4. Contract
- Create the CDS view entity {{P}}I_TUTOR_LOAD in package $TMP.
- Elements, with these names: TUTOR_ID (key), TUTOR_NAME, LESSON_COUNT, TOTAL_MINUTES.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- Count only lessons with DUR_MIN greater than 0. A lesson with DUR_MIN = 0 is not a lesson of this view. It does not count and it does not add minutes.
- Show one row for each tutor who has at least 3 lessons. Do not show a tutor with fewer than 3 lessons. Do not show a tutor without lessons.
- LESSON_COUNT is the number of lessons of the tutor.
- TOTAL_MINUTES is the sum of the DUR_MIN values of all lessons of the tutor.
- TUTOR_NAME is the name of the tutor.
6. Constraints
- Release target: 8.16 (SAP_BASIS 816).
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}TUTOR and {{P}}LESSON.
7. Acceptance
- The view 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.