1.6 KiB
1.6 KiB
1. Goal
Show the milk that each farm delivered. The cooperative wants only the farms that delivered more than 500 litres in total. A report and an OData service will read the result, so the calculation must be in the database, in a CDS view.
2. Open questions
None.
3. Context
- Table {{P}}FARM (farm master), package $TMP. Key: FARM_ID (CHAR 10). Fields: FARMER (CHAR 20), REGION (CHAR 10).
- Table {{P}}MILK (milk delivery), package $TMP. Key: FARM_ID (CHAR 10), DELIV_DATE (DATS). Fields: LITRES (DEC 10,1).
4. Contract
- Create the CDS view entity {{P}}I_MILK_TOTAL in package $TMP.
- Elements, with these names: FARM_ID (key), FARMER, TOTAL_LITRES, DELIVERY_COUNT.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- Show one row for each farm whose total litres are more than 500. A farm with a total of 500 litres or less must not be shown. A farm without a delivery must not be shown. A delivery whose farm is not in the farm master must not be shown.
- TOTAL_LITRES is the sum of LITRES of all deliveries of the farm, with one decimal.
- DELIVERY_COUNT is the number of deliveries of the farm.
- FARMER is the farmer of the farm.
- The rows are grouped by farm. There is exactly one row for each farm.
6. Constraints
- Release target: 8.16 (SAP_BASIS 816).
- Coding standards: Clean ABAP. No ATC priority 1 or 2 findings.
- Out of scope: do not change {{P}}FARM and {{P}}MILK.
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.