1.7 KiB
1.7 KiB
1. Goal
A bookbinding workshop prices binding jobs. The order desk calls one function module for each job. The function module calculates the fee of the job and reports whether the job is a rush job.
2. Open questions
None.
3. Context
- Function group {{P}}FG_BIND exists in package $TMP.
- Function module {{P}}BIND_SAMPLE exists in this group. It shows the interface that the order desk uses.
4. Contract
- Create the function module {{P}}BIND_FEE in function group {{P}}FG_BIND.
- The interface of {{P}}BIND_FEE:
- importing iv_binding TYPE string
- importing iv_pages TYPE i
- importing iv_member TYPE abap_bool
- exporting ev_rush TYPE abap_bool
- changing cv_fee TYPE decfloat34
- exceptions invalid_pages
5. Business rules
- If the number of pages is less than 1, raise the exception INVALID_PAGES.
- Set the rush flag to false, except in rule 7.
- Binding type PB: the fee is 0.05 per page, rounded half up to 2 decimals.
- Binding type HB: the fee is 0.12 per page, rounded half up to 2 decimals. The minimum fee for hardback binding is 15.00.
- A member receives a discount of 10 % on the fee. The discount is the last step of the calculation and is applied after the minimum fee of rule 4.
- The minimum fee of rule 4 is the last step of the calculation and is applied after all discounts.
- Binding type EX: set the rush flag to true. The fee is 0.20 per page, rounded half up to 2 decimals.
- Other binding types: the fee is 0.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}BIND_SAMPLE.
7. Acceptance
- The function module is active and has no syntax error.
- Write ABAP Unit tests for the function module in a global test class.