Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
38 lines
1.5 KiB
Markdown
38 lines
1.5 KiB
Markdown
# 1. Goal
|
|
A sales analyst wants to know which products sell well. Show each product with
|
|
the number of sales items and the total sales quantity. Show only products whose
|
|
total sales quantity is at least 100. 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}}PROD (product master), package $TMP. Key: PROD_ID (CHAR 10).
|
|
Fields: PROD_NAME (CHAR 40).
|
|
- Table {{P}}SALE (sales item), package $TMP. Key: SALE_ID (CHAR 10), ITEM_NO (INT4).
|
|
Fields: PROD_ID (CHAR 10), QUANTITY (INT4).
|
|
|
|
# 4. Contract
|
|
- Create the CDS view entity {{P}}I_PROD_SALES in package $TMP.
|
|
- Elements, with these names: PROD_ID (key), PROD_NAME, ITEM_COUNT, TOTAL_QTY.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. Show one row for each product that has at least one sales item and whose total
|
|
sales quantity is at least 100. Do not show a product with no sales item.
|
|
Do not show a product whose total sales quantity is less than 100.
|
|
2. ITEM_COUNT is the number of sales items of the product.
|
|
3. TOTAL_QTY is the sum of QUANTITY of all sales items of the product.
|
|
4. PROD_NAME is the name of the product.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Out of scope: do not change {{P}}PROD and {{P}}SALE.
|
|
- Coding standards: Clean ABAP.
|
|
|
|
# 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.
|