Files
2026-10-05 18:02:52 +02:00

49 lines
2.1 KiB
Markdown

# 1. Goal
Refactor the legacy function module {{P}}HUT_FEE in function group {{P}}FG_HUT.
The module calculates the fee of a stay in the alpine hut Alpenrose. The hut
keeper calls the module for each booking. The behavior of the module must stay
exactly the same. Improve the internal quality: remove the duplicated code,
reduce the nesting depth, use meaningful names, replace the magic numbers with
constants, and keep the module short and readable.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_HUT exists in package $TMP.
- Function module {{P}}HUT_FEE exists in this group. It is active and it is the
legacy implementation of the hut fee.
- The booking program of the hut calls {{P}}HUT_FEE. The call must not change.
- The legacy source is the only description of the fee rules. Read it.
# 4. Contract
- Refactor the existing function module {{P}}HUT_FEE in function group
{{P}}FG_HUT. The name of the module stays the same.
- The interface stays exactly the same:
- importing iv_guest_type type string
- importing iv_nights type i
- importing iv_member type abap_bool
- importing iv_breakfast type abap_bool
- exporting ev_fee type decfloat34
- exception invalid_nights
- Do not add, remove, or rename a parameter. Do not add another exception.
# 5. Business rules
The legacy implementation of {{P}}HUT_FEE is the specification of the business
rules. The behavior must not change. Keep every rate, every discount, every
special case, and every exception of the legacy source exactly as it is,
including the rules for the guest types, for members, for breakfast, and for
long stays.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Keep {{P}}HUT_FEE below 40 statements. Do not
produce an ATC priority 1 or priority 2 finding.
- Out of scope: do not change function group {{P}}FG_HUT. Do not change the
public interface of {{P}}HUT_FEE. Do not add a new function module.
# 7. Acceptance
- {{P}}HUT_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.