Files
2026-10-05 22:08:59 +02:00

2.6 KiB

1. Goal

The coffee roastery "Ember Roast" records every roast batch in the database table {{P}}ROAST. A report and an OData service read the roast batches into an internal table. The line type of this internal table is the structure {{P}}ROAST_RESULT. Create the two structures that the report and the OData service need.

2. Open questions

None.

3. Context

  • Table {{P}}ROAST (roast batch log), package $TMP. The table is in the system. Key fields: CLIENT (CLNT 3), SITE (CHAR 4), BATCH_NO (CHAR 10). Other fields: ROAST_DAY (DATS), GREEN_KG (DEC 9,3), ROASTED_KG (DEC 9,3), ROAST_LEVEL (CHAR 1), ROAST_MIN (INT4), LOSS_PCT (DEC 5,2), ROASTER_ID (CHAR 8), CHECKED (CHAR 1).
  • The report and the OData service use the structure {{P}}ROAST_RESULT as the line type of their internal table.
  • The green coffee intake uses the structure {{P}}ROAST_BASE. It holds the five fields that every roast batch has in common.

4. Contract

  • Create the structure {{P}}ROAST_BASE in package $TMP.
  • Create the structure {{P}}ROAST_RESULT in package $TMP.
  • Fields of {{P}}ROAST_BASE, in this order: site, batch_no, roast_day, green_kg, roasted_kg.
  • Fields of {{P}}ROAST_RESULT, in this order: site, batch_no, roast_day, green_kg, roasted_kg, roast_level, roast_min, loss_pct, roaster_id, checked.

5. Business rules

  1. The structure {{P}}ROAST_BASE has exactly five fields. The fields are, in this order: SITE (CHAR 4), BATCH_NO (CHAR 10), ROAST_DAY (DATS), GREEN_KG (DEC 9,3) and ROASTED_KG (DEC 9,3).
  2. The structure {{P}}ROAST_RESULT has exactly ten fields.
  3. The first five fields of {{P}}ROAST_RESULT have the same names, data types, lengths and number of decimals as the five fields of {{P}}ROAST_BASE, in the same order.
  4. The last five fields of {{P}}ROAST_RESULT are, in this order: ROAST_LEVEL (CHAR 1), ROAST_MIN (INT4), LOSS_PCT (DEC 5,2), ROASTER_ID (CHAR 8) and CHECKED (CHAR 1).
  5. GREEN_KG and ROASTED_KG have 3 decimals. LOSS_PCT has 2 decimals.
  6. The fields of the two structures have the same data types, lengths and number of decimals as the fields with the same names in the table {{P}}ROAST.

6. Constraints

  • Release target: ABAP Platform 2025 (SAP_BASIS 816).
  • Create both structures as DDL sources (define structure) in package $TMP.
  • Both structures are not extensible.
  • Out of scope: do not change {{P}}ROAST.

7. Acceptance

  • Both structures are active and have no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests in a global test class. The tests read the fields of both structures with RTTI and check the names, the data types, the lengths and the number of decimals.