Files
2026-10-05 22:08:59 +02:00

2.5 KiB

1. Goal

A watermill grinds the grain that farmers deliver. Every job is billed from the sacks of the job and from the milling rate of each lot. The front desk reads the charge of a job from the CDS view entity {{P}}I_MILL_CHARGE in package $TMP.

The definition of that view is old. It activates and it returns correct data, but a fixed money value sits in its source code and the import parameter P_MIN_CHARGE is declared and never read. Rework the definition of the view so that the parameter supplies that money value. The view keeps its name, its elements and its behaviour.

2. Open questions

None.

3. Context

  • Table {{P}}MILLJOB, package $TMP, one row for each milling job. Key: JOB_ID (CHAR 10). Further fields: FARMER (CHAR 10), DELIVERY_DATE (DATS).
  • Table {{P}}MILLLOT, package $TMP, one row for each grain lot of a job. Key: JOB_ID (CHAR 10), LOT_NO (INT4). Further fields: GRAIN (CHAR 10), SACKS (INT4), MILL_RATE (DEC 15,2, the price for milling one sack).
  • The current definition of {{P}}I_MILL_CHARGE is the legacy code. Open it and read it. It is the only description of the rules of the view.

4. Contract

  • {{P}}I_MILL_CHARGE stays in package $TMP under its current name.
  • The elements of the view keep their names and their order: JOB_ID (key), FARMER, LOT_COUNT, SACK_COUNT, MILL_AMOUNT, CHARGE_AMOUNT.
  • The import parameter P_MIN_CHARGE (DEC 15,2) stays. It holds an amount of money.
  • The authorization check stays #NOT_REQUIRED.

5. Business rules

The rules of the view are not repeated in this document. They are inside the legacy source code of {{P}}I_MILL_CHARGE. Read that source code and keep every rule exactly as it is.

The rework must fulfil three quality goals:

  1. P_MIN_CHARGE supplies the money value that the legacy code writes as a literal. That literal disappears from the source code of the view.
  2. A caller that passes the money value of the legacy code receives exactly the values that the view returned before the rework.
  3. The view stays Clean ABAP: no unused element, no dead code, one expression for each element.

6. Constraints

  • Release target: SAP_BASIS 816 (ABAP Platform 2025).
  • Package $TMP. No transport.
  • Out of scope: {{P}}MILLJOB and {{P}}MILLLOT stay untouched.
  • The name of the view and the element names stay untouched.
  • ATC must report no finding of priority 1 or priority 2.

7. Acceptance

  • {{P}}I_MILL_CHARGE is active and free of syntax errors.
  • The hidden tests pass.
  • Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.