Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 12:10:52 +02:00
parent d3250acfb8
commit 39769afce8
741 changed files with 40573 additions and 317 deletions

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
OR line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled = 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 100 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay + is_run-delay_min.
IF is_run-delay_min > c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
AND line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled <> 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 100 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay + is_run-delay_min.
IF is_run-delay_min > c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
AND line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled = 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 101 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay + is_run-delay_min.
IF is_run-delay_min > c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
AND line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled = 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 100 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay - is_run-delay_min.
IF is_run-delay_min > c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
AND line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled = 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 100 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay + is_run-delay_min.
IF is_run-delay_min <= c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,24 @@
{
"id": "G0142",
"pool": "eval",
"object_type": "PROG",
"category": "E",
"attempts": [
{
"stage": "validate",
"oracle": 93.3,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,104 @@
CLASS {{p}}train_punct_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES tt_line TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date TYPE RANGE OF {{p}}trun-plan_date.
METHODS run
IMPORTING it_line TYPE tt_line OPTIONAL
it_date TYPE tt_date OPTIONAL
RETURNING VALUE(rr_data) TYPE REF TO data.
METHODS lines_of
IMPORTING ir_data TYPE REF TO data
RETURNING VALUE(rv_lines) TYPE i.
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 all_lines FOR TESTING.
METHODS cancelled_runs_are_skipped FOR TESTING.
METHODS worst_line_first FOR TESTING.
METHODS punct_values FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS line_filter FOR TESTING.
ENDCLASS.
CLASS {{p}}train_punct_hidden IMPLEMENTATION.
METHOD run.
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
SUBMIT {{p}}train_punct_old
WITH s_line IN it_line
WITH s_date IN it_date
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 } is missing| ).
rv_value = condense( CONV string( <lv_value> ) ).
ENDMETHOD.
METHOD all_lines.
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( run( ) ) ).
ENDMETHOD.
METHOD cancelled_runs_are_skipped.
DATA(lr_data) = run( ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `IC1001`
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `LINE_CODE` ) ).
ENDMETHOD.
METHOD worst_line_first.
DATA(lr_data) = run( ).
cl_abap_unit_assert=>assert_equals( exp = `RE2001`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LINE_CODE` ) ).
ENDMETHOD.
METHOD punct_values.
DATA(lr_data) = run( ).
cl_abap_unit_assert=>assert_equals( exp = `0`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `PUNCT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `50`
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `PUNCT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `67`
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `PUNCT` ) ).
ENDMETHOD.
METHOD date_filter.
DATA(lr_data) = run( it_date = VALUE #( ( sign = 'I' option = 'EQ' low = '20260106' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `RE2001`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LINE_CODE` ) ).
ENDMETHOD.
METHOD line_filter.
DATA(lr_data) = run( it_line = VALUE #( ( sign = 'I' option = 'EQ' low = 'IC1002' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `2`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `RUNS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `1`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LATE` ) ).
cl_abap_unit_assert=>assert_equals( exp = `22`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `SUM_DELAY` ) ).
cl_abap_unit_assert=>assert_equals( exp = `50`
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `PUNCT` ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,62 @@
{
"task": "G0142",
"mutants": [
{
"object": "{{P}}TRAIN_PUNCT_OLD",
"mutant": "line 54: AND -> OR (logic)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"LINE_FILTER"
]
},
{
"object": "{{P}}TRAIN_PUNCT_OLD",
"mutant": "line 61: = -> <> (eq)",
"status": "killed",
"hidden": "1/6",
"failed_tests": [
"CANCELLED_RUNS_ARE_SKIPPED",
"DATE_FILTER",
"LINE_FILTER",
"PUNCT_VALUES",
"WORST_LINE_FIRST"
]
},
{
"object": "{{P}}TRAIN_PUNCT_OLD",
"mutant": "line 67: 100 -> 101 (const)",
"status": "killed",
"hidden": "4/6",
"failed_tests": [
"LINE_FILTER",
"PUNCT_VALUES"
]
},
{
"object": "{{P}}TRAIN_PUNCT_OLD",
"mutant": "line 79: + -> - (arith)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"LINE_FILTER"
]
},
{
"object": "{{P}}TRAIN_PUNCT_OLD",
"mutant": "line 80: > -> <= (rel)",
"status": "killed",
"hidden": "2/6",
"failed_tests": [
"CANCELLED_RUNS_ARE_SKIPPED",
"DATE_FILTER",
"PUNCT_VALUES",
"WORST_LINE_FIRST"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,134 @@
REPORT {{p}}train_punct_old.
TYPES: BEGIN OF ty_run,
run_id TYPE {{p}}trun-run_id,
line_code TYPE {{p}}trun-line_code,
plan_date TYPE {{p}}trun-plan_date,
delay_min TYPE {{p}}trun-delay_min,
cancelled TYPE {{p}}trun-cancelled,
END OF ty_run.
TYPES tt_run TYPE STANDARD TABLE OF ty_run WITH EMPTY KEY.
TYPES: BEGIN OF ty_line,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES tt_line_range TYPE RANGE OF {{p}}trun-line_code.
TYPES tt_date_range TYPE RANGE OF {{p}}trun-plan_date.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
CLASS lcl_punct DEFINITION FINAL.
PUBLIC SECTION.
CONSTANTS c_late_limit TYPE i VALUE 5.
CLASS-METHODS read_runs
IMPORTING it_line TYPE tt_line_range
it_date TYPE tt_date_range
RETURNING VALUE(rt_runs) TYPE tt_run.
CLASS-METHODS aggregate
IMPORTING it_runs TYPE tt_run
RETURNING VALUE(rt_lines) TYPE tt_line.
CLASS-METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
CLASS-METHODS add_run
IMPORTING is_run TYPE ty_run
CHANGING ct_lines TYPE tt_line.
ENDCLASS.
CLASS lcl_punct IMPLEMENTATION.
METHOD read_runs.
DATA lt_runs TYPE tt_run.
SELECT run_id, line_code, plan_date, delay_min, cancelled
FROM {{p}}trun
WHERE plan_date IN @it_date
AND line_code IN @it_line
INTO TABLE @lt_runs.
rt_runs = lt_runs.
ENDMETHOD.
METHOD aggregate.
LOOP AT it_runs INTO DATA(ls_run).
IF ls_run-cancelled = 'X'.
CONTINUE.
ENDIF.
add_run( EXPORTING is_run = ls_run CHANGING ct_lines = rt_lines ).
ENDLOOP.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
<ls_line>-punct = ( <ls_line>-runs - <ls_line>-late ) * 100 / <ls_line>-runs.
ENDLOOP.
SORT rt_lines BY punct line_code.
ENDMETHOD.
METHOD add_run.
READ TABLE ct_lines ASSIGNING FIELD-SYMBOL(<ls_line>) WITH KEY line_code = is_run-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO ct_lines ASSIGNING <ls_line>.
<ls_line>-line_code = is_run-line_code.
ENDIF.
<ls_line>-runs = <ls_line>-runs + 1.
<ls_line>-sum_delay = <ls_line>-sum_delay + is_run-delay_min.
IF is_run-delay_min > c_late_limit.
<ls_line>-late = <ls_line>-late + 1.
ENDIF.
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(lt_runs) = lcl_punct=>read_runs( it_line = s_line[] it_date = s_date[] ).
DATA(lt_lines) = lcl_punct=>aggregate( lt_runs ).
lcl_punct=>display( CHANGING ct_lines = lt_lines ).
CLASS ltc_punct DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS aggregates_runs FOR TESTING.
METHODS skips_cancelled FOR TESTING.
METHODS sorts_worst_first FOR TESTING.
ENDCLASS.
CLASS ltc_punct IMPLEMENTATION.
METHOD aggregates_runs.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L1' delay_min = 10 cancelled = '' )
( run_id = 3 line_code = 'L2' delay_min = 3 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L1' act = lt_lines[ 1 ]-line_code ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-runs ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-late ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_lines[ 1 ]-sum_delay ).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lt_lines[ 1 ]-punct ).
ENDMETHOD.
METHOD skips_cancelled.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = 'X' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ).
ENDMETHOD.
METHOD sorts_worst_first.
DATA(lt_lines) = lcl_punct=>aggregate( VALUE #(
( run_id = 1 line_code = 'L1' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'L2' delay_min = 30 cancelled = '' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 'L2' act = lt_lines[ 1 ]-line_code ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,56 @@
REPORT {{p}}train_punct_old.
DATA gv_line TYPE {{p}}trun-line_code.
DATA gv_date TYPE {{p}}trun-plan_date.
SELECT-OPTIONS s_line FOR gv_line.
SELECT-OPTIONS s_date FOR gv_date.
TYPES: BEGIN OF ty_out,
line_code TYPE {{p}}trun-line_code,
runs TYPE i,
late TYPE i,
sum_delay TYPE i,
punct TYPE i,
END OF ty_out.
DATA gt_out TYPE STANDARD TABLE OF ty_out.
FIELD-SYMBOLS <ls_run> TYPE {{p}}trun.
FIELD-SYMBOLS <ls_out> TYPE ty_out.
START-OF-SELECTION.
DATA lt_runs TYPE STANDARD TABLE OF {{p}}trun.
SELECT * FROM {{p}}trun
INTO TABLE @lt_runs
WHERE plan_date IN @s_date
AND line_code IN @s_line.
LOOP AT lt_runs ASSIGNING <ls_run>.
IF <ls_run>-cancelled = 'X'.
CONTINUE.
ENDIF.
READ TABLE gt_out ASSIGNING <ls_out> WITH KEY line_code = <ls_run>-line_code.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO gt_out ASSIGNING <ls_out>.
<ls_out>-line_code = <ls_run>-line_code.
ENDIF.
<ls_out>-runs = <ls_out>-runs + 1.
<ls_out>-sum_delay = <ls_out>-sum_delay + <ls_run>-delay_min.
IF <ls_run>-delay_min > 5.
<ls_out>-late = <ls_out>-late + 1.
ENDIF.
ENDLOOP.
LOOP AT gt_out ASSIGNING <ls_out>.
<ls_out>-punct = ( <ls_out>-runs - <ls_out>-late ) * 100 / <ls_out>-runs.
ENDLOOP.
SORT gt_out BY punct line_code.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = gt_out ).
lo_alv->display( ).
CATCH cx_salv_msg.
ENDTRY.

View File

@@ -0,0 +1,21 @@
CLASS {{p}}train_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}train_seed IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DELETE FROM {{p}}trun.
INSERT {{p}}trun FROM TABLE @( VALUE #(
( run_id = 1 line_code = 'IC1001' plan_date = '20260105' delay_min = 0 cancelled = '' )
( run_id = 2 line_code = 'IC1001' plan_date = '20260105' delay_min = 12 cancelled = '' )
( run_id = 3 line_code = 'IC1001' plan_date = '20260106' delay_min = 3 cancelled = '' )
( run_id = 4 line_code = 'IC1002' plan_date = '20260105' delay_min = 20 cancelled = '' )
( run_id = 5 line_code = 'IC1002' plan_date = '20260106' delay_min = 2 cancelled = '' )
( run_id = 6 line_code = 'IC1002' plan_date = '20260106' delay_min = 5 cancelled = 'X' )
( run_id = 7 line_code = 'RE2001' plan_date = '20260106' delay_min = 7 cancelled = '' )
( run_id = 8 line_code = 'RE2001' plan_date = '20260106' delay_min = 1 cancelled = 'X' )
( run_id = 9 line_code = 'IC1003' plan_date = '20260107' delay_min = 4 cancelled = 'X' ) ) ).
out->write( sy-dbcnt ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,13 @@
@EndUserText.label : 'Train runs'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}trun {
key client : abap.clnt not null;
key run_id : abap.int4 not null;
line_code : abap.char(6);
plan_date : abap.dats;
delay_min : abap.int4;
cancelled : abap.char(1);
}

View File

@@ -0,0 +1,44 @@
# 1. Goal
Refactor the legacy report {{P}}TRAIN_PUNCT_OLD in package $TMP. The report shows
the punctuality of the railway lines of a regional operator. The operations team
uses the report to find the lines that need attention.
The behaviour of the report stays the same. Only the internal structure changes.
# 2. Open questions
None.
# 3. Context
- Table {{P}}TRUN exists in package $TMP and contains data.
Fields: RUN_ID (INT4, key), LINE_CODE (CHAR 6), PLAN_DATE (DATS),
DELAY_MIN (INT4), CANCELLED (CHAR 1).
One row is one train run of one line on one day. DELAY_MIN is the delay of the
run in minutes. CANCELLED is 'X' if the run was cancelled.
- The report {{P}}TRAIN_PUNCT_OLD in package $TMP is the legacy report. It is
active and it produces the correct result. Users report that the code is hard
to maintain.
- The report reads the table and shows one line per railway line in an ALV list.
# 4. Contract
- The program {{P}}TRAIN_PUNCT_OLD keeps its name and its package $TMP.
- The selection screen keeps these parameters:
- S_LINE: a select-option for the line code.
- S_DATE: a select-option for the plan date.
- The report shows the result with CL_SALV_TABLE. The output table keeps these
column names: LINE_CODE, RUNS, LATE, SUM_DELAY, PUNCT.
# 5. Business rules
The behaviour of the report must not change. The legacy code of
{{P}}TRAIN_PUNCT_OLD contains the business rules. Read the legacy code and keep
every rule. Do not add rules. Do not remove rules.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Split the logic into small methods. A method has
fewer than 40 statements. Do not change the public interface.
- Out of scope: do not change {{P}}TRUN and do not change {{P}}TRAIN_SEED.
# 7. Acceptance
- The program is active and has no syntax error.
- The behaviour of the program is unchanged. The hidden tests pass.
- The code has no ATC finding of priority 1 or 2.
- Write ABAP Unit tests as local test classes in the program.

View File

@@ -0,0 +1,67 @@
{
"id": "G0142",
"category": "E",
"object_type": "PROG",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}TRUN",
"file": "seed/trun.tabl.asabap",
"description": "Train runs"
},
{
"type": "PROG",
"name": "{{P}}TRAIN_PUNCT_OLD",
"file": "seed/train_punct_old.prog.abap",
"description": "Legacy punctuality report"
},
{
"type": "CLAS",
"name": "{{P}}TRAIN_SEED",
"file": "seed/train_seed.clas.abap",
"description": "Train run seed data",
"run": true
}
],
"contract": [
{
"type": "PROG",
"name": "{{P}}TRAIN_PUNCT_OLD",
"parameters": [
"s_line",
"s_date"
]
}
],
"out_of_scope": [
"{{P}}TRUN",
"{{P}}TRAIN_SEED"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}TRAIN_PUNCT_HIDDEN",
"file": "hidden/train_punct_hidden.clas.abap",
"description": "Punctuality behaviour tests"
}
],
"reference": [
{
"type": "PROG",
"name": "{{P}}TRAIN_PUNCT_OLD",
"file": "reference/train_punct_old.prog.abap",
"description": "Refactored punctuality report"
}
],
"craft_checks": [
"method_length",
"db_operation_in_loop"
]
}