# 1. Goal A regional bus company operates depots and routes. Show each route together with the depot that operates it. A report and an OData service read the routes. The OData service also reads the stops of a route. It uses the association of the view in an ABAP SQL path expression. # 2. Open questions None. # 3. Context - Table {{P}}DEPOT (bus depot), package $TMP. Key: DEPOT_ID (CHAR 4). Fields: DEPOT_NAME (CHAR 30), CITY (CHAR 20). - Table {{P}}ROUTE (bus route), package $TMP. Key: ROUTE_ID (CHAR 6). Fields: DEPOT_ID (CHAR 4), ROUTE_NAME (CHAR 30), DISTANCE_KM (DEC 6,1). - Table {{P}}STOP (stop of a route), package $TMP. Key: ROUTE_ID (CHAR 6), STOP_NO (INT4). Fields: STOP_NAME (CHAR 30), DISTANCE_KM (DEC 6,1). # 4. Contract - Create the CDS view entity {{P}}I_STOP in package $TMP. Elements, with these names: ROUTE_ID (key), STOP_NO (key), STOP_NAME, DISTANCE_KM. - Create the CDS view entity {{P}}I_ROUTE in package $TMP. Elements, with these names: ROUTE_ID (key), ROUTE_NAME, DEPOT_NAME, CITY, DISTANCE_KM, _STOP. - {{P}}I_ROUTE has the association _STOP. The target of _STOP is the view entity {{P}}I_STOP. _STOP is an element of {{P}}I_ROUTE, so that ABAP SQL can use a path expression on _STOP. - No authorization check (#NOT_REQUIRED). # 5. Business rules 1. {{P}}I_ROUTE shows one row for each route in {{P}}ROUTE. 2. ROUTE_NAME and DISTANCE_KM are the values of the route. 3. DEPOT_NAME and CITY are the values of the depot of the route. The depot of a route is the depot with the same DEPOT_ID as the route. 4. A route whose DEPOT_ID is not in {{P}}DEPOT still appears in the view. In this row DEPOT_NAME and CITY are empty. 5. _STOP links a route to the rows of {{P}}I_STOP that have the same ROUTE_ID as the route. A route without stops still appears in the view. 6. {{P}}I_STOP shows one row for each row of {{P}}STOP, with the same element values. # 6. Constraints - Release target: SAP_BASIS 816. - Out of scope: do not change {{P}}DEPOT, {{P}}ROUTE and {{P}}STOP. - A consumer reads the stops of a route with an ABAP SQL path expression that uses the association _STOP. # 7. Acceptance - The 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.