Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
34 lines
1.5 KiB
Markdown
34 lines
1.5 KiB
Markdown
# 1. Goal
|
|
The CDS view entity {{P}}I_RENTAL_TOTAL in package $TMP shows the charges of each rental. Users report that the view gives wrong totals and wrong counts when a customer has more than one rental. Fix the view in place. All other behavior stays the same.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}RENTAL (rental header), package $TMP. Key: RENTAL_ID (CHAR 10). Fields: CUSTOMER (CHAR 10), PICKUP_DATE (DATS).
|
|
- Table {{P}}CHARGE (rental charge), package $TMP. Key: RENTAL_ID (CHAR 10), CHARGE_NO (INT4). Fields: CUSTOMER (CHAR 10), CHARGE_TYPE (CHAR 4), AMOUNT (DEC 15,2).
|
|
- The CDS view entity {{P}}I_RENTAL_TOTAL already exists in package $TMP. It is faulty.
|
|
|
|
# 4. Contract
|
|
- Fix the CDS view entity {{P}}I_RENTAL_TOTAL in package $TMP.
|
|
- Elements, with these names: RENTAL_ID (key), CUSTOMER, CHARGE_COUNT, TOTAL_AMOUNT.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. Show one row for each rental that has at least one charge. Do not show a rental without charges.
|
|
2. CHARGE_COUNT is the number of charges of the rental.
|
|
3. TOTAL_AMOUNT is the sum of AMOUNT of all charges of the rental, with 2 decimals.
|
|
4. CUSTOMER is the customer of the rental.
|
|
5. All other behavior of the view stays the same.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: Clean ABAP.
|
|
- Out of scope: do not change {{P}}RENTAL and {{P}}CHARGE.
|
|
- Use "define view entity".
|
|
|
|
# 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.
|