Files
abap-llm/tasks_gen/train/G1080/spec.md
2026-10-05 18:02:52 +02:00

1.9 KiB

1. Goal

Show the state of each vending machine. A dashboard and an OData service read the state, so the calculation must be in the database, in a CDS view.

2. Open questions

None.

3. Context

  • Table {{P}}VMACH (vending machine), package $TMP. Key: MACHINE_ID (CHAR 10). Field: LOCATION (CHAR 20).
  • Table {{P}}VSLOT (vending machine slot), package $TMP. Key: MACHINE_ID (CHAR 10), SLOT_NO (INT4). Fields: PRODUCT (CHAR 10), FILL_LEVEL (INT4, units that remain in the slot), MAX_UNITS (INT4, capacity of the slot in units).

4. Contract

  • Create the CDS view entity {{P}}I_VEND_STATE in package $TMP.
  • Elements, with these names and types: MACHINE_ID (key, CHAR 10), LOCATION (CHAR 20), SLOT_COUNT (INT4), EMPTY_SLOTS (INT4), FILL_RATE (DEC 5,1), STATUS (CHAR 5).
  • No authorization check (#NOT_REQUIRED).

5. Business rules

  1. Show one row for each machine that has at least one slot. Do not show a machine without slots.
  2. SLOT_COUNT is the number of slots of the machine.
  3. EMPTY_SLOTS is the number of slots of the machine with a fill level of zero.
  4. FILL_RATE is the total fill level of the machine as a percentage of the total capacity of the machine. FILL_RATE has one decimal place. Example: a total fill level of 3 units and a total capacity of 20 units give 15.0.
  5. LOCATION is the location of the machine in upper case letters.
  6. STATUS is 'EMPTY' if the total fill level of the machine is zero. STATUS is 'LOW' if the total fill level is not zero and FILL_RATE is less than 25.0. STATUS is 'OK' in all other cases.

6. Constraints

  • Release target: SAP_BASIS 816 (ABAP Platform 2025).
  • Coding standards: Clean ABAP. Keep methods below 40 statements.
  • Out of scope: do not change {{P}}VMACH and {{P}}VSLOT.

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.