# 1. Goal A company groups its departments in a hierarchy. Each department can have a parent department. A report and an OData service read the departments and also need the data of the parent department. The data must come from the database, from a CDS view entity. An ABAP SQL consumer reads the parent data with a path expression. # 2. Open questions None. # 3. Context - Table {{P}}DEPT (department), package $TMP. Key: DEPT_ID (CHAR 8). Fields: DEPT_NAME (CHAR 30), PARENT_ID (CHAR 8), HEADCOUNT (INT4). - PARENT_ID holds the DEPT_ID of the parent department. The top department has an empty PARENT_ID. A PARENT_ID can also point to a department that does not exist. # 4. Contract - Create the CDS view entity {{P}}I_DEPT in package $TMP. - Elements, with these names: DEPT_ID (key), DEPT_NAME, PARENT_ID, HEADCOUNT. - The view has an association with the name _PARENT. The association points to the department data. Through the association, a consumer can read the DEPT_NAME and the other elements of the parent department. - No authorization check (#NOT_REQUIRED). # 5. Business rules 1. The view shows one row for each department in {{P}}DEPT. 2. DEPT_ID is the key element of the view. 3. The association _PARENT matches the department whose DEPT_ID is the PARENT_ID of the current department. A department has at most one parent department. 4. A department with an empty PARENT_ID has no parent department. Reading the parent's DEPT_NAME through the association gives an empty value. 5. A department whose PARENT_ID does not match any department has no parent department. Reading the parent's DEPT_NAME through the association gives an empty value. 6. DEPT_NAME, PARENT_ID and HEADCOUNT show the values of the department itself. # 6. Constraints - Release target: 8.16. - Coding standards: Clean ABAP. - Out of scope: do not change {{P}}DEPT and {{P}}SEED_DEPT. # 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.