Files
2026-10-05 22:08:59 +02:00

59 lines
2.7 KiB
Markdown

# 1. Goal
The archery club "Green Quiver" checks a range booking before it confirms the
shooting session. The club keeps all its messages in one message class. The club
also needs a class-based exception that carries one of these messages, so that
the caller of the range check can handle a rejection.
# 2. Open questions
None.
# 3. Context
- All objects are in package $TMP.
- The club keeps all its messages in one message class.
- Every message of the club has at most two placeholders.
- The range check raises the exception with the message that describes the
rejection.
# 4. Contract
- Create the message class {{P}}MSG_ARC in package $TMP. It contains the
messages 001, 002, 003 and 004.
- Create the exception class {{P}}CX_BOW_CHECK in package $TMP.
- The class is public and final. It inherits from CX_STATIC_CHECK.
- The class implements the interface IF_T100_MESSAGE.
- The class has a public constructor with these importing parameters:
- iv_msgno TYPE symsgno
- iv_value1 TYPE string
- iv_value2 TYPE string
- The class has the public read-only attributes value1 and value2, both of type
string. The constructor copies iv_value1 to value1 and iv_value2 to value2.
- The method get_message_text( ) returns the text of the message with the number
iv_msgno of the message class {{P}}MSG_ARC. In this text, &1 is replaced by
iv_value1 and &2 is replaced by iv_value2.
# 5. Business rules
1. Message 001 is an error message. The range check uses it when the archer is
not licensed for the planned bow class. Its text is
"Archer &1 is not licensed for bow class &2". &1 is the name of the archer.
&2 is the bow class.
2. Message 002 is an error message. The range check uses it when too few arrows
are available. Its text is "Arrows &1 are below the minimum of &2". &1 is
the number of arrows. &2 is the minimum number of arrows.
3. Message 003 is a warning message. The range check uses it when the group is
too large. Its text is "Group of &1 archers exceeds the range limit of &2".
&1 is the group size. &2 is the limit of the range.
4. Message 004 is an information message. The range check uses it when the
booking is confirmed. Its text is "Booking &1 is confirmed for &2 archers".
&1 is the booking number. &2 is the number of archers.
# 6. Constraints
- Release target: 8.16.
- Use clean ABAP. Keep every method below 40 statements.
- Out of scope: do not create or change other objects.
# 7. Acceptance
- The message class {{P}}MSG_ARC is active and contains the messages 001 to 004.
- The class {{P}}CX_BOW_CHECK is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the messages and for the exception class in a global
test class.