Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
56 lines
2.2 KiB
Markdown
56 lines
2.2 KiB
Markdown
# 1. Goal
|
|
Show the waste collection cost for each district and waste type in an ALV list.
|
|
The waste team uses the list to compare the costs of a period.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Table {{P}}PICKUP exists in package $TMP. It contains data.
|
|
Fields: PICKUP_ID (INT4, key), DISTRICT (CHAR 4), WASTE_TYPE (CHAR 10),
|
|
PICKUP_DATE (DATS), WEIGHT_KG (DEC 15,2).
|
|
- Table {{P}}PRICE exists in package $TMP. It contains data.
|
|
Fields: WASTE_TYPE (CHAR 10, key), PRICE_PER_KG (DEC 15,2).
|
|
|
|
# 4. Contract
|
|
- Create the executable program {{P}}WASTE_COST in package $TMP.
|
|
- Selection screen:
|
|
- Parameter P_FROM, type DATS, mandatory: the first pickup date to include.
|
|
- Parameter P_TO, type DATS, mandatory: the last pickup date to include.
|
|
- Select-option S_DIST for the district.
|
|
- Show the result with CL_SALV_TABLE. The output table has these columns, with
|
|
these names and these types:
|
|
- DISTRICT, type {{P}}PICKUP-DISTRICT.
|
|
- WASTE_TYPE, type {{P}}PICKUP-WASTE_TYPE.
|
|
- WEIGHT, type {{P}}PICKUP-WEIGHT_KG.
|
|
- COST, type {{P}}PRICE-PRICE_PER_KG.
|
|
|
|
# 5. Business rules
|
|
1. Include a pickup only if PICKUP_DATE is on or after P_FROM and on or before
|
|
P_TO.
|
|
2. Include a pickup only if its DISTRICT is in S_DIST. If S_DIST is empty,
|
|
include every district.
|
|
3. The cost of a pickup is WEIGHT_KG multiplied by the PRICE_PER_KG of its
|
|
waste type. Each waste type in {{P}}PICKUP has exactly one row in
|
|
{{P}}PRICE.
|
|
4. Show one line for each combination of DISTRICT and WASTE_TYPE that has at
|
|
least one included pickup.
|
|
5. WEIGHT is the sum of the WEIGHT_KG values of the included pickups of the
|
|
line.
|
|
6. COST is the sum of the costs of the included pickups of the line. Round
|
|
COST to 2 decimal places. Round half up.
|
|
7. Sort the lines by COST, the highest cost first. If two lines have the same
|
|
COST, sort them by DISTRICT in ascending order and then by WASTE_TYPE in
|
|
ascending order.
|
|
8. If no pickup is included, the list is empty.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: Clean ABAP. Read the data with one database access.
|
|
- Out of scope: do not change {{P}}PICKUP and {{P}}PRICE.
|
|
|
|
# 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.
|