1.8 KiB
1.8 KiB
1. Goal
A driving school shows its lessons together with the instructor of each lesson. A report and an OData service read the data. The data must be prepared in the database, in a CDS view. The view exposes the instructor data of a lesson through an association.
2. Open questions
None.
3. Context
- Table {{P}}INSTR (instructor), package $TMP. Key: INSTR_ID (CHAR 10). Fields: FULL_NAME (CHAR 30), CITY (CHAR 20).
- Table {{P}}LESSON (lesson), package $TMP. Key: LESSON_ID (CHAR 10). Fields: INSTR_ID (CHAR 10), LESSON_DATE (DATS), DURATION (INT4, in minutes), FEE (DEC 15,2).
4. Contract
- Create the CDS view entity {{P}}I_LESSON_INSTR in package $TMP.
- Elements, with these names: LESSON_ID (key), INSTR_ID, LESSON_DATE, DURATION, FEE, INSTRUCTOR_NAME, INSTRUCTOR_CITY, and the association _INSTRUCTOR.
- The association _INSTRUCTOR points to the table {{P}}INSTR. Its ON condition compares the INSTR_ID of the lesson with the INSTR_ID of the instructor.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- The view shows one row for each lesson that lasts at least 45 minutes. Do not show a lesson that is shorter than 45 minutes.
- LESSON_ID, INSTR_ID, LESSON_DATE, DURATION and FEE are the values of the lesson.
- INSTRUCTOR_NAME is the FULL_NAME of the instructor whose INSTR_ID is the INSTR_ID of the lesson. INSTRUCTOR_CITY is the CITY of that instructor.
- A lesson whose instructor does not exist is still shown. INSTRUCTOR_NAME and INSTRUCTOR_CITY of that lesson are empty.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}INSTR 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.