63 lines
2.4 KiB
Markdown
63 lines
2.4 KiB
Markdown
# 1. Goal
|
|
Calculate the fee of a cleaning job for a carpet cleaning company. The order
|
|
desk calls one function module for each cleaning job. The function module
|
|
checks the job data, calculates the fee, and returns a note for the order desk.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_CARPET exists in package $TMP.
|
|
- Function module {{P}}CARPET_SAMPLE exists in this group. It shows the
|
|
interface that the pricing modules of the group use.
|
|
- The order desk calls the pricing module for each cleaning job.
|
|
|
|
# 4. Contract
|
|
Create the function module {{P}}CARPET_FEE in function group {{P}}FG_CARPET.
|
|
Use exactly the interface of {{P}}CARPET_SAMPLE:
|
|
- Importing parameters:
|
|
- iv_clean_type TYPE string
|
|
- iv_area_sqm TYPE decfloat34
|
|
- iv_stain TYPE abap_bool
|
|
- Exporting parameters:
|
|
- ev_fee TYPE decfloat34
|
|
- ev_note TYPE string
|
|
- Exceptions:
|
|
- invalid_type
|
|
- invalid_area
|
|
- stain_not_allowed
|
|
- area_too_large
|
|
|
|
# 5. Business rules
|
|
1. Check the job data in this order: cleaning type, area, stain option, carpet
|
|
size limit. Raise only the first exception that applies.
|
|
2. The cleaning type is 'CP' (carpet), 'UP' (upholstery) or 'RU' (rug). For
|
|
any other value, raise invalid_type.
|
|
3. The area must be greater than 0. For an area of 0 or less, raise
|
|
invalid_area.
|
|
4. A stain treatment is possible for 'CP' and 'UP' only. If iv_stain is true
|
|
and the cleaning type is 'RU', raise stain_not_allowed.
|
|
5. A carpet with an area greater than 100 square metres needs a site visit. If
|
|
the cleaning type is 'CP' and the area is greater than 100, raise
|
|
area_too_large.
|
|
6. The base rate for each square metre is 3.50 for 'CP', 5.00 for 'UP' and 2.00
|
|
for 'RU'.
|
|
7. A stain treatment adds 25.00 to the fee.
|
|
8. The fee is the base amount plus the surcharge, rounded half up to 2 decimal
|
|
places.
|
|
9. The minimum fee is 40.00. If the fee from rule 8 is less than 40.00, the fee
|
|
is 40.00 and the note is 'MINIMUM FEE APPLIED'. In all other cases the note
|
|
is empty.
|
|
10. If an exception is raised, the fee and the note are not set.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Coding standards: Clean ABAP. Keep the function module short and readable.
|
|
- Out of scope: do not change {{P}}CARPET_SAMPLE. Do not create database
|
|
tables.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}CARPET_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.
|