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

3.4 KiB

1. Goal

A beach kiosk hires out beach chairs and parasols to holidaymakers. The kiosk needs one database table that stores every hire. A report and an OData service will read this table later, so the table is the only object of this task.

2. Open questions

None.

3. Context

  • The table is new. It has no data and no other object uses it yet.
  • One hire is one row of the table.
  • hire_id is the number of the hire receipt.
  • kiosk_id identifies the kiosk that made the hire.
  • hire_date is the day of the hire.
  • item_type is the code of the hired item: 'CHAI' is a beach chair and 'PARA' is a parasol.
  • item_count is the number of hired items.
  • hire_days is the number of days of the hire.
  • daily_rate is the price of one item for one day, in the currency currency_code.
  • customer_name is the name of the customer.
  • is_returned is 'X' when the customer returned the items and ' ' when the items are still out.
  • All objects are in package $TMP.

4. Contract

  • Create the transparent database table {{P}}HIRE in package $TMP.
  • The table has these 11 fields, with these names (lower case): client, hire_id, kiosk_id, hire_date, item_type, item_count, hire_days, daily_rate, currency_code, customer_name, is_returned.
  • The data types, the key fields and the not-null fields are fixed by rule 1 of section 5.

5. Business rules

  1. The table has exactly these fields, in this order:

    Field Type and length Key Not null
    client abap.clnt yes yes
    hire_id abap.numc(10) yes yes
    kiosk_id abap.char(6) no yes
    hire_date abap.dats no yes
    item_type abap.char(4) no no
    item_count abap.int4 no no
    hire_days abap.int4 no no
    daily_rate abap.dec(13,2) no no
    currency_code abap.cuky no no
    customer_name abap.char(30) no no
    is_returned abap.char(1) no no
  2. client and hire_id are the key of the table. Two rows with the same client and the same hire_id are not allowed.

  3. client, hire_id, kiosk_id and hire_date are not null. All other fields can be empty.

  4. daily_rate is an amount with 2 decimals in the currency currency_code. item_count and hire_days are whole numbers.

  5. A row that was inserted can be read again with the same field values.

  6. Rows can be selected by kiosk_id.

6. Constraints

  • Release target: SAP_BASIS 816 (ABAP Platform 2025), client 001.
  • Coding standards: Clean ABAP. Create the table as a DDL source with "define table ..." and the annotations @EndUserText.label, @AbapCatalog.enhancement.category : #NOT_EXTENSIBLE, @AbapCatalog.tableCategory : #TRANSPARENT, @AbapCatalog.deliveryClass : #A and @AbapCatalog.dataMaintenance : #RESTRICTED.
  • daily_rate is an amount in the currency currency_code, so it needs the currency reference to currency_code.
  • Out of scope: no CDS view, no report, no function module, no class other than the test class for your own ABAP Unit tests.

7. Acceptance

  • The table {{P}}HIRE is active and has no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests in a global test class in package $TMP. Check the structure of the table with cl_abap_typedescr and the data access with cl_osql_test_environment.