62 lines
2.5 KiB
Markdown
62 lines
2.5 KiB
Markdown
# 1. Goal
|
|
A catering company prices banquet orders. The order desk calls one function
|
|
module for each banquet order. The function module reads the ordered positions
|
|
of the order and the dish master, and it returns the total price, the number of
|
|
portions and the number of different dishes.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_BANQUET exists in package $TMP.
|
|
- Table {{P}}DISH is the dish master. Its fields are DISH_ID (character 10),
|
|
DISH_NAME (character 40) and PRICE (amount with 2 decimals).
|
|
- Table {{P}}POS holds the positions of the banquet orders. Its fields are
|
|
ORDER_ID (character 10), POS_NO (integer), DISH_ID (character 10) and QTY
|
|
(integer). The key of the table is ORDER_ID and POS_NO. The same dish can
|
|
occur in more than one position of the same order.
|
|
- The order desk passes only the order number to the function module. The
|
|
function module reads the two tables.
|
|
|
|
# 4. Contract
|
|
Create the function module {{P}}BANQUET_FEE in function group {{P}}FG_BANQUET.
|
|
|
|
The interface of the function module is:
|
|
- IMPORTING
|
|
- IV_ORDER_ID: string
|
|
- EXPORTING
|
|
- EV_TOTAL: decfloat34
|
|
- EV_PORTIONS: i
|
|
- EV_DISHES: i
|
|
- EXCEPTIONS
|
|
- NO_POSITIONS
|
|
- UNKNOWN_DISH
|
|
- INVALID_QUANTITY
|
|
|
|
# 5. Business rules
|
|
1. The positions of the order are the rows of {{P}}POS with the given order
|
|
number.
|
|
2. If the order has no position, raise NO_POSITIONS.
|
|
3. If a position has a quantity of 0 or less, raise INVALID_QUANTITY.
|
|
4. If a position refers to a dish that is not in {{P}}DISH, raise UNKNOWN_DISH.
|
|
5. If more than one of the rules 2 to 4 applies, the function module raises the
|
|
exception of the lowest rule number.
|
|
6. EV_TOTAL is the sum of the quantity multiplied by the price of the dish over
|
|
all positions of the order.
|
|
7. EV_PORTIONS is the sum of the quantities of all positions of the order.
|
|
8. EV_DISHES is the number of different dishes in the order.
|
|
9. If EV_PORTIONS is 50 or more, the caterer gives a discount of 5 % on
|
|
EV_TOTAL. Round the discounted total half up to 2 decimals.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16 (SAP_BASIS 816).
|
|
- Coding standards: Clean ABAP. A method has fewer than 40 statements. The
|
|
function module must not cause an ATC finding of priority 1 or 2.
|
|
- Out of scope: do not change {{P}}DISH, {{P}}POS, {{P}}FG_BANQUET and
|
|
{{P}}SEED_BANQUET.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}BANQUET_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.
|