Files
abap-llm/tasks_gen/train/G1100/spec.md
2026-10-05 18:02:52 +02:00

48 lines
2.0 KiB
Markdown

# 1. Goal
A marina rents berths to boat owners. The fee of a berth depends on the pier
and on the length of the boat. A report and an OData service will read the
fees. Therefore the calculation must be in the database, in a CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}BERTH (berth booking), package $TMP. Key: BERTH_ID (CHAR 10).
Fields: BOAT_NAME (CHAR 12), LENGTH_M (DEC 6,2, the length of the boat in
metres), PIER_CODE (CHAR 1), SHORE_POWER (CHAR 1, 'Y' = the boat uses shore
power, 'N' = it does not), STAY_DAYS (INT4, the number of days of the
booking).
- Table {{P}}PIER (pier rate), package $TMP. Key: PIER_CODE (CHAR 1).
Fields: BASE_FEE (DEC 10,2, for one day), RATE_PER_M (DEC 10,2, for one metre
and one day), POWER_FEE (DEC 10,2, for one day of shore power).
# 4. Contract
- Create the CDS view entity {{P}}I_BERTH_FEE in package $TMP.
- Elements, with these names: BERTH_ID (key), BOAT_NAME, SIZE_CLASS, LENGTH_CM,
TOTAL_FEE.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each berth booking that has a pier in {{P}}PIER. Do not show
a booking whose PIER_CODE is not in {{P}}PIER.
2. SIZE_CLASS is 'SMALL' if LENGTH_M is less than 8.00. SIZE_CLASS is 'MEDIUM'
if LENGTH_M is 8.00 or more and 15.00 or less. SIZE_CLASS is 'LARGE' if
LENGTH_M is more than 15.00.
3. LENGTH_CM is the length of the boat in whole centimetres.
4. The fee for one day is the base fee of the pier plus LENGTH_M multiplied by
the rate per metre of the pier. If SHORE_POWER is 'Y', add the power fee of
the pier. Do not round this value yet.
5. TOTAL_FEE is the fee for one day multiplied by STAY_DAYS, rounded to 2
decimals.
6. BOAT_NAME is the name of the boat.
# 6. Constraints
- Release target: 7.58.
- Use Clean ABAP. Keep every method below 40 statements.
- Out of scope: do not change {{P}}BERTH and {{P}}PIER.
# 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.