Files
abap-llm/tasks_gen/train/G1926/spec.md
2026-10-05 22:08:59 +02:00

3.1 KiB

1. Goal

A go-kart circuit starts a race only when the booking is correct. The booking desk and the web shop of the circuit must use the same check. Create the interface that both programs use as the contract of the check.

2. Open questions

None.

3. Context

  • The interface {{P}}IF_KART_CHECK does not exist. Create it in package $TMP.
  • The circuit returns one reason code for a booking. The reason codes are OK, NO_NAME, TOO_YOUNG, TOO_OLD, BAD_LAPS, CLOSED and TOO_MANY.
  • The meaning of the reason codes is: OK - the booking is correct. NO_NAME - the driver name is empty. TOO_YOUNG - the driver is younger than MIN_AGE. TOO_OLD - the driver is older than MAX_AGE. BAD_LAPS - the number of laps is outside MIN_LAPS and MAX_LAPS. CLOSED - the booking time is outside the opening hours. TOO_MANY - the group has more than MAX_DRIVERS bookings.
  • The circuit is open from 09:00:00 to 22:00:00.
  • The booking desk and the web shop read the reason codes and the limits from the interface. No other object uses the interface.

4. Contract

  • Create the interface {{P}}IF_KART_CHECK in package $TMP.
  • The interface is public.
  • The interface contains the types, the constants and the methods of the business rules. Do not add other public components.

5. Business rules

  1. The interface has the type TY_REASON. TY_REASON is a character type of length 12.
  2. The interface has the structure type TY_BOOKING. The components are: DRIVER_NAME (character, length 20), DRIVER_AGE (integer), LAPS (integer), BOOKING_TIME (time).
  3. The interface has the table type TT_BOOKINGS. The row type is TY_BOOKING. TT_BOOKINGS is a standard table with an empty key.
  4. The interface has the constant structure C_REASON. Each component has the type TY_REASON. The components and the values are: OK = 'OK', NO_NAME = 'NO_NAME', TOO_YOUNG = 'TOO_YOUNG', TOO_OLD = 'TOO_OLD', BAD_LAPS = 'BAD_LAPS', CLOSED = 'CLOSED', TOO_MANY = 'TOO_MANY'.
  5. The interface has the constant structure C_LIMIT. Each component has the type i. The components and the values are: MIN_AGE = 12, MAX_AGE = 75, MIN_LAPS = 5, MAX_LAPS = 30, MAX_DRIVERS = 8.
  6. The interface has the constant C_OPEN_FROM with the value '090000' and the constant C_OPEN_TO with the value '220000'. Both constants have the type t.
  7. The interface has the method CHECK_BOOKING. The importing parameter IS_BOOKING has the type TY_BOOKING. The returning parameter RV_REASON has the type TY_REASON.
  8. The interface has the method CHECK_GROUP. The importing parameter IT_BOOKINGS has the type TT_BOOKINGS. The returning parameter RV_REASON has the type TY_REASON.
  9. The interface has the method IS_OPEN. The importing parameter IV_TIME has the type t. The returning parameter RV_OPEN has the type ABAP_BOOL.

6. Constraints

  • Release target: 8.16.
  • Coding standards: Clean ABAP. No comment that restates the code.
  • Out of scope: do not create other objects.

7. Acceptance

  • The interface is active and has no syntax error.
  • The hidden tests pass.
  • Write your own ABAP Unit tests for the interface. Use a global test class, for example {{P}}KART_CHECK_TEST.