53 lines
2.2 KiB
Markdown
53 lines
2.2 KiB
Markdown
# 1. Goal
|
|
A vineyard cooperative collects the harvest reports of its members. The
|
|
cooperative needs one evaluation of the harvest for each grape variety. A
|
|
planning program calls the evaluation before it plans the transport of the
|
|
grapes to the winery.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The interface {{P}}IF_HARVEST exists in package $TMP. It is active.
|
|
- The interface contains the data types for the harvest reports, for the member
|
|
master data, and for the result. Read the interface before you start to work.
|
|
- A harvest report has a member, a grape variety, and a quantity in kilograms.
|
|
- The member master data has a member ID and a member name.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}HARVEST_EVALUATOR in package $TMP.
|
|
- The class is public and final. It has a public constructor without
|
|
parameters.
|
|
- The class has one public method:
|
|
EVALUATE
|
|
IMPORTING it_report TYPE {{P}}IF_HARVEST=>TT_REPORT
|
|
it_member TYPE {{P}}IF_HARVEST=>TT_MEMBER
|
|
RETURNING VALUE(rt_result) TYPE {{P}}IF_HARVEST=>TT_RESULT.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
A harvest report is countable when rule 1 and rule 2 are true.
|
|
1. The member_id of the report occurs in it_member. A member_id occurs at most
|
|
one time in it_member.
|
|
2. The quantity_kg of the report is greater than 0.
|
|
3. Group the countable reports by variety. Create one result row for each
|
|
variety that has at least one countable report.
|
|
4. The total_kg of a result row is the sum of the quantity_kg of all countable
|
|
reports of the variety.
|
|
5. The member_count of a result row is the number of different member_id
|
|
values in the countable reports of the variety.
|
|
6. Sort the result rows by total_kg in descending order. When two rows have the
|
|
same total_kg, sort these rows by variety in ascending order.
|
|
7. When no report is countable, return an empty table.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
|
variables. No comment that restates the code.
|
|
- Out of scope: do not change {{P}}IF_HARVEST.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the class.
|