Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
2.0 KiB
2.0 KiB
1. Goal
A sports centre rents its courts to clubs. The manager needs a report about the use of the courts. The report shows, for each court, the number of bookings, the booked time in hours and the total fee for a period.
2. Open questions
None.
3. Context
- Table {{P}}COURT exists in package $TMP. It contains data. Fields: COURT_ID (INT4, key), COURT_NAME (CHAR 40), SPORT (CHAR 20).
- Table {{P}}BOOKING exists in package $TMP. It contains data. Fields: BOOKING_ID (INT4, key), COURT_ID (INT4), BOOKING_DATE (DATS), DURATION_MIN (INT4, the booked time in minutes), FEE (DEC 15,2).
- A booking belongs to exactly one court. The field BOOKING.COURT_ID refers to the field COURT.COURT_ID.
4. Contract
- Create the executable program {{P}}COURT_USE in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first booking date to include.
- Parameter P_TO, type DATS, mandatory: the last booking date to include.
- Select-option S_SPORT for the sport of the court.
- Show the result with CL_SALV_TABLE. The output table has these columns, with these names: COURT_NAME, SPORT, BOOKINGS, DURATION, TOTAL.
5. Business rules
- Include a booking only if BOOKING_DATE is on or after P_FROM and on or before P_TO.
- Include a booking only if the SPORT of its court is in S_SPORT.
- Show one line for each court that has at least one included booking.
- BOOKINGS is the number of included bookings of the court.
- DURATION is the sum of DURATION_MIN of the included bookings, divided by 60. DURATION has two decimal places.
- TOTAL is the sum of FEE of the included bookings.
- Sort the lines by TOTAL, the highest total first.
6. Constraints
- Release target: 7.58.
- Coding standards: Clean ABAP. Read the data with one database access.
- Out of scope: do not change {{P}}COURT and {{P}}BOOKING.
7. Acceptance
- The program is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests as local test classes in the program.