46 lines
2.0 KiB
Markdown
46 lines
2.0 KiB
Markdown
# 1. Goal
|
|
Calculate the price of a firewood delivery for a firewood merchant. The order
|
|
program calls one function module for each delivery order. The function module
|
|
must have the same interface as the sample function module, because the order
|
|
program calls all function modules in the same way.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_WOOD exists in package $TMP.
|
|
- Function module {{P}}WOOD_SAMPLE exists in this group. It is the sample
|
|
function module. Its interface is the interface that all function modules of
|
|
the order program must use.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}WOOD_FEE in function group {{P}}FG_WOOD.
|
|
- Use exactly the interface of {{P}}WOOD_SAMPLE: the same parameter names, the
|
|
same parameter kinds, the same types, and the same exceptions.
|
|
|
|
# 5. Business rules
|
|
Apply the rules in this order.
|
|
1. If iv_volume is less than or equal to 0, raise INVALID_VOLUME.
|
|
2. If iv_distance is less than 0, raise INVALID_DISTANCE.
|
|
3. Set ev_skip to false, except in rule 4.
|
|
4. If iv_wood_type is 'MX', set ev_skip to true and do not change cv_fee.
|
|
5. The price for one cubic metre is 120.00 for wood type 'BE', 150.00 for wood
|
|
type 'OK', and 90.00 for wood type 'SP'. For every other wood type the price
|
|
for one cubic metre is 0.
|
|
6. The wood price is iv_volume multiplied by the price for one cubic metre.
|
|
7. If iv_distance is greater than 20, the delivery charge is 0.45 for each
|
|
kilometre above 20. Otherwise the delivery charge is 0.
|
|
8. The fee is the wood price plus the delivery charge, rounded half up to two
|
|
decimals.
|
|
9. If the fee is less than 80.00, the fee is 80.00.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.02. Use only syntax that release 7.02 supports.
|
|
- Coding standard: Clean ABAP. Keep every method below 40 statements.
|
|
- Out of scope: do not change {{P}}WOOD_SAMPLE.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}WOOD_FEE is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|