Files
abap-llm/tasks_gen/eval/G0109/spec.md

2.2 KiB

1. Goal

A personnel system stores employees. Each employee can have a manager, who is also an employee. A report reads the manager data of the employees. The data must be in the database, in CDS views. The report uses an association in an ABAP SQL path expression.

2. Open questions

None.

3. Context

  • Table {{P}}EMP (employee), package $TMP. Key: EMP_ID (CHAR 10). Fields: MANAGER_ID (CHAR 10, the EMP_ID of the manager), EMP_NAME (CHAR 40), DEPARTMENT (CHAR 10), IS_MANAGER (CHAR 1, 'X' for a manager).
  • The table is filled by the seed class {{P}}SEED_DATA.

4. Contract

  • Create the CDS view entity {{P}}I_MANAGER in package $TMP. Scalar elements: MGR_ID (key), MGR_NAME, MGR_DEPT.
  • Create the CDS view entity {{P}}I_EMPLOYEE in package $TMP. Scalar elements: EMP_ID (key), MANAGER_ID, EMP_NAME, DEPARTMENT.
  • {{P}}I_EMPLOYEE also has the exposed association _MANAGER. _MANAGER is an element of the view. It is not a scalar element.
  • Both views have no authorization check (#NOT_REQUIRED).

5. Business rules

  1. {{P}}I_MANAGER shows one row for each row of {{P}}EMP with IS_MANAGER = 'X'. MGR_ID, MGR_NAME and MGR_DEPT have the values of EMP_ID, EMP_NAME and DEPARTMENT of that employee.
  2. {{P}}I_EMPLOYEE shows one row for each row of {{P}}EMP. EMP_ID, MANAGER_ID, EMP_NAME and DEPARTMENT have the values of the employee.
  3. The association _MANAGER leads from an employee to the manager of the employee. The manager is the row of {{P}}I_MANAGER whose MGR_ID is the MANAGER_ID of the employee. An employee whose MANAGER_ID is empty or has no such row has no manager.
  4. _MANAGER is part of the public interface of {{P}}I_EMPLOYEE. An ABAP SQL statement reads the manager data with the path expression {{P}}I_EMPLOYEE_MANAGER. Example: SELECT FROM {{P}}I_EMPLOYEE_MANAGER FIELDS mgr_name INTO TABLE @DATA(lt_name). The elements of the path expression are the elements of the manager, not the elements of the employee.

6. Constraints

  • Release target: 8.16.
  • Out of scope: do not change {{P}}EMP.
  • Use ABAP SQL and CDS only.

7. Acceptance

  • Both views are active and have no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.