2.1 KiB
2.1 KiB
1. Goal
The farm shop of a cooperative sells its own vegetables, fruit and dairy goods. The report {{P}}FARM_SHOP_OLD shows the turnover of one day, grouped by product group. The report is in production, but its code is outdated and hard to maintain. Refactor the report in place: same name, same selection screen, same output. The behavior stays the same.
2. Open questions
None.
3. Context
- {{P}}FARM_SHOP_OLD is an executable program in package $TMP. It is active.
- The report reads the tables {{P}}GOODS and {{P}}GDSALE. Both tables are in
package $TMP and contain data.
- {{P}}GOODS: GOODS_ID (CHAR 4, key), GRP_CODE (CHAR 4), UNIT_PRICE (DEC 15,2).
- {{P}}GDSALE: SALE_ID (INT4, key), GOODS_ID (CHAR 4), SALE_DAY (DATS), QTY (INT2), SALE_STATE (CHAR 1).
- The report writes the result with CL_SALV_TABLE.
- The legacy implementation is the only specification of the rules. Read it.
4. Contract
- The program {{P}}FARM_SHOP_OLD stays in package $TMP. Do not rename it.
- The selection screen stays the same:
- Parameter P_DAY, type DATS, mandatory.
- Select-option S_GRP for the product group.
- The ALV list keeps these columns, with these names: GRP_CODE, SALES, TURNOVER, PCT_SHARE.
5. Business rules
The behavior of the report stays the same. The legacy code is the only specification. Keep every result exactly as it is today: the same rows, the same values, the same order, the same filters.
6. Constraints
- Release target: 8.16 (SAP_BASIS 816, ABAP Platform 2025).
- Coding standards: Clean ABAP. Methods below 40 statements. No obsolete language elements. No database access inside a loop. No header-line tables. Never mix old and new ABAP SQL syntax in one statement.
- Out of scope: do not change {{P}}GOODS and {{P}}GDSALE. Do not change the selection screen. Do not change the names of the output columns.
7. Acceptance
- {{P}}FARM_SHOP_OLD is active and has no syntax error.
- The behavior of the report is unchanged.
- The hidden tests pass.
- ATC reports no finding of priority 1 or 2.
- Write ABAP Unit tests as local test classes in the program.