# 1. Goal Give the sales figures of each product for a period. The period is an input of the view. A report and an OData service read the figures, so the calculation must be in the database, in a CDS view. # 2. Open questions None. # 3. Context - Table {{P}}SALES (sales line), package $TMP. Key: DOC_ID (CHAR 10), ITEM_NO (INT4). Fields: PRODUCT (CHAR 10), QUANTITY (INT4), PRICE (DEC 15,2, the price of one unit), SOLD_ON (DATS, the date of the sale). - The class {{P}}SEED_SALES fills {{P}}SALES with sample data. Run it if you want to test the view manually. # 4. Contract - Create the CDS view entity {{P}}I_SALES_REPORT in package $TMP. - Input parameters, with these names and types: P_FROM (DATS), P_TO (DATS). The parameters have no default value. - Elements, with these names: PRODUCT (key), TOTAL_QTY, TOTAL_AMOUNT. - No authorization check (#NOT_REQUIRED). # 5. Business rules 1. A sales line is in the period when SOLD_ON is not before P_FROM and not after P_TO. P_FROM and P_TO are part of the period. 2. Show one row for each product with at least one sales line in the period. Do not show a product without a sales line in the period. 3. TOTAL_QTY is the sum of QUANTITY of all sales lines of the product in the period. 4. TOTAL_AMOUNT is the sum of QUANTITY multiplied by PRICE of all sales lines of the product in the period, with 2 decimals. # 6. Constraints - Release target: 7.58. - Coding standards: Clean ABAP. - Out of scope: do not change {{P}}SALES and {{P}}SEED_SALES. # 7. Acceptance - The view is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.