60 lines
1.8 KiB
Markdown
60 lines
1.8 KiB
Markdown
# 1. Goal
|
|
|
|
A tree surgery company prices tree felling jobs. The dispatch program calls one
|
|
function module for each job. The function module calculates the fee of the job
|
|
and shows if the tree needs special equipment.
|
|
|
|
# 2. Open questions
|
|
|
|
None.
|
|
|
|
# 3. Context
|
|
|
|
- Function group {{P}}FG_TREE is in package $TMP. The group is empty.
|
|
- The dispatch program calls the function module {{P}}TREE_FEE for each job.
|
|
- A job has a tree species, the height of the tree in centimetres, and a flag
|
|
that shows if the tree is near a house.
|
|
|
|
# 4. Contract
|
|
|
|
Create the function module {{P}}TREE_FEE in function group {{P}}FG_TREE with
|
|
this interface:
|
|
|
|
- Importing parameters:
|
|
- iv_species TYPE string
|
|
- iv_height_cm TYPE i
|
|
- iv_near_house TYPE abap_bool
|
|
- Exporting parameters:
|
|
- ev_fee TYPE decfloat34
|
|
- ev_warning TYPE abap_bool
|
|
- Exceptions:
|
|
- invalid_height
|
|
|
|
# 5. Business rules
|
|
|
|
1. If iv_height_cm is 0 or less, raise the exception INVALID_HEIGHT.
|
|
2. The base fee depends on the tree species:
|
|
- OAK: 200.00
|
|
- PINE: 150.00
|
|
- BIRCH: 120.00
|
|
- all other species: 100.00
|
|
3. The height counts in full metres. A started metre counts as a full metre.
|
|
For each metre above 5 metres, add 25.00 to the fee.
|
|
4. If iv_near_house is true, add 12.5 % of the fee that results from rules 2
|
|
and 3.
|
|
5. If iv_height_cm is more than 2000, set ev_warning to true and add 500.00 to
|
|
the fee. In all other cases ev_warning is false.
|
|
6. Round the final fee half up to 2 decimals.
|
|
|
|
# 6. Constraints
|
|
|
|
- Release target: 7.02. Use only syntax that release 7.02 supports.
|
|
- Coding standards: Clean ABAP. Keep the function module short.
|
|
- Out of scope: do not create other objects.
|
|
|
|
# 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.
|