Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
72 lines
3.3 KiB
Markdown
72 lines
3.3 KiB
Markdown
# 1. Goal
|
|
A regional emergency control centre collects the open emergency calls of two
|
|
control centres. The dispatch program calls one function module for each
|
|
dispatch run. The function module must merge the calls of both control centres
|
|
and must return the figures of the dispatch list.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_ALERT exists in package $TMP.
|
|
- The database table {{P}}ALERT_A exists in package $TMP. It contains the open
|
|
emergency calls of control centre A.
|
|
- The database table {{P}}ALERT_B exists in package $TMP. It contains the open
|
|
emergency calls of control centre B.
|
|
- Both tables have the same fields:
|
|
- CALL_ID: the call number, 10 characters.
|
|
- PRIORITY: the urgency. 1 is the highest urgency, 5 is the lowest urgency.
|
|
- CALL_DATE: the date on which the call was reported.
|
|
- CALL_TIME: the time at which the call was reported.
|
|
- DISTRICT: the district of the caller, 4 characters.
|
|
- CALL_ID is the key of each table. A call ID occurs at most one time in each
|
|
table.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}ALERT_MERGE in function group {{P}}FG_ALERT.
|
|
- The function module has this interface:
|
|
- Importing parameter IV_MAX_PRIORITY, type i.
|
|
- Exporting parameter EV_COUNT, type i.
|
|
- Exporting parameter EV_DUPLICATES, type i.
|
|
- Exporting parameter EV_FIRST_CALL_ID, type string.
|
|
- Exporting parameter EV_FIRST_DISTRICT, type string.
|
|
- Exporting parameter EV_LAST_CALL_ID, type string.
|
|
- Exception INVALID_PRIORITY.
|
|
|
|
# 5. Business rules
|
|
1. The function module reads the open calls of both control centres from the
|
|
tables {{P}}ALERT_A and {{P}}ALERT_B.
|
|
2. The dispatch list contains each call ID at most one time.
|
|
3. If one call ID is in both tables, the dispatch list contains the call with
|
|
the earlier report time. The report time is CALL_DATE first and CALL_TIME
|
|
second.
|
|
4. If both calls with the same call ID have the same report time, the dispatch
|
|
list contains the call from {{P}}ALERT_A.
|
|
5. The dispatch list contains only calls with a PRIORITY that is at most
|
|
IV_MAX_PRIORITY.
|
|
6. The dispatch list is sorted by PRIORITY in ascending order. Lines with the
|
|
same PRIORITY are sorted by CALL_DATE in ascending order, then by CALL_TIME
|
|
in ascending order, then by CALL_ID in ascending order.
|
|
7. EV_COUNT is the number of lines in the dispatch list.
|
|
8. EV_DUPLICATES is the number of call IDs that are in both tables. Rule 5
|
|
does not change EV_DUPLICATES.
|
|
9. EV_FIRST_CALL_ID and EV_FIRST_DISTRICT are the call ID and the district of
|
|
the first line of the dispatch list. EV_LAST_CALL_ID is the call ID of the
|
|
last line of the dispatch list. If the dispatch list is empty, these three
|
|
parameters are empty strings.
|
|
10. If IV_MAX_PRIORITY is smaller than 1 or larger than 5, raise the exception
|
|
INVALID_PRIORITY.
|
|
11. If a call in {{P}}ALERT_A or in {{P}}ALERT_B has a PRIORITY that is smaller
|
|
than 1 or larger than 5, raise the exception INVALID_PRIORITY.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Apply the coding standards of Clean ABAP.
|
|
- Out of scope: do not change the tables {{P}}ALERT_A and {{P}}ALERT_B and the
|
|
function group {{P}}FG_ALERT.
|
|
|
|
# 7. Acceptance
|
|
- The function module is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|