70 lines
2.7 KiB
Markdown
70 lines
2.7 KiB
Markdown
# 1. Goal
|
|
|
|
Create the message class and the class-based exception for the training course
|
|
booking service. The booking service reports every problem with a message from
|
|
the message class. The exception class carries the text of such a message.
|
|
|
|
# 2. Open questions
|
|
|
|
None.
|
|
|
|
# 3. Context
|
|
|
|
- All objects are in package $TMP.
|
|
- The booking service books participants into training courses.
|
|
- The old exception class {{P}}CX_LEGACY exists. It takes a hard-coded text and
|
|
does not use a message class. The new exception class replaces it.
|
|
- All texts of the booking service come from one message class.
|
|
|
|
# 4. Contract
|
|
|
|
- Create the message class {{P}}MSG with the messages of section 5.
|
|
- Create the exception class {{P}}CX_BOOKING:
|
|
- It is a class-based exception and inherits from CX_STATIC_CHECK.
|
|
- The constructor has these parameters:
|
|
- iv_msgno TYPE symsgno
|
|
- iv_arg1 TYPE string, default ''
|
|
- iv_arg2 TYPE string, default ''
|
|
- The method GET_TEXT of the interface IF_MESSAGE returns the text of the
|
|
message with the number iv_msgno from {{P}}MSG. The placeholder &1 is
|
|
replaced by iv_arg1 and the placeholder &2 is replaced by iv_arg2.
|
|
|
|
# 5. Business rules
|
|
|
|
Message class {{P}}MSG:
|
|
|
|
1. Message 001, error message, text "Course &1 is fully booked". The booking
|
|
service uses it when a course has no free seat.
|
|
2. Message 002, error message, text "Participant &1 is already booked for
|
|
course &2". The booking service uses it for a double booking.
|
|
3. Message 003, warning message, text "Course &1 has only &2 free seats left".
|
|
The booking service uses it when a course has few free seats left.
|
|
4. Message 004, information message, text "Booking for course &1 is
|
|
confirmed". The booking service uses it for a successful booking.
|
|
5. Message 005, warning message, text "Course &1 was cancelled on &2". The
|
|
booking service uses it for a cancelled course.
|
|
|
|
Exception class {{P}}CX_BOOKING:
|
|
|
|
6. The constructor stores the message number and the two placeholders.
|
|
7. GET_TEXT returns the text of the message with the number iv_msgno from
|
|
{{P}}MSG. The placeholder &1 is replaced by iv_arg1 and the placeholder &2 is
|
|
replaced by iv_arg2.
|
|
|
|
# 6. Constraints
|
|
|
|
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
|
- Coding standards: Clean ABAP. Keep every method below 40 statements. Do not
|
|
produce ATC findings of priority 1 or 2.
|
|
- Out of scope: database tables, CDS views, reports, dynpro, and the old
|
|
exception class {{P}}CX_LEGACY.
|
|
|
|
# 7. Acceptance
|
|
|
|
- The message class {{P}}MSG is active. It contains the messages 001 to 005 with
|
|
the exact texts of section 5.
|
|
- The exception class {{P}}CX_BOOKING is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the messages and the exception class in a global
|
|
test class.
|