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

1.7 KiB

1. Goal

The CDS view entity {{P}}I_TOUR_LOAD in package $TMP shows the load of the delivery tours of a courier depot. Users report that the view gives wrong numbers. Fix the view. The name of the view stays the same.

2. Open questions

None.

3. Context

  • Table {{P}}TOUR (tour header), package $TMP. Key: TOUR_ID (CHAR 10). Fields: DRIVER (CHAR 10), DEPOT (CHAR 4), TOUR_DATE (DATS).
  • Table {{P}}PARCEL (parcel of a tour), package $TMP. Key: TOUR_ID (CHAR 10), PARCEL_NO (INT4). Fields: DEST_ZONE (CHAR 4, destination zone of the parcel), WEIGHT (DEC 8,3).
  • The CDS view entity {{P}}I_TOUR_LOAD reads the two tables.
  • The view is active, but the result is wrong.

4. Contract

  • Fix the CDS view entity {{P}}I_TOUR_LOAD in package $TMP. The object name stays the same.
  • Elements, with these names: TOUR_ID (key), DRIVER, DEPOT, PARCEL_COUNT, TOTAL_WEIGHT.
  • No authorization check (#NOT_REQUIRED).

5. Business rules

  1. The view shows one row for each tour that has at least one parcel.
  2. PARCEL_COUNT is the number of parcels of the tour.
  3. TOTAL_WEIGHT is the sum of the weights of all parcels of the tour, with 3 decimals.
  4. The destination zone of a parcel must not change the result of the view. A tour with parcels in more than one zone appears exactly once.
  5. All other behavior of the view stays the same.

6. Constraints

  • Release target: SAP_BASIS 816.
  • Coding standards: Clean ABAP. The view must be active and must not have a syntax error.
  • Out of scope: do not change the tables {{P}}TOUR and {{P}}PARCEL.

7. Acceptance

  • The view is active and has no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.