# 1. Goal A coffee roastery plans its daily production. A planning program calls one function module for each production day. The function module groups the roast order lines of the day by coffee blend and returns the total green coffee quantity of each blend. The planning program shows the blend with the largest quantity first. # 2. Open questions None. # 3. Context - Function group {{P}}FG_ROAST exists in package $TMP. - Table {{P}}ROASTS exists in package $TMP. It stores the roast order lines of a production day. - Table {{P}}BLENDS exists in package $TMP. It is the line type of the result table. - The class {{P}}ROAST_SEED fills {{P}}ROASTS with sample data. Run it to get test data. # 4. Contract - Create the function module {{P}}ROAST_SUM in function group {{P}}FG_ROAST. - Interface of {{P}}ROAST_SUM: - IMPORTING it_orders TYPE STANDARD TABLE OF {{P}}ROASTS - EXPORTING et_totals TYPE STANDARD TABLE OF {{P}}BLENDS - EXPORTING ev_grand_total TYPE decfloat34 - The function module has no exceptions. # 5. Business rules 1. A line of it_orders is a production line if its quantity is greater than 0. A line with a quantity of 0 or less is not a production line. 2. et_totals has exactly one line for each blend that has at least one production line in it_orders. 3. The total quantity of a blend is the sum of the quantities of all its production lines. 4. Sort et_totals by total quantity. The largest total quantity comes first. 5. If two blends have the same total quantity, the blend that is smaller in the character order comes first. 6. ev_grand_total is the sum of the total quantities of all lines of et_totals. 7. If it_orders is empty, or if it_orders has no production line, et_totals is empty and ev_grand_total is 0. # 6. Constraints - Release target: 7.58. - Package: $TMP. Do not use transports. - Coding standard: Clean ABAP. Keep the function module short. Choose the internal table kind and the access path that fit the task. - Out of scope: do not change {{P}}ROASTS, {{P}}BLENDS, {{P}}ROAST_SEED. # 7. Acceptance - The function module {{P}}ROAST_SUM is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class.