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

1.4 KiB

1. Goal

Show the blood that each donation camp collected. A report and an OData service will read the totals, so the calculation must be in the database, in a CDS view.

2. Open questions

None.

3. Context

  • Table {{P}}CAMP (donation camp), package $TMP. Key: CAMP_ID (CHAR 10). Fields: CITY (CHAR 20).
  • Table {{P}}DONAT (blood donation), package $TMP. Key: CAMP_ID (CHAR 10), DONA_NO (INT4). Fields: BLOOD_GROUP (CHAR 3), VOL_ML (INT4, volume in millilitres).

4. Contract

  • Create the CDS view entity {{P}}I_BLOOD_STOCK in package $TMP.
  • Elements, with these names: CAMP_ID (key), CITY, DONA_COUNT, TOTAL_VOLUME.
  • No authorization check (#NOT_REQUIRED).

5. Business rules

  1. A donation is counted when its volume is greater than zero. A donation with volume zero is not counted.
  2. Show one row for each camp that has at least three counted donations. Do not show a camp with fewer than three counted donations.
  3. Do not show a camp that has no donation at all.
  4. DONA_COUNT is the number of counted donations of the camp.
  5. TOTAL_VOLUME is the sum of the volumes of the counted donations of the camp, in millilitres.
  6. CITY is the city of the camp.

6. Constraints

  • Release target: 8.16.
  • Coding standards: Clean ABAP.
  • Out of scope: do not change {{P}}CAMP and {{P}}DONAT.

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.