Files
2026-10-05 18:02:52 +02:00

1.5 KiB

1. Goal

Show the energy that each charging station of a charging network delivered in a period in an ALV list. The network operator uses the list to compare the stations.

2. Open questions

None.

3. Context

  • Table {{P}}CHARGE exists in package $TMP. It contains data. Fields: SESSION_ID (INT4, key), STATION (CHAR 10), SESSION_DATE (DATS), ENERGY_KWH (DEC 15,2).

4. Contract

  • Create the executable program {{P}}CHARGE_STAT in package $TMP.
  • Selection screen:
    • Parameter P_FROM, type DATS, mandatory: the first session date to include.
    • Parameter P_TO, type DATS, mandatory: the last session date to include.
  • Show the result with CL_SALV_TABLE. The output table has these columns, with these names: STATION, TOTAL_KWH, SESSIONS.

5. Business rules

  1. Include a session only if SESSION_DATE is on or after P_FROM and on or before P_TO.
  2. Show one line for each station that has at least one included session.
  3. TOTAL_KWH is the sum of ENERGY_KWH of the included sessions of the station. SESSIONS is the number of included sessions of the station.
  4. Sort the lines by TOTAL_KWH, the highest total first.
  5. Sort the lines by TOTAL_KWH, the lowest total first.

6. Constraints

  • Release target: 8.16.
  • Coding standards: Clean ABAP. Read the data with one database access.
  • Out of scope: do not change {{P}}CHARGE.

7. Acceptance

  • The program is active and has no syntax error.
  • The list shows one line for each station that has at least one included session.
  • Write ABAP Unit tests as local test classes in the program.