2.2 KiB
1. Goal
A farrier serves stables with a mobile shoeing round. The order desk calls the function module {{P}}FARRIER_FEE once for each planned visit. The module returns the fee of the visit, the number of weeks until the next visit, and a flag that tells the desk that the visit must not be planned.
The module already exists in package $TMP. Its implementation is old code. The code works, but it mixes several rules in one block and it uses hard-coded numbers. Rewrite it so that a new colleague can read and change it.
The name and the public interface of the module must not change. The result of the module must not change for any input.
2. Open questions
None.
3. Context
- The function group {{P}}FG_FARRIER exists in package $TMP.
- The function module {{P}}FARRIER_FEE is in this group and is active.
- The order desk and two planning programs call the module. They rely on the current interface and on the current results.
4. Contract
Function module {{P}}FARRIER_FEE in function group {{P}}FG_FARRIER. Keep the name and the interface. Do not add, remove or rename a parameter.
| Name | Kind | Type |
|---|---|---|
| iv_horses | importing | i |
| iv_km | importing | decfloat34 |
| iv_new_shoes | importing | abap_bool |
| iv_contract | importing | abap_bool |
| ev_fee | exporting | decfloat34 |
| ev_weeks | exporting | i |
| ev_reject | exporting | abap_bool |
| invalid_horses | exception | - |
5. Business rules
The rules of the shoeing round are in the current implementation of {{P}}FARRIER_FEE. Read that source. Every rule that the current code applies stays in force. The module must return the same values as before for every combination of input values.
6. Constraints
- Release target: 7.58.
- Coding standards: Clean ABAP. Give every value a meaningful name. Replace hard-coded numbers with constants. Keep the procedures short and comment each rule.
- The module stays in package $TMP.
- Out of scope: none.
7. Acceptance
- {{P}}FARRIER_FEE is active and free of syntax errors.
- The returned values are unchanged.
- The hidden tests pass.
- Add ABAP Unit tests for the module in a global test class.
- No ATC finding of priority 1 or priority 2.