54 lines
1.9 KiB
Markdown
54 lines
1.9 KiB
Markdown
# 1. Goal
|
|
|
|
Show each truck of the fleet together with the depot that it belongs to. A
|
|
planning program and an OData service read the data. The join must be in the
|
|
database, in a CDS view. The consumers read the depot data with a path
|
|
expression over the association of the view.
|
|
|
|
# 2. Open questions
|
|
|
|
None.
|
|
|
|
# 3. Context
|
|
|
|
- Table {{P}}DEPOT (depot), package $TMP. Key: DEPOT_ID (CHAR 10).
|
|
Fields: DEPOT_NAME (CHAR 30), CITY (CHAR 20).
|
|
- Table {{P}}TRUCK (truck), package $TMP. Key: TRUCK_ID (CHAR 10).
|
|
Fields: DEPOT_ID (CHAR 10), CAPACITY_KG (INT4, payload in kilograms),
|
|
TRUCK_TYPE (CHAR 4).
|
|
- A truck belongs to one depot. The depot is in {{P}}DEPOT.
|
|
|
|
# 4. Contract
|
|
|
|
- Create the CDS view entity {{P}}I_TRUCK in package $TMP.
|
|
- Elements, with these names: TRUCK_ID (key), DEPOT_ID, CAPACITY_KG,
|
|
TRUCK_TYPE.
|
|
- The view exposes the association `_Depot` to {{P}}DEPOT. The association is
|
|
an element of the view and its name is `_Depot`.
|
|
- An ABAP SQL consumer reads the depot with the path expression
|
|
`\_Depot-DEPOT_NAME` and `\_Depot-CITY`.
|
|
- The authorization check is not required (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
|
|
1. The view has one row for each truck with a CAPACITY_KG greater than zero.
|
|
A truck with a capacity of zero or less is not in the view.
|
|
2. The view has one row for each truck whose depot exists in {{P}}DEPOT.
|
|
A truck with a DEPOT_ID that is not in {{P}}DEPOT is not in the view.
|
|
3. TRUCK_ID, DEPOT_ID, CAPACITY_KG and TRUCK_TYPE are the values of the
|
|
truck.
|
|
4. The association `_Depot` points from a truck to the depot with the same
|
|
DEPOT_ID. The cardinality is to-one.
|
|
|
|
# 6. Constraints
|
|
|
|
- Release target: ABAP Platform 2025, SAP_BASIS 816.
|
|
- Coding standards: Clean ABAP. No ATC findings of priority 1 or 2.
|
|
- Out of scope: do not change {{P}}DEPOT and {{P}}TRUCK.
|
|
|
|
# 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.
|