Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# 1. Goal
|
|
A vehicle workshop plans the workload of its mechanics. A planning program calls
|
|
one service of the class {{P}}WORKLOAD_PLANNER. The service groups the open
|
|
repair jobs by mechanic and returns one row per mechanic.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The workshop receives the open repair jobs from an external planning system.
|
|
The start date arrives as a character field in the format YYYYMMDD.
|
|
- The class is new. No other object is in scope.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}WORKLOAD_PLANNER in package $TMP.
|
|
- The class is public and final. It has a public constructor without parameters.
|
|
- The class has these public types:
|
|
- ty_job with the components job_id (c LENGTH 10), mechanic (c LENGTH 8),
|
|
work_hours (i), start_date (c LENGTH 8).
|
|
- tt_job: a standard table of ty_job with an empty key.
|
|
- ty_workload with the components mechanic (c LENGTH 8), job_count (i),
|
|
total_hours (i), first_date (c LENGTH 8).
|
|
- tt_workload: a standard table of ty_workload with an empty key.
|
|
- The class has this public method:
|
|
summarize
|
|
IMPORTING it_jobs TYPE tt_job
|
|
RETURNING VALUE(rt_workload) TYPE tt_workload.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
1. A job is relevant if the job ID is not empty, the mechanic is not empty, and
|
|
the work hours are greater than zero. Ignore all other jobs.
|
|
2. Group the relevant jobs by mechanic.
|
|
3. The result has one row per mechanic:
|
|
- mechanic: the mechanic.
|
|
- job_count: the number of relevant jobs of this mechanic.
|
|
- total_hours: the sum of the work hours of these jobs.
|
|
- first_date: the earliest start date of these jobs.
|
|
4. A start date is set if it is not empty and if it is not 00000000. When you
|
|
determine the earliest date, consider only set dates. If no job of a mechanic
|
|
has a set date, first_date is empty.
|
|
5. Sort the result by mechanic in ascending order.
|
|
6. If no relevant job exists, 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 objects outside package $TMP.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the class.
|