# 1. Goal A quarry sells gravel to building companies. A sales program calls the price calculation for each order. Calculate the net amount of one gravel order. # 2. Open questions None. # 3. Context - The table {{P}}GRV_ORD exists in package $TMP. It contains the gravel orders. The columns are: - ORDER_ID (CHAR 10): the order number. - GRADE (CHAR 1): the gravel grade. - TONNES (INT4): the order quantity in whole tonnes. - CUSTOMER (CHAR 30): the name of the customer. - The seed class {{P}}SEED_GRV fills the table with test data. # 4. Contract - Create the class {{P}}GRAVEL_PRICER in package $TMP. - The class is public, final, and has a public constructor without parameters. - Define these public types: - TY_ORDER_ID TYPE c LENGTH 10. - TY_GRADE TYPE c LENGTH 1. - TY_TONNES TYPE i. - TY_AMOUNT TYPE p LENGTH 8 DECIMALS 2. - TY_REASON TYPE c LENGTH 10. - TY_RESULT: a structure with the components NET_AMOUNT (TYPE ty_amount) and REASON (TYPE ty_reason). - Define the public constant structure C_REASON with these components of type TY_REASON: OK, NOT_FOUND, GRADE, QUANTITY. - Define one public method: PRICE_ORDER IMPORTING iv_order_id TYPE ty_order_id RETURNING VALUE(rs_result) TYPE ty_result. - Do not add other public methods. # 5. Business rules Apply the rules in this sequence. Return the reason of the first rule that fails. 1. Read the order with the number iv_order_id from the table {{P}}GRV_ORD. If the table has no order with this number, return NOT_FOUND. 2. The grade must be F (fine), M (medium) or C (coarse). If the grade is not one of these three letters, return GRADE. 3. The quantity must be greater than zero. If the quantity is zero or negative, return QUANTITY. 4. The base price of one tonne is 42.00 EUR for grade F, 36.00 EUR for grade M and 30.00 EUR for grade C. 5. The discount depends on the order quantity: - An order of up to 4 tonnes gets no discount. - An order of 6 to 19 tonnes gets a discount of 5 percent. - An order of 20 tonnes or more gets a discount of 10 percent. 6. The net amount is the base price multiplied by the quantity, less the discount. Round the net amount to 2 decimals. Return OK. # 6. Constraints - Release target: SAP_BASIS 816. - Coding standards: Clean ABAP. Method length below 40 statements. No global variables. No comment that restates the code. - Out of scope: do not change the table {{P}}GRV_ORD and the seed class {{P}}SEED_GRV. # 7. Acceptance - The class is active and has no syntax error. - The hidden tests pass. - Write your own ABAP Unit tests for the class.