Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
1.7 KiB
1.7 KiB
1. Goal
A cleaning company bills its customers for cleaning jobs. Each job belongs to a site. Show the total cost and the total work hours of each site. A report will read the figures, so the calculation must be in the database, in a CDS view.
2. Open questions
None.
3. Context
- Table {{P}}CLN_JOB, package $TMP. One row for each cleaning job of a site.
- View entity {{P}}I_JOB_COST, package $TMP. One row for each cleaning job that counts for billing. The view shows the work hours and the cost of each job. Read {{P}}I_JOB_COST to learn which jobs count for billing and how the cost of a job is calculated.
- A job counts for billing if {{P}}I_JOB_COST shows it.
4. Contract
- Create the CDS view entity {{P}}I_SITE_COST in package $TMP.
- The view must be defined on the table {{P}}CLN_JOB. {{P}}I_JOB_COST must not be used as a data source of the new view.
- Elements, with these names: SITE_ID (key), JOB_COUNT, TOTAL_HOURS, TOTAL_COST.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- Show one row for each site that has at least one job that counts for billing. Do not show a site without such a job.
- JOB_COUNT is the number of jobs of the site that count for billing.
- TOTAL_HOURS is the sum of the work hours of these jobs.
- TOTAL_COST is the sum of the cost of these jobs, with 2 decimals.
6. Constraints
- Release target: 8.16.
- Out of scope: do not change {{P}}CLN_JOB and {{P}}I_JOB_COST.
- Do not use SAP application module data.
7. Acceptance
- The view is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class. Create the test environment for the CDS entity {{P}}I_SITE_COST.