1.9 KiB
1.9 KiB
1. Goal
A dog walking service wants a summary of its walks. The office uses the list to see how far each walker went in the period.
2. Open questions
None.
3. Context
- Table {{P}}WALK exists in package $TMP and contains data. Fields: WALK_ID (INT4, key), WALKER (CHAR 6), WALK_DATE (DATS), DIST_M (INT4, the distance of the walk in metres), STATUS (CHAR 1).
- STATUS has these values:
- 'F': the walk is finished.
- 'X': the walk is cancelled.
- Table {{P}}WALKSUM exists in package $TMP. It is the output structure of the list. Fields: WALKER (CHAR 6, key), DIST_M (INT4), WALKS (INT4).
4. Contract
- Create the executable program {{P}}WALKER_STATS in package $TMP.
- Selection screen:
- Select-option S_DATE for WALK_DATE: the walk dates to include.
- Select-option S_WALKER for WALKER: the walkers to include.
- Show the result with CL_SALV_TABLE. The output table has the row type of table {{P}}WALKSUM. The output columns are WALKER, DIST_M (the total distance in metres) and WALKS (the number of walks).
5. Business rules
- Include a walk only if WALK_DATE is in S_DATE, WALKER is in S_WALKER and STATUS is 'F'.
- An empty S_DATE or an empty S_WALKER does not restrict the result.
- Show one line for each walker that has at least two included walks.
- DIST_M is the sum of DIST_M of the included walks of the walker.
- WALKS is the number of included walks of the walker.
- Sort the lines by DIST_M, the highest number first. If two lines have the same DIST_M, sort them by WALKER in ascending order.
6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Read table {{P}}WALK with one database access.
- Out of scope: do not change {{P}}WALK and {{P}}WALKSUM.
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.