Files

2.0 KiB

1. Goal

The car wash chain uses the program {{P}}CARWASH_RPT to show the washes and the revenue of each wash program for a period. The program is a legacy report. The users complain about the code quality. Refactor the program in place. The behavior stays the same.

2. Open questions

None.

3. Context

  • {{P}}CARWASH_RPT is an executable program in package $TMP. It is in production and it runs.
  • The program reads the tables {{P}}CARWASH (the wash visits) and {{P}}WASHPGM (the text of each wash program).
  • The legacy source code of the program contains the business rules. Read the legacy code.
  • The behavior must not change: the same selection screen, the same ALV columns, and the same numbers.

4. Contract

  • Refactor the program {{P}}CARWASH_RPT in package $TMP. The name stays the same. The public interface stays the same.
  • Selection screen:
    • P_FROM, type DATS, mandatory: the first wash date to include.
    • P_TO, type DATS, mandatory: the last wash date to include.
    • S_PROG, select-option for the wash program.
  • The program shows the result with CL_SALV_TABLE. The ALV columns keep these names: WASH_PROG, PROG_TEXT, WASHES, REVENUE, VIP_WASHES, VIP_REVENUE.
  • The hidden tests call the program with SUBMIT and read the ALV data. They use only the names above.

5. Business rules

The business rules are in the legacy code of {{P}}CARWASH_RPT. Read the legacy code. The refactored program applies the same rules and shows the same numbers. Do not change the rules.

6. Constraints

  • Release target: 7.58.
  • Coding standards: Clean ABAP.
  • The program is modular. The logic is in small methods with clear names.
  • No method has more than 40 statements.
  • No database access inside a loop.
  • No duplicated logic.
  • The program has no ATC priority 1 or priority 2 finding.
  • Out of scope: do not change {{P}}CARWASH, {{P}}WASHPGM, and {{P}}CARWASH_SEED.

7. Acceptance

  • The program {{P}}CARWASH_RPT is active and has no syntax error.
  • The behavior is unchanged.
  • The hidden tests pass.
  • Write ABAP Unit tests as local test classes in the program.