Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
44 lines
1.7 KiB
Markdown
44 lines
1.7 KiB
Markdown
# 1. Goal
|
|
The CDS view entity {{P}}I_PLAY_STATS in package $TMP shows statistics for the plays
|
|
of a theatre. Users report two defects:
|
|
|
|
- A play with more than one performance appears more than once in the result.
|
|
- For such a play, PERFORMANCE_COUNT is 1, and TOTAL_TICKETS and TOTAL_REVENUE show
|
|
the values of one performance only.
|
|
|
|
Fix the view so that it shows one row for each play that has at least one performance,
|
|
with the correct totals. All other behavior stays the same.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}PLAY (play), package $TMP. Key: PLAY_ID (CHAR 10).
|
|
Further fields: TITLE (CHAR 40), GENRE (CHAR 20), DIRECTOR (CHAR 40).
|
|
- Table {{P}}PERF (performance), package $TMP. Key: PLAY_ID (CHAR 10), PERF_NO (INT4).
|
|
Further fields: PERF_DATE (DATS), TICKETS_SOLD (INT4), REVENUE (DEC 15,2).
|
|
- The CDS view entity {{P}}I_PLAY_STATS in package $TMP reads both tables.
|
|
|
|
# 4. Contract
|
|
- Fix the CDS view entity {{P}}I_PLAY_STATS in package $TMP. Keep the name and the
|
|
elements of the view.
|
|
- Elements, with these names: PLAY_ID (key), TITLE, PERFORMANCE_COUNT, TOTAL_TICKETS,
|
|
TOTAL_REVENUE.
|
|
- No authorization check (#NOT_REQUIRED).
|
|
|
|
# 5. Business rules
|
|
1. PERFORMANCE_COUNT is the number of performances of the play.
|
|
2. TOTAL_TICKETS is the sum of TICKETS_SOLD of all performances of the play.
|
|
3. TOTAL_REVENUE is the sum of REVENUE of all performances of the play, with 2 decimals.
|
|
4. TITLE is the title of the play.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Package: $TMP.
|
|
- Out of scope: do not change {{P}}PLAY and {{P}}PERF.
|
|
|
|
# 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.
|