46 lines
1.8 KiB
Markdown
46 lines
1.8 KiB
Markdown
# 1. Goal
|
|
Calculate the price of a same-day delivery for a courier company. The dispatch
|
|
program calls one event module for each delivery order. The event module must
|
|
have the same interface as the sample event module, because the dispatch program
|
|
calls all event modules in the same way.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_DLV exists in package $TMP.
|
|
- Function module {{P}}DLV_SAMPLE exists in this group. It is the sample event
|
|
module. Its interface is the interface that all event modules must use. Read
|
|
the interface of {{P}}DLV_SAMPLE before you start.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}DLV_PRICE in function group {{P}}FG_DLV.
|
|
- Use exactly the interface of {{P}}DLV_SAMPLE: the same parameter names, kinds,
|
|
types, and exceptions.
|
|
|
|
# 5. Business rules
|
|
1. If the weight is less than or equal to 0, raise the exception INVALID_WEIGHT.
|
|
2. If the distance is more than 300 km, the delivery is out of the service area.
|
|
Set the skip flag to true. Do not change the price. Stop here. Do not apply
|
|
rules 3 to 8.
|
|
3. Set the skip flag to false.
|
|
4. Service EX (express): the price is 12.00 plus 0.60 for each km plus 1.50 for
|
|
each kg.
|
|
5. Service ST (standard): the price is 5.00 plus 0.30 for each km plus 0.80 for
|
|
each kg.
|
|
6. Any other service: set the skip flag to true and set the price to 0. Do not
|
|
apply rules 7 and 8.
|
|
7. Round the price half up to 2 decimals.
|
|
8. The minimum price is 6.00.
|
|
|
|
# 6. Constraints
|
|
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
|
- Coding standards: Clean ABAP. Methods below 40 statements. No ATC priority 1
|
|
or 2 findings.
|
|
- Out of scope: do not change {{P}}DLV_SAMPLE.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}DLV_PRICE is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|