Files

49 lines
1.9 KiB
Markdown

# 1. Goal
A parcel sorting centre needs one function module. The function module
calculates the destination bin and the handling fee of a parcel. The sorting
program calls the function module for each parcel before the parcel goes to a
bin.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_SORT exists in package $TMP.
- Function module {{P}}SORT_TEXT exists in this function group. It gives the
text of a bin number.
- The sorting centre receives parcels from many shops. Some parcels have a size
code that the sorting centre does not know. The sorting program calls the
function module for these parcels too.
# 4. Contract
- Create the function module {{P}}SORT_BIN in function group {{P}}FG_SORT.
- Interface of {{P}}SORT_BIN:
- iv_size_code TYPE string (importing)
- iv_weight_kg TYPE decfloat34 (importing)
- ev_bin TYPE i (exporting)
- ev_fee TYPE decfloat34 (exporting)
- Exceptions: invalid_weight, overweight
- The function module has no other parameters.
# 5. Business rules
1. If the weight is less than or equal to 0, raise the exception INVALID_WEIGHT.
In this case, do not set the bin and do not set the fee.
2. If the weight is greater than 31.5, raise the exception OVERWEIGHT. In this
case, do not set the bin and do not set the fee.
3. Size code 'S': the bin is 1. The fee is 1.50 euro.
4. Size code 'M': the bin is 2. The fee is 2.00 euro.
5. Size code 'L': the bin is 3. The fee is 3.00 euro.
6. Size code 'XL': the bin is 4. The fee is 5.00 euro.
7. The fee has two decimals.
# 6. Constraints
- Release target: SAP_BASIS 816.
- Package: $TMP. Do not use transports.
- Out of scope: do not change {{P}}SORT_TEXT.
- Use Clean ABAP. Pass large parameters by reference.
# 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.
- The hidden tests pass.