Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
2.0 KiB
2.0 KiB
1. Goal
Show the harvest weight of each grape variety in an ALV list. The winery uses the list to compare the varieties for a period.
2. Open questions
None.
3. Context
- Table {{P}}GRAPE exists in package $TMP. It contains data. Fields: VARIETY (CHAR 4, key), NAME (CHAR 40).
- Table {{P}}HARVEST exists in package $TMP. It contains data. Fields: HARVEST_ID (INT4, key), VARIETY (CHAR 4), HARVEST_DATE (DATS), WEIGHT_KG (DEC 13,3).
4. Contract
- Create the executable program {{P}}VINEYARD_RPT in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first harvest date to include.
- Select-option S_VAR for the variety.
- Show the result with CL_SALV_TABLE. The output table has these columns, with these names: VARIETY, NAME, TOTAL_KG (the sum of WEIGHT_KG), HARVESTS (the number of harvests).
5. Business rules
- Include a harvest only if HARVEST_DATE is on or after P_FROM and VARIETY is in S_VAR. An empty S_VAR does not restrict the variety.
- Show a variety only if it has an entry in {{P}}GRAPE. A variety with harvests but without an entry in {{P}}GRAPE is not shown.
- Show one line for each variety with at least one included harvest.
- NAME is the name of the variety from {{P}}GRAPE.
- Sort the lines by TOTAL_KG, the highest total first.
6. Constraints
- Release target: 7.02. Use only ABAP syntax that is available in release 7.02. Do not use syntax elements that were introduced in a later release. Examples of syntax that you must not use: inline declarations, constructor expressions (NEW, VALUE, CONV), string templates, table expressions, SQL expressions and SQL aggregate functions, GROUP BY, UNION, the escape character @ in ABAP SQL, WITH EMPTY KEY.
- Coding standards: Clean ABAP. Do not read the database inside a loop.
- Out of scope: do not change {{P}}GRAPE or {{P}}HARVEST.
7. Acceptance
- The program is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests as local test classes in the program.