Files

40 lines
1.4 KiB
Markdown

# 1. Goal
Show the grade of each tree sapling in a plant nursery. A report and an OData
service will read the grades, so the calculation must be in the database, in a
CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}PLANT (tree sapling), package $TMP. Key: TREE_ID (CHAR 10).
Fields: SPECIES (CHAR 20), HEIGHT_CM (INT4, the height in centimetres).
# 4. Contract
- Create the CDS view entity {{P}}I_PLANT_GRADE in package $TMP.
- Elements, with these names: TREE_ID (key), SPECIES, HEIGHT_M, GRADE,
GRADE_TEXT.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each tree sapling. Do not add rows and do not remove rows.
2. SPECIES is the species of the sapling.
3. HEIGHT_M is the height in metres with 2 decimals. Example: 150 cm is
1.50 m.
4. GRADE is the size class of the sapling:
- 'S' when the height is less than 100 cm.
- 'M' when the height is 100 cm or more and less than 200 cm.
- 'L' when the height is 200 cm or more.
5. GRADE_TEXT is the grade, then a hyphen, then the species. Example: a pine
sapling of grade 'L' has the text 'L-PINE'.
# 6. Constraints
- Release target: 7.58.
- Coding standards: Clean ABAP. Use a CDS view entity, not a database view.
- Out of scope: do not change {{P}}PLANT.
# 7. Acceptance
- The view {{P}}I_PLANT_GRADE 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.