# 1. Goal Refactor the legacy report {{P}}FLEET_COST_OLD in package $TMP. The report shows the running cost of each vehicle of a company fleet for a period. The behavior of the report stays the same. Improve the internal quality of the source code. # 2. Open questions None. # 3. Context - The program {{P}}FLEET_COST_OLD exists in package $TMP. It is active and it produces a correct result. Its source code is of poor quality. - The tables {{P}}VEHICLE and {{P}}TRIP exist in package $TMP. They contain data. The report reads these two tables. - The report shows the result in an ALV list. - The users report no functional defect. Do not change the behavior. - The report is not in the out-of-scope list. Refactor it in place. # 4. Contract - The program keeps the name {{P}}FLEET_COST_OLD and the package $TMP. - The selection screen keeps these fields, in this order: - Parameter P_FROM, type DATS, mandatory. - Parameter P_TO, type DATS, mandatory. - Select-option S_CAT for the vehicle category. - The ALV list keeps the same columns with the same names: VEHICLE_ID, PLATE, CATEGORY, DISTANCE, FUEL_COST, TOLL_COST, TOTAL_COST, COST_PER_KM. - The lines of the list and the order of the lines do not change. # 5. Business rules The behavior stays the same. The legacy source code of {{P}}FLEET_COST_OLD contains all the rules. Read the legacy code. Keep every rule. Do not add a rule and do not remove a rule. # 6. Constraints - Release target: 8.16. - Coding standards: Clean ABAP. - Do not read a database table inside a loop. - A method has less than 40 statements. - The maximum nesting depth is 3. - Use meaningful names. - Out of scope: do not change the tables {{P}}VEHICLE and {{P}}TRIP. Do not change the selection screen fields. Do not change the ALV column names. # 7. Acceptance - The program {{P}}FLEET_COST_OLD is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests as local test classes in the program.