64 lines
2.7 KiB
Markdown
64 lines
2.7 KiB
Markdown
# 1. Goal
|
|
A winery records the grape harvest of each picking. The cellar team needs one
|
|
database table for these records. The table stores the vineyard, the grape
|
|
variety, the picking date, the number of crates, the weight and the quality
|
|
grade of each picking.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Package: $TMP.
|
|
- The table is a new object. No other object exists.
|
|
- One harvest record belongs to exactly one vineyard and one grape variety.
|
|
- The winery stores the weight of a picking in kilograms.
|
|
|
|
# 4. Contract
|
|
- Create the transparent database table {{P}}GRH in package $TMP.
|
|
- Field names, in this order: client, harvest_id, vineyard_id, grape,
|
|
harvest_date, crates, weight_kg, grade, organic.
|
|
- Key fields: client and harvest_id.
|
|
|
|
# 5. Business rules
|
|
1. client is the client field (abap.clnt, length 3). It is a key field. It must
|
|
not be null.
|
|
2. harvest_id identifies one picking (abap.char, length 10). It is a key field.
|
|
It must not be null.
|
|
3. vineyard_id identifies the vineyard (abap.char, length 8). It is not a key
|
|
field. It must not be null.
|
|
4. grape holds the name of the grape variety (abap.char, length 12). It is not
|
|
a key field.
|
|
5. harvest_date holds the date of the picking (abap.dats). It is not a key
|
|
field.
|
|
6. crates holds the number of crates that the picking filled (abap.int4). It is
|
|
not a key field.
|
|
7. weight_kg holds the weight of the picking in kilograms (abap.dec, length 13,
|
|
3 decimal places). It is not a key field.
|
|
8. grade holds the quality grade of the picking (abap.char, length 2). It is
|
|
not a key field.
|
|
9. organic holds 'X' when the vineyard is organic (abap.char, length 1). It is
|
|
not a key field.
|
|
10. The table stores one record for each value pair of client and harvest_id. A
|
|
second record with the same client and the same harvest_id must not be
|
|
stored. The database rejects the second record: the statement that stores
|
|
it raises an exception of the class CX_SY_OPEN_SQL_DB, and the first record
|
|
stays in the table.
|
|
11. A stored record can be read again with all its values.
|
|
|
|
# 6. Constraints
|
|
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
|
- The table is transparent. Create it as a DDL source in package $TMP with the
|
|
annotations @EndUserText.label, @AbapCatalog.enhancement.category :
|
|
#NOT_EXTENSIBLE, @AbapCatalog.tableCategory : #TRANSPARENT,
|
|
@AbapCatalog.deliveryClass : #A and @AbapCatalog.dataMaintenance :
|
|
#RESTRICTED.
|
|
- Coding standards: Clean ABAP.
|
|
- Out of scope: do not create any other object. Do not create a CDS view, a
|
|
report or a class other than the test class.
|
|
|
|
# 7. Acceptance
|
|
- The table is active.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests in a global test class. The tests use
|
|
CL_OSQL_TEST_ENVIRONMENT.
|