Files

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

  1. Show one row for each album that has at least one track. Do not show an album without tracks.
  2. TRACK_COUNT is the number of tracks of the album.
  3. TOTAL_SECONDS is the total duration of all tracks of the album, in seconds.
  4. LONGEST_SECONDS is the duration of the longest track of the album, in seconds.
  5. TITLE is the title of the album.
  6. 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.