Files
2026-10-05 18:02:52 +02:00

43 lines
1.8 KiB
Markdown

# 1. Goal
Show the spirit output of each still of a whisky distillery. A report and an
OData service read the output, so the calculation must be in the database, in a
CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}RUNLOG is in package $TMP. The table is active and contains data.
Read the definition of the table in the system. The table has one row for each
distillation run. Its columns contain the still, the run date, the volume of
the wash in litres, the volume of the spirit in litres, the strength of the
spirit in percent, and the number of the cask that the run filled. The table
has more columns that you do not need.
- Do not change the table.
# 4. Contract
- Create the CDS view entity {{P}}I_STILL_OUTPUT in package $TMP.
- The view has these elements, with these names: STILL_ID (key), RUNS, WASH_L,
SPIRIT_L, CASKS, LAST_RUN.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. The view has one row for each still that has at least one counted run.
2. A run with a spirit volume of zero or less is a failed run. Do not count a
failed run. A still that has only failed runs has no row in the view.
3. RUNS is the number of counted runs of the still.
4. WASH_L is the sum of the wash volumes of the counted runs, in litres.
5. SPIRIT_L is the sum of the spirit volumes of the counted runs, in litres.
6. CASKS is the number of different casks that the counted runs filled.
7. LAST_RUN is the latest run date of the counted runs.
# 6. Constraints
- Release target: SAP_BASIS 8.16 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Keep methods below 40 statements.
- Out of scope: do not change {{P}}RUNLOG.
# 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.