Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged

- Static bundle checks (name length, seed type, reserved words, contract test classes,
  testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse
- Runner: G2 for CDS views with parameters, contract_check detail in report
- G0020 and G0013 fixed by review and revalidated (oracle 100, null 0)
- Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-03 05:04:23 +02:00
parent 15eb9f1bb2
commit 5de5e2851c
162 changed files with 9943 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
{
"id": "G0014",
"pool": "eval",
"object_type": "PROG",
"category": "B",
"attempts": [
{
"stage": "validate",
"oracle": 93.3,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0
}
],
"accepted": true
}

View File

@@ -0,0 +1,112 @@
CLASS {{p}}t15_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES tt_plant TYPE RANGE OF {{p}}movmt-plant.
METHODS run
IMPORTING iv_from TYPE d
iv_to TYPE d
it_plant TYPE tt_plant OPTIONAL
RETURNING VALUE(rr_data) TYPE REF TO data.
METHODS value_of
IMPORTING ir_data TYPE REF TO data
iv_row TYPE i
iv_col TYPE string
RETURNING VALUE(rv_value) TYPE string.
METHODS lines_of
IMPORTING ir_data TYPE REF TO data
RETURNING VALUE(rv_lines) TYPE i.
METHODS all_materials_in_range FOR TESTING.
METHODS receipt_and_issue_split FOR TESTING.
METHODS sorted_by_balance FOR TESTING.
METHODS plant_filter FOR TESTING.
METHODS date_range_filter FOR TESTING.
METHODS ignored_move_types FOR TESTING.
ENDCLASS.
CLASS {{p}}t15_hidden IMPLEMENTATION.
METHOD run.
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
SUBMIT {{p}}stock_bal
WITH p_from = iv_from
WITH p_to = iv_to
WITH s_plant IN it_plant
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ).
CATCH cx_salv_bs_sc_runtime_info.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
ENDMETHOD.
METHOD lines_of.
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
IF ir_data IS BOUND.
ASSIGN ir_data->* TO <lt_data>.
rv_lines = lines( <lt_data> ).
ENDIF.
ENDMETHOD.
METHOD value_of.
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
ASSIGN ir_data->* TO <lt_data>.
ASSIGN <lt_data>[ iv_row ] TO FIELD-SYMBOL(<ls_line>).
ASSIGN COMPONENT iv_col OF STRUCTURE <ls_line> TO FIELD-SYMBOL(<lv_value>).
cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ).
rv_value = condense( CONV string( <lv_value> ) ).
" The ALV data can show a negative number with a trailing sign.
DATA(lv_length) = strlen( rv_value ).
IF lv_length > 1 AND substring( val = rv_value off = lv_length - 1 len = 1 ) = '-'.
rv_value = '-' && substring( val = rv_value off = 0 len = lv_length - 1 ).
ENDIF.
ENDMETHOD.
METHOD all_materials_in_range.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `120` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BALANCE` ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-002` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `-20` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `BALANCE` ) ).
ENDMETHOD.
METHOD receipt_and_issue_split.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = `150` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `RECEIPT_QTY` ) ).
cl_abap_unit_assert=>assert_equals( exp = `30` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `ISSUE_QTY` ) ).
cl_abap_unit_assert=>assert_equals( exp = `40` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `RECEIPT_QTY` ) ).
cl_abap_unit_assert=>assert_equals( exp = `60` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `ISSUE_QTY` ) ).
ENDMETHOD.
METHOD sorted_by_balance.
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-004` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-002` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `MATERIAL` ) ).
ENDMETHOD.
METHOD plant_filter.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131'
it_plant = VALUE #( ( sign = 'I' option = 'EQ' low = '1000' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `70` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BALANCE` ) ).
ENDMETHOD.
METHOD date_range_filter.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260109' ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `100` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BALANCE` ) ).
cl_abap_unit_assert=>assert_equals( exp = `40` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `BALANCE` ) ).
ENDMETHOD.
METHOD ignored_move_types.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131'
it_plant = VALUE #( ( sign = 'I' option = 'EQ' low = '2000' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `MAT-001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MATERIAL` ) ).
cl_abap_unit_assert=>assert_equals( exp = `50` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `RECEIPT_QTY` ) ).
cl_abap_unit_assert=>assert_equals( exp = `0` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `ISSUE_QTY` ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,127 @@
REPORT {{p}}stock_bal.
DATA gv_plant TYPE {{p}}movmt-plant.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_plant FOR gv_plant.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
material TYPE {{p}}movmt-material,
receipt_qty TYPE i,
issue_qty TYPE i,
balance TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_plant TYPE RANGE OF {{p}}movmt-plant.
METHODS select_balances
IMPORTING iv_from TYPE d
iv_to TYPE d
it_plant TYPE tt_plant
RETURNING VALUE(rt_lines) TYPE tt_line.
METHODS display
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_balances.
SELECT material,
SUM( CASE WHEN move_type = '101' OR move_type = '201'
THEN quantity
ELSE 0 END ) AS receipt_qty,
SUM( CASE WHEN move_type = '261' OR move_type = '262'
THEN quantity
ELSE 0 END ) AS issue_qty
FROM {{p}}movmt
WHERE move_date >= @iv_from
AND move_date <= @iv_to
AND plant IN @it_plant
AND move_type IN ( '101', '201', '261', '262' )
GROUP BY material
INTO CORRESPONDING FIELDS OF TABLE @rt_lines.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-balance = <ls_line>-receipt_qty - <ls_line>-issue_qty.
ENDLOOP.
SORT rt_lines BY balance DESCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_lines ).
lo_alv->display( ).
CATCH cx_salv_msg INTO DATA(lx_error).
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA(go_report) = NEW lcl_report( ).
DATA(gt_lines) = go_report->select_balances( iv_from = p_from
iv_to = p_to
it_plant = s_plant[] ).
go_report->display( CHANGING ct_lines = gt_lines ).
CLASS ltc_report DEFINITION FINAL 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 balances_per_material FOR TESTING.
METHODS plant_filter FOR TESTING.
METHODS negative_balance FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}MOVMT' ) ) ).
DATA lt_movmt TYPE STANDARD TABLE OF {{p}}movmt WITH EMPTY KEY.
lt_movmt = VALUE #(
( move_id = 1 material = 'MAT-A' plant = '1000' move_date = '20260105' move_type = '101' quantity = 100 )
( move_id = 2 material = 'MAT-A' plant = '1000' move_date = '20260110' move_type = '261' quantity = 30 )
( move_id = 3 material = 'MAT-B' plant = '2000' move_date = '20260112' move_type = '201' quantity = 40 )
( move_id = 4 material = 'MAT-B' plant = '2000' move_date = '20260113' move_type = '262' quantity = 90 )
( move_id = 5 material = 'MAT-C' plant = '2000' move_date = '20260112' move_type = '999' quantity = 500 ) ).
go_env->insert_test_data( lt_movmt ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD balances_per_material.
DATA(lt_lines) = NEW lcl_report( )->select_balances(
iv_from = '20260101' iv_to = '20260131' it_plant = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'MAT-A' act = lt_lines[ 1 ]-material ).
cl_abap_unit_assert=>assert_equals( exp = 70 act = lt_lines[ 1 ]-balance ).
cl_abap_unit_assert=>assert_equals( exp = 'MAT-B' act = lt_lines[ 2 ]-material ).
cl_abap_unit_assert=>assert_equals( exp = -50 act = lt_lines[ 2 ]-balance ).
ENDMETHOD.
METHOD plant_filter.
DATA(lt_lines) = NEW lcl_report( )->select_balances(
iv_from = '20260101'
iv_to = '20260131'
it_plant = VALUE #( ( sign = 'I' option = 'EQ' low = '1000' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'MAT-A' act = lt_lines[ 1 ]-material ).
cl_abap_unit_assert=>assert_equals( exp = 30 act = lt_lines[ 1 ]-issue_qty ).
ENDMETHOD.
METHOD negative_balance.
DATA(lt_lines) = NEW lcl_report( )->select_balances(
iv_from = '20260101'
iv_to = '20260131'
it_plant = VALUE #( ( sign = 'I' option = 'EQ' low = '2000' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'MAT-B' act = lt_lines[ 1 ]-material ).
cl_abap_unit_assert=>assert_equals( exp = -50 act = lt_lines[ 1 ]-balance ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Stock movements'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}movmt {
key client : abap.clnt not null;
key move_id : abap.int4 not null;
material : abap.char(10);
plant : abap.char(4);
move_date : abap.dats;
move_type : abap.char(3);
quantity : abap.int4;
}

View File

@@ -0,0 +1,19 @@
CLASS {{p}}t15_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}t15_seed IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DELETE FROM {{p}}movmt.
INSERT {{p}}movmt FROM TABLE @( VALUE #(
( move_id = 1 material = 'MAT-001' plant = '1000' move_date = '20260105' move_type = '101' quantity = 100 )
( move_id = 2 material = 'MAT-001' plant = '1000' move_date = '20260110' move_type = '261' quantity = 30 )
( move_id = 3 material = 'MAT-001' plant = '2000' move_date = '20260120' move_type = '101' quantity = 50 )
( move_id = 4 material = 'MAT-002' plant = '1000' move_date = '20260108' move_type = '201' quantity = 40 )
( move_id = 5 material = 'MAT-002' plant = '1000' move_date = '20260115' move_type = '262' quantity = 60 )
( move_id = 6 material = 'MAT-003' plant = '2000' move_date = '20260112' move_type = '999' quantity = 500 )
( move_id = 7 material = 'MAT-004' plant = '1000' move_date = '20251220' move_type = '101' quantity = 70 ) ) ).
out->write( sy-dbcnt ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,43 @@
# 1. Goal
Show the stock balance for each material in a warehouse. The warehouse team uses
the list to compare the receipts and the issues of a period.
# 2. Open questions
None.
# 3. Context
- Table {{P}}MOVMT exists in package $TMP. It contains data.
Fields: MOVE_ID (INT4, key), MATERIAL (CHAR 10), PLANT (CHAR 4),
MOVE_DATE (DATS), MOVE_TYPE (CHAR 3), QUANTITY (INT4).
# 4. Contract
- Create the executable program {{P}}STOCK_BAL in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first movement date to include.
- Parameter P_TO, type DATS, mandatory: the last movement date to include.
- Select-option S_PLANT for the plant.
- Show the result with CL_SALV_TABLE. The output table has these columns, with
these names: MATERIAL, RECEIPT_QTY, ISSUE_QTY, BALANCE.
# 5. Business rules
1. A movement is in scope if MOVE_DATE is on or after P_FROM and on or before
P_TO, and PLANT is in S_PLANT.
2. An in-scope movement is a receipt if MOVE_TYPE is '101' or '201'. It is an
issue if MOVE_TYPE is '261' or '262'. All other in-scope movements are
ignored.
3. RECEIPT_QTY is the sum of QUANTITY of all receipts of the material.
ISSUE_QTY is the sum of QUANTITY of all issues of the material.
BALANCE is RECEIPT_QTY minus ISSUE_QTY.
4. Show one line for each material that has at least one receipt or issue. A
material with only ignored movements does not appear.
5. Sort the lines by BALANCE, the highest balance first.
# 6. Constraints
- Release target: 7.58.
- Coding standards: Clean ABAP. Read the movement data with one database access.
- Out of scope: do not change {{P}}MOVMT.
# 7. Acceptance
- The program is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests as local test classes in the program.

View File

@@ -0,0 +1,61 @@
{
"id": "G0014",
"category": "B",
"object_type": "PROG",
"difficulty": 2,
"release_target": "v758",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 40,
"max_activations": 10
},
"seed": [
{
"type": "TABL",
"name": "{{P}}MOVMT",
"file": "seed/movmt.tabl.asabap",
"description": "Stock movements"
},
{
"type": "CLAS",
"name": "{{P}}T15_SEED",
"file": "seed/t15_seed.clas.abap",
"description": "T15 seed data",
"run": true
}
],
"contract": [
{
"type": "PROG",
"name": "{{P}}STOCK_BAL",
"parameters": [
"p_from",
"p_to",
"s_plant"
]
}
],
"out_of_scope": [
"{{P}}MOVMT"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T15_HIDDEN",
"file": "hidden/t15_hidden.clas.abap",
"description": "T15 hidden tests"
}
],
"reference": [
{
"type": "PROG",
"name": "{{P}}STOCK_BAL",
"file": "reference/stock_bal.prog.abap",
"description": "Stock balance per material"
}
],
"craft_checks": [
"db_operation_in_loop",
"method_length"
]
}