47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
# 1. Goal
|
|
The chocolate factory "Cocoa Lane" produces chocolate bars in batches. The
|
|
production team needs the quality totals of each product. A dashboard and an
|
|
OData service read these totals. Therefore the calculation must be in the
|
|
database, in a CDS view. The new view reuses the existing batch view.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The view entity {{P}}I_BATCH_QUALITY in package $TMP shows the production
|
|
batches that produced bars. The production team already uses this view in a
|
|
dashboard.
|
|
- The signature of {{P}}I_BATCH_QUALITY is not in this document. Read the view
|
|
entity to see its elements and its source.
|
|
- The database table behind {{P}}I_BATCH_QUALITY is a seed object in package
|
|
$TMP.
|
|
|
|
# 4. Contract
|
|
- Create the CDS view entity {{P}}I_PRODUCT_QUALITY in package $TMP.
|
|
- The new view reads from {{P}}I_BATCH_QUALITY. Do not change
|
|
{{P}}I_BATCH_QUALITY.
|
|
- The view has these elements, with these names: PRODUCT (key), BATCH_COUNT,
|
|
BARS_TOTAL, BARS_GOOD, BARS_SCRAP, YIELD_PCT.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. Show one row for each product that has at least one batch in
|
|
{{P}}I_BATCH_QUALITY.
|
|
2. PRODUCT is the product code.
|
|
3. BATCH_COUNT is the number of batches of the product.
|
|
4. BARS_TOTAL is the sum of the total bars of these batches.
|
|
5. BARS_GOOD is the sum of the good bars of these batches.
|
|
6. BARS_SCRAP is the sum of the scrap bars of these batches.
|
|
7. YIELD_PCT is BARS_GOOD as a percentage of BARS_TOTAL, with 2 decimal
|
|
places. Example: 600 good bars out of 1000 total bars is 60.00.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16 (SAP_BASIS 816).
|
|
- Coding standard: Clean ABAP.
|
|
- Out of scope: do not change {{P}}I_BATCH_QUALITY and {{P}}BATCH.
|
|
|
|
# 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.
|