# 1. Goal Show the sales of each book for a period that the caller gives. The period comes from the caller, so the view needs input parameters. A report and an OData service read the view. # 2. Open questions None. # 3. Context - Table {{P}}BOOK (book master data), package $TMP. Key: BOOK_ID (CHAR 10). Fields: TITLE (CHAR 40), CATEGORY (CHAR 10), PRICE (DEC 15,2), STOCK (INT4). - Table {{P}}SALE (book sales), package $TMP. Key: BOOK_ID (CHAR 10), SALE_DATE (DATS). Field: QUANTITY (INT4). # 4. Contract - Create the CDS view entity {{P}}I_BOOK_REVENUE in package $TMP. - The view has two input parameters, with these names and types: - P_FROM (DATS): first day of the period. - P_TO (DATS): last day of the period. - Elements, with these names: BOOK_ID (key), TITLE, CATEGORY, SOLD_QUANTITY, REVENUE. - No authorization check (#NOT_REQUIRED). - Create the global ABAP Unit test class {{P}}T20_TEST for the view. # 5. Business rules 1. The view has one row for each book that has at least one sale whose SALE_DATE is in the period. The period starts on P_FROM and ends on P_TO. Both limits belong to the period. 2. A book without a sale in the period has no row in the view. 3. SOLD_QUANTITY is the sum of QUANTITY of all sales of the book in the period. 4. REVENUE is the sum of QUANTITY multiplied by PRICE of the book, over all sales of the book in the period. REVENUE has 2 decimals. 5. TITLE and CATEGORY are the title and the category of the book. # 6. Constraints - Release target: 7.58. - Coding standards: Clean ABAP, methods below 40 statements. - Out of scope: do not change {{P}}BOOK and {{P}}SALE. # 7. Acceptance - The view is active and has no syntax error. - The hidden tests pass. - {{P}}T20_TEST uses CL_CDS_TEST_ENVIRONMENT and passes.