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

67 lines
3.2 KiB
Markdown

# 1. Goal
A florist's order desk checks a bouquet order before the workshop starts the
work. The order desk software needs one interface for this check. The interface
defines the bouquet bands, the reason codes and the limits of the workshop.
Create this interface.
# 2. Open questions
None.
# 3. Context
- Package $TMP.
- A bouquet order has a number of stems, a total weight in grams and the length
of a stem in centimetres.
- The workshop uses three bouquet bands: S, M and L.
- The result of the check is a structure with the band and a reason code.
- The reason OK means that the order is correct. INVALID means that a value is
not positive. SHORT means that the stem is shorter than the workshop allows.
WEIGHT means that the bouquet is heavier than the workshop allows. STEMS means
that the order has more stems than the workshop allows.
- The workshop accepts at most 3000 g and a stem of at least 40 cm. The bands
S, M and L take at most 20, 40 and 60 stems.
# 4. Contract
- Create the interface {{P}}IF_BOUQUET_CHECK in package $TMP.
- The interface is public. It contains the types, the constants and the method
of the business rules and no other components.
- Do not create other repository objects.
# 5. Business rules
1. Type TY_BAND is a character type of length 1.
2. Type TY_REASON is a character type of length 10.
3. Type TY_RESULT is a structure with exactly two components in this sequence:
BAND of type TY_BAND, then REASON of type TY_REASON.
4. Constant structure C_BAND has exactly three components of type TY_BAND:
SMALL with the value 'S', MEDIUM with the value 'M' and LARGE with the value
'L'.
5. Constant structure C_REASON has exactly five components of type TY_REASON:
OK with the value 'OK', INVALID with the value 'INVALID', SHORT with the
value 'SHORT', WEIGHT with the value 'WEIGHT' and STEMS with the value
'STEMS'.
6. Constant structure C_LIMIT has exactly five components of type I:
MAX_STEMS_SMALL with the value 20, MAX_STEMS_MEDIUM with the value 40,
MAX_STEMS_LARGE with the value 60, MAX_WEIGHT_G with the value 3000 and
MIN_STEM_CM with the value 40.
7. The interface has the method CHECK_ORDER with the importing parameters
IV_STEMS of type I, IV_WEIGHT_G of type I and IV_STEM_CM of type I, and the
returning parameter RS_RESULT of type TY_RESULT.
8. The band of the result is SMALL if IV_STEMS is at most MAX_STEMS_SMALL,
MEDIUM if IV_STEMS is at most MAX_STEMS_MEDIUM, and LARGE in all other
cases.
9. The reason of the result is the reason of the first rule that fails, in this
sequence: INVALID if IV_STEMS, IV_WEIGHT_G or IV_STEM_CM is less than 1;
SHORT if IV_STEM_CM is less than MIN_STEM_CM; WEIGHT if IV_WEIGHT_G is
greater than MAX_WEIGHT_G; STEMS if IV_STEMS is greater than
MAX_STEMS_LARGE. If no rule fails, the reason is OK.
# 6. Constraints
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
- Coding standards: Clean ABAP. An interface has no implementation.
- Out of scope: no class that implements the interface, no database table, no
CDS view entity.
# 7. Acceptance
- The interface {{P}}IF_BOUQUET_CHECK is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the interface.