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

52 lines
2.5 KiB
Markdown

# 1. Goal
A scaffolding hire company checks a scaffolding order before the yard loads
the material onto the lorry. The dispatch office must give the customer a
clear reason when it blocks an order. Create the message class that holds
these reasons and the class-based exception that carries the reason of a
blocked order.
# 2. Open questions
None.
# 3. Context
- Package $TMP.
- The dispatch program of the scaffolding hire company stops an order with the
class-based exception {{P}}CX_SCAF_ORDER.
- The company has no message class yet.
# 4. Contract
## Message class {{P}}SCAF_MSG
Create the message class {{P}}SCAF_MSG in package $TMP. It contains the
messages 001 to 005. The business rules give the exact text and the use of
each message.
## Class {{P}}CX_SCAF_ORDER
Create the class {{P}}CX_SCAF_ORDER in package $TMP.
- The class is public and final. It inherits from CX_STATIC_CHECK.
- Public read-only attributes ORDER_ID and REASON, both of type string.
- Constructor: IMPORTING iv_order_id TYPE string, iv_reason TYPE string.
- Method GET_MESSAGE: RETURNING VALUE(rv_message) TYPE string.
# 5. Business rules
1. Message 001 is an error message. Text: "Scaffolding order &1 is blocked: &2". &1 is the order id. &2 is the reason.
2. Message 002 is an error message. Text: "Scaffold part &1 is not in stock". &1 is the part number.
3. Message 003 is an error message. Text: "Quantity &1 is not valid for part &2". &1 is the quantity. &2 is the part number.
4. Message 004 is a warning message. Text: "Order &1 exceeds the load limit of &2 kg". &1 is the order id. &2 is the load limit in kilograms.
5. Message 005 is an information message. Text: "Order &1 was released for site &2". &1 is the order id. &2 is the site.
6. The constructor of {{P}}CX_SCAF_ORDER stores the order id in ORDER_ID and the reason in REASON.
7. GET_MESSAGE returns message 001 with &1 = ORDER_ID and &2 = REASON.
8. {{P}}CX_SCAF_ORDER is a static check exception. The caller must handle it.
# 6. Constraints
- Release target: SAP_BASIS 816 (SAP ABAP Platform 2025).
- Coding standards: Clean ABAP. A method has fewer than 40 statements.
- Out of scope: no other message class and no other exception class.
# 7. Acceptance
- The message class {{P}}SCAF_MSG is active and contains messages 001 to 005
with the exact texts of the business rules.
- The class {{P}}CX_SCAF_ORDER is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the message class and for the exception class in
a global test class.