Snapshot: new training tasks (balanced generation), docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:08:59 +02:00
parent eb13453097
commit 6984fc7917
572 changed files with 30024 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
hire_id : abap.numc(10) not null;
kiosk_id : abap.char(6) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int4;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,2);
currency_code : abap.cuky;
customer_name : abap.char(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
key hire_id : abap.numc(10) not null;
kiosk_id : abap.char(5) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int4;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,2);
currency_code : abap.cuky;
customer_name : abap.char(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
key hire_id : abap.numc(10) not null;
kiosk_id : abap.char(6) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int8;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,2);
currency_code : abap.cuky;
customer_name : abap.char(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
key hire_id : abap.numc(10) not null;
kiosk_id : abap.char(6) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int4;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,3);
currency_code : abap.cuky;
customer_name : abap.char(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
key hire_id : abap.numc(10) not null;
kiosk_id : abap.char(6) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int4;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,2);
currency_code : abap.cuky;
customer_name : abap.numc(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,24 @@
{
"id": "G1911",
"pool": "train",
"object_type": "TABL",
"category": "B",
"attempts": [
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,231 @@
CLASS {{p}}hire_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS get_fields RETURNING VALUE(rt_fields) TYPE dfies_table.
METHODS field_of
IMPORTING iv_name TYPE fieldname
RETURNING VALUE(rs_field) TYPE dfies.
METHODS is_key
IMPORTING iv_name TYPE fieldname
RETURNING VALUE(rv_is_key) TYPE abap_bool.
METHODS is_not_null
IMPORTING iv_name TYPE fieldname
RETURNING VALUE(rv_not_null) TYPE abap_bool.
METHODS fields_exist FOR TESTING.
METHODS key_fields FOR TESTING.
METHODS not_null_fields FOR TESTING.
METHODS lengths_in_chars FOR TESTING.
METHODS decimals_of_rate FOR TESTING.
METHODS field_types FOR TESTING.
METHODS insert_and_read FOR TESTING.
METHODS duplicate_key FOR TESTING.
METHODS select_by_kiosk FOR TESTING.
ENDCLASS.
CLASS {{p}}hire_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create(
i_dependency_list = VALUE #( ( '{{P}}HIRE' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD get_fields.
DATA(lo_struct) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}HIRE' ) ).
rt_fields = lo_struct->get_ddic_field_list( ).
ENDMETHOD.
METHOD field_of.
DATA(lt_fields) = get_fields( ).
READ TABLE lt_fields INTO rs_field WITH KEY fieldname = iv_name.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( msg = |The field { iv_name } is missing| ).
ENDIF.
ENDMETHOD.
METHOD is_key.
DATA(ls_field) = field_of( iv_name ).
IF ls_field-keyflag = 'X'.
rv_is_key = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_not_null.
DATA(ls_field) = field_of( iv_name ).
ASSIGN COMPONENT 'NOTNULL' OF STRUCTURE ls_field TO FIELD-SYMBOL(<lv_flag>).
IF sy-subrc <> 0.
ASSIGN COMPONENT 'NOT_NULL' OF STRUCTURE ls_field TO <lv_flag>.
ENDIF.
IF sy-subrc = 0.
IF <lv_flag> = 'X'.
rv_not_null = abap_true.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD fields_exist.
DATA(lt_fields) = get_fields( ).
cl_abap_unit_assert=>assert_equals( exp = 11 act = lines( lt_fields ) ).
DATA lt_names TYPE STANDARD TABLE OF fieldname WITH EMPTY KEY.
lt_names = VALUE #( ( 'CLIENT' ) ( 'HIRE_ID' ) ( 'KIOSK_ID' )
( 'HIRE_DATE' ) ( 'ITEM_TYPE' ) ( 'ITEM_COUNT' )
( 'HIRE_DAYS' ) ( 'DAILY_RATE' ) ( 'CURRENCY_CODE' )
( 'CUSTOMER_NAME' ) ( 'IS_RETURNED' ) ).
LOOP AT lt_names INTO DATA(lv_name).
READ TABLE lt_fields TRANSPORTING NO FIELDS WITH KEY fieldname = lv_name.
cl_abap_unit_assert=>assert_equals(
exp = 0 act = sy-subrc msg = |The field { lv_name } is missing| ).
ENDLOOP.
ENDMETHOD.
METHOD key_fields.
cl_abap_unit_assert=>assert_equals( exp = abap_true act = is_key( 'CLIENT' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = is_key( 'HIRE_ID' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_key( 'KIOSK_ID' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_key( 'HIRE_DATE' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_key( 'DAILY_RATE' ) ).
ENDMETHOD.
METHOD not_null_fields.
DATA(ls_field) = field_of( 'KIOSK_ID' ).
ASSIGN COMPONENT 'NOTNULL' OF STRUCTURE ls_field TO FIELD-SYMBOL(<lv_flag>).
IF sy-subrc <> 0.
RETURN.
ENDIF.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = <lv_flag> ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = is_not_null( 'HIRE_ID' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = is_not_null( 'HIRE_DATE' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_not_null( 'ITEM_TYPE' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_not_null( 'DAILY_RATE' ) ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = is_not_null( 'CUSTOMER_NAME' ) ).
ENDMETHOD.
METHOD lengths_in_chars.
DATA(ls_field) = field_of( 'CLIENT' ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'HIRE_ID' ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'KIOSK_ID' ).
cl_abap_unit_assert=>assert_equals( exp = 6 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'HIRE_DATE' ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'ITEM_TYPE' ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'ITEM_COUNT' ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'HIRE_DAYS' ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'DAILY_RATE' ).
cl_abap_unit_assert=>assert_equals( exp = 13 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'CURRENCY_CODE' ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'CUSTOMER_NAME' ).
cl_abap_unit_assert=>assert_equals( exp = 30 act = CONV i( ls_field-leng ) ).
ls_field = field_of( 'IS_RETURNED' ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = CONV i( ls_field-leng ) ).
ENDMETHOD.
METHOD decimals_of_rate.
DATA(ls_field) = field_of( 'DAILY_RATE' ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = CONV i( ls_field-decimals ) ).
ls_field = field_of( 'ITEM_COUNT' ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = CONV i( ls_field-decimals ) ).
ls_field = field_of( 'HIRE_DAYS' ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = CONV i( ls_field-decimals ) ).
ENDMETHOD.
METHOD field_types.
DATA(ls_field) = field_of( 'CLIENT' ).
cl_abap_unit_assert=>assert_equals( exp = 'CLNT' act = ls_field-datatype ).
ls_field = field_of( 'HIRE_ID' ).
cl_abap_unit_assert=>assert_equals( exp = 'NUMC' act = ls_field-datatype ).
ls_field = field_of( 'KIOSK_ID' ).
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
ls_field = field_of( 'HIRE_DATE' ).
cl_abap_unit_assert=>assert_equals( exp = 'DATS' act = ls_field-datatype ).
ls_field = field_of( 'ITEM_TYPE' ).
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
ls_field = field_of( 'ITEM_COUNT' ).
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
ls_field = field_of( 'HIRE_DAYS' ).
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
ls_field = field_of( 'DAILY_RATE' ).
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = ls_field-datatype(3) ).
ls_field = field_of( 'CURRENCY_CODE' ).
cl_abap_unit_assert=>assert_equals( exp = 'CUKY' act = ls_field-datatype ).
ls_field = field_of( 'CUSTOMER_NAME' ).
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
ls_field = field_of( 'IS_RETURNED' ).
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
ENDMETHOD.
METHOD insert_and_read.
DATA lt_hire TYPE STANDARD TABLE OF {{p}}hire WITH EMPTY KEY.
DATA lv_date TYPE d.
DATA lv_curr TYPE c LENGTH 5.
lv_date = '20250701'.
lv_curr = 'EUR'.
lt_hire = VALUE #(
( hire_id = '0000000001' kiosk_id = 'K1' hire_date = '20250701'
item_type = 'CHAI' item_count = 2 hire_days = 3
daily_rate = '4.50' currency_code = 'EUR'
customer_name = 'SMITH' is_returned = 'X' )
( hire_id = '0000000002' kiosk_id = 'K2' hire_date = '20250702'
item_type = 'PARA' item_count = 1 hire_days = 1
daily_rate = '6.00' currency_code = 'EUR'
customer_name = 'JONES' is_returned = ' ' ) ).
go_env->insert_test_data( lt_hire ).
SELECT SINGLE hire_id, kiosk_id, hire_date, item_type, item_count,
hire_days, daily_rate, currency_code, customer_name,
is_returned
FROM {{p}}hire
WHERE hire_id = '0000000001'
INTO @DATA(ls_hire).
cl_abap_unit_assert=>assert_equals( exp = '0000000001' act = ls_hire-hire_id ).
cl_abap_unit_assert=>assert_equals( exp = 'K1' act = ls_hire-kiosk_id ).
cl_abap_unit_assert=>assert_equals( exp = lv_date act = ls_hire-hire_date ).
cl_abap_unit_assert=>assert_equals( exp = 'CHAI' act = ls_hire-item_type ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_hire-item_count ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_hire-hire_days ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.50' )
act = CONV decfloat34( ls_hire-daily_rate ) ).
cl_abap_unit_assert=>assert_equals( exp = lv_curr act = ls_hire-currency_code ).
cl_abap_unit_assert=>assert_equals( exp = 'SMITH' act = ls_hire-customer_name ).
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_hire-is_returned ).
ENDMETHOD.
METHOD duplicate_key.
DATA ls_hire TYPE {{p}}hire.
ls_hire-hire_id = '0000000009'.
ls_hire-kiosk_id = 'K9'.
ls_hire-hire_date = '20250703'.
INSERT {{p}}hire FROM @ls_hire.
INSERT {{p}}hire FROM @ls_hire.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
METHOD select_by_kiosk.
DATA lt_hire TYPE STANDARD TABLE OF {{p}}hire WITH EMPTY KEY.
lt_hire = VALUE #(
( hire_id = '0000000011' kiosk_id = 'K1' hire_date = '20250704' )
( hire_id = '0000000012' kiosk_id = 'K1' hire_date = '20250704' )
( hire_id = '0000000013' kiosk_id = 'K2' hire_date = '20250704' ) ).
go_env->insert_test_data( lt_hire ).
SELECT COUNT(*) FROM {{p}}hire WHERE kiosk_id = 'K1' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,58 @@
{
"task": "G1911",
"mutants": [
{
"object": "{{P}}HIRE",
"mutant": "line 8: key hire_id : -> hire_id : (key)",
"status": "killed",
"hidden": "6/9",
"failed_tests": [
"INSERT_AND_READ",
"KEY_FIELDS",
"SELECT_BY_KIOSK"
]
},
{
"object": "{{P}}HIRE",
"mutant": "line 9: abap.char(6) -> abap.char(5) (length)",
"status": "killed",
"hidden": "8/9",
"failed_tests": [
"LENGTHS_IN_CHARS"
]
},
{
"object": "{{P}}HIRE",
"mutant": "line 12: abap.int4 -> abap.int8 (type)",
"status": "killed",
"hidden": "7/9",
"failed_tests": [
"FIELD_TYPES",
"LENGTHS_IN_CHARS"
]
},
{
"object": "{{P}}HIRE",
"mutant": "line 15: abap.dec(13,2) -> abap.dec(13,3) (decimals)",
"status": "killed",
"hidden": "8/9",
"failed_tests": [
"DECIMALS_OF_RATE"
]
},
{
"object": "{{P}}HIRE",
"mutant": "line 17: abap.char(30) -> abap.numc(30) (type)",
"status": "killed",
"hidden": "7/9",
"failed_tests": [
"FIELD_TYPES",
"INSERT_AND_READ"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Beach item hire'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}hire {
key client : abap.clnt not null;
key hire_id : abap.numc(10) not null;
kiosk_id : abap.char(6) not null;
hire_date : abap.dats not null;
item_type : abap.char(4);
item_count : abap.int4;
hire_days : abap.int4;
@Semantics.amount.currencyCode : '{{p}}hire.currency_code'
daily_rate : abap.dec(13,2);
currency_code : abap.cuky;
customer_name : abap.char(30);
is_returned : abap.char(1);
}

View File

@@ -0,0 +1,76 @@
CLASS {{p}}hire_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS structure_ok FOR TESTING.
METHODS stores_and_reads FOR TESTING.
METHODS duplicate_is_rejected FOR TESTING.
ENDCLASS.
CLASS {{p}}hire_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create(
i_dependency_list = VALUE #( ( '{{P}}HIRE' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD structure_ok.
DATA(lo_struct) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}HIRE' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 11 act = lines( lt_fields ) ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = 'HIRE_ID'.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
ENDMETHOD.
METHOD stores_and_reads.
DATA ls_hire TYPE {{p}}hire.
DATA lt_hire TYPE STANDARD TABLE OF {{p}}hire WITH EMPTY KEY.
ls_hire-hire_id = '0000000001'.
ls_hire-kiosk_id = 'K1'.
ls_hire-hire_date = '20250701'.
ls_hire-item_type = 'CHAI'.
ls_hire-item_count = 2.
ls_hire-hire_days = 3.
ls_hire-daily_rate = '4.50'.
ls_hire-currency_code = 'EUR'.
ls_hire-customer_name = 'SMITH'.
ls_hire-is_returned = 'X'.
APPEND ls_hire TO lt_hire.
go_env->insert_test_data( lt_hire ).
SELECT SINGLE kiosk_id, item_count, hire_days, daily_rate, is_returned
FROM {{p}}hire
WHERE hire_id = '0000000001'
INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_equals( exp = 'K1' act = ls_read-kiosk_id ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_read-item_count ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_read-hire_days ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.50' )
act = CONV decfloat34( ls_read-daily_rate ) ).
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_read-is_returned ).
ENDMETHOD.
METHOD duplicate_is_rejected.
DATA ls_hire TYPE {{p}}hire.
ls_hire-hire_id = '0000000002'.
ls_hire-kiosk_id = 'K2'.
ls_hire-hire_date = '20250702'.
INSERT {{p}}hire FROM @ls_hire.
INSERT {{p}}hire FROM @ls_hire.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,78 @@
# 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.

View File

@@ -0,0 +1,56 @@
{
"id": "G1911",
"category": "B",
"object_type": "TABL",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [],
"contract": [
{
"type": "TABL",
"name": "{{P}}HIRE",
"fields": [
"client",
"hire_id",
"kiosk_id",
"hire_date",
"item_type",
"item_count",
"hire_days",
"daily_rate",
"currency_code",
"customer_name",
"is_returned"
]
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}HIRE_HIDDEN",
"file": "hidden/hire_hidden.clas.abap",
"description": "Structure (RTTI) and data access (OSQL test double) tests for the table"
}
],
"reference": [
{
"type": "TABL",
"name": "{{P}}HIRE",
"file": "reference/hire.tabl.asabap",
"description": "Beach item hire table"
},
{
"type": "CLAS",
"name": "{{P}}HIRE_TEST",
"file": "reference/hire_test.clas.abap",
"description": "Own ABAP Unit tests for the table"
}
],
"craft_checks": []
}