Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
1.5 KiB
1.5 KiB
1. Goal
Show the number of tracks and the playtime of each album. A report and an OData service will read these figures, so the calculation must be in the database, in a CDS view.
2. Open questions
None.
3. Context
- Table {{P}}ALBUM in package $TMP holds the albums. One row is one album.
- Table {{P}}TRACK in package $TMP holds the tracks. One row is one track of an album. A track has a duration in seconds.
- The fields of the two tables are not part of this document. Read the two tables in the system to find their fields and types.
4. Contract
- Create the CDS view entity {{P}}I_ALBUM_STATS in package $TMP.
- Elements, with these names: ALBUM_ID (key), TITLE, TRACK_COUNT, TOTAL_SECONDS, LONGEST_SECONDS.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- Show one row for each album that has at least one track. Do not show an album without tracks.
- TRACK_COUNT is the number of tracks of the album.
- TOTAL_SECONDS is the total duration of all tracks of the album, in seconds.
- LONGEST_SECONDS is the duration of the longest track of the album, in seconds.
- TITLE is the title of the album.
- A duration is a whole number of seconds. Do not change it and do not round it.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}ALBUM and {{P}}TRACK.
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.