# 1. Goal Refactor the legacy report {{P}}BAKERY_BILL_OLD in package $TMP. A bakery bills its shops for the bread and the rolls that it delivered in a period. The report must keep its behavior and become maintainable. # 2. Open questions None. # 3. Context - The report {{P}}BAKERY_BILL_OLD is active in package $TMP. It is legacy code. - The report reads the tables {{P}}SHOP and {{P}}DELIV. Both tables contain data. - The report shows an ALV list. # 4. Contract - Keep the report {{P}}BAKERY_BILL_OLD in package $TMP. Keep the name. - Keep the selection screen: - Parameter P_FROM, type DATS, mandatory: the first delivery date to include. - Parameter P_TO, type DATS, mandatory: the last delivery date to include. - Select-option S_SHOP for the shop. - Keep the ALV output. The output table has these columns, with these names: SHOP_ID, SHOP_NAME, LOAVES, ROLLS, TOTAL. # 5. Business rules The behavior stays the same. The legacy code contains the rules. Read the legacy code and keep every rule, every filter and every value. Do not change the selection screen, the output columns or the result rows. # 6. Constraints - Release target: 8.16. - Coding standards: Clean ABAP. - Quality goals: - Read each of the two tables with one database access. - Do not use a nested loop over the two tables. The runtime must grow with the number of rows, not with the product of the rows. - Do not use obsolete language elements. No FORM routines, no header-line tables, no SELECT *. - Put the logic in a local class. Keep every method below 40 statements. - Out of scope: do not change the tables {{P}}SHOP and {{P}}DELIV. # 7. Acceptance - The report is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests as local test classes in the program.