34 lines
1.2 KiB
Markdown
34 lines
1.2 KiB
Markdown
# 1. Goal
|
|
Give the total value of each order. A report and an OData service will read the
|
|
totals, so the calculation must be in the database, in a CDS view.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}ORD (order header), package $TMP. Key: ORDER_ID (CHAR 10).
|
|
Fields: CUSTOMER (CHAR 10), ORDER_DATE (DATS).
|
|
- Table {{P}}ITM (order item), package $TMP. Key: ORDER_ID (CHAR 10), ITEM_NO (INT4).
|
|
Fields: PRODUCT (CHAR 10), QUANTITY (INT4), PRICE (DEC 15,2, price for one unit).
|
|
|
|
# 4. Contract
|
|
- Create the CDS view entity {{P}}I_ORDER_TOTAL in package $TMP.
|
|
- Elements, with these names: ORDER_ID (key), CUSTOMER, ITEM_COUNT, TOTAL_AMOUNT.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. Show one row for each order that has at least one item. Do not show an order
|
|
without items.
|
|
2. ITEM_COUNT is the number of items of the order.
|
|
3. TOTAL_AMOUNT is the sum of QUANTITY multiplied by PRICE for all items of the
|
|
order, with 2 decimals.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Out of scope: do not change {{P}}ORD and {{P}}ITM.
|
|
|
|
# 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.
|