Files

2.0 KiB

1. Goal

Refactor the legacy report {{P}}TRAIN_PUNCT_OLD in package $TMP. The report shows the punctuality of the railway lines of a regional operator. The operations team uses the report to find the lines that need attention. The behaviour of the report stays the same. Only the internal structure changes.

2. Open questions

None.

3. Context

  • Table {{P}}TRUN exists in package $TMP and contains data. Fields: RUN_ID (INT4, key), LINE_CODE (CHAR 6), PLAN_DATE (DATS), DELAY_MIN (INT4), CANCELLED (CHAR 1). One row is one train run of one line on one day. DELAY_MIN is the delay of the run in minutes. CANCELLED is 'X' if the run was cancelled.
  • The report {{P}}TRAIN_PUNCT_OLD in package $TMP is the legacy report. It is active and it produces the correct result. Users report that the code is hard to maintain.
  • The report reads the table and shows one line per railway line in an ALV list.

4. Contract

  • The program {{P}}TRAIN_PUNCT_OLD keeps its name and its package $TMP.
  • The selection screen keeps these parameters:
    • S_LINE: a select-option for the line code.
    • S_DATE: a select-option for the plan date.
  • The report shows the result with CL_SALV_TABLE. The output table keeps these column names: LINE_CODE, RUNS, LATE, SUM_DELAY, PUNCT.

5. Business rules

The behaviour of the report must not change. The legacy code of {{P}}TRAIN_PUNCT_OLD contains the business rules. Read the legacy code and keep every rule. Do not add rules. Do not remove rules.

6. Constraints

  • Release target: SAP_BASIS 816 (ABAP Platform 2025).
  • Coding standards: Clean ABAP. Split the logic into small methods. A method has fewer than 40 statements. Do not change the public interface.
  • Out of scope: do not change {{P}}TRUN and do not change {{P}}TRAIN_SEED.

7. Acceptance

  • The program is active and has no syntax error.
  • The behaviour of the program is unchanged. The hidden tests pass.
  • The code has no ATC finding of priority 1 or 2.
  • Write ABAP Unit tests as local test classes in the program.