2.2 KiB
2.2 KiB
1. Goal
Show the work of each taxi driver of a taxi company for a period in an ALV list. The dispatcher uses the list to compare the drivers.
2. Open questions
None.
3. Context
- Table {{P}}DRIVER exists in package $TMP and contains data. Fields: DRIVER_ID (CHAR 6, key), DRIVER_NAME (CHAR 40), BASE_CODE (CHAR 6).
- Table {{P}}TRIP exists in package $TMP and contains data. Fields: TRIP_ID (INT4, key), DRIVER_ID (CHAR 6), TRIP_DATE (DATS), KM (DEC 7,2), FARE (DEC 15,2).
- A trip belongs to the driver that has the same DRIVER_ID.
4. Contract
- Create the executable program {{P}}TAXI_DAY in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first trip date to include.
- Parameter P_TO, type DATS, mandatory: the last trip date to include.
- Select-option S_BASE for the base code of the driver.
- Show the result with CL_SALV_TABLE. The output table has these columns, with these names: DRIVER_ID, DRIVER_NAME, BASE_CODE, TRIPS, KM, FARE, AVG_FARE.
5. Business rules
- Include a trip only if TRIP_DATE is on or after P_FROM and on or before P_TO.
- Include a trip only if the base code of its driver is in S_BASE. An empty S_BASE includes every base code.
- Ignore a trip if its DRIVER_ID is not in table {{P}}DRIVER.
- Show one line for each driver that has at least one included trip.
- DRIVER_ID is the identifier of the driver and DRIVER_NAME is the name of the driver. BASE_CODE is the base code of the driver.
- TRIPS is the number of included trips of the driver.
- KM is the sum of the KM of the included trips of the driver.
- FARE is the sum of the FARE of the included trips of the driver.
- AVG_FARE is FARE divided by TRIPS, rounded to 2 decimal places.
- Sort the lines by FARE, the highest fare first. If two drivers have the same fare, sort them by DRIVER_ID in ascending order.
6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Read {{P}}TRIP with one database access and {{P}}DRIVER with one database access.
- Out of scope: do not change {{P}}DRIVER and {{P}}TRIP.
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.