ADT fallback: Accept headers for FUNC; G0189 accepted; regen2 results

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 16:31:03 +02:00
parent 428b3565b2
commit 7510131a7d
335 changed files with 12047 additions and 5545 deletions

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
OR opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team <> ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_false.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority = '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent + ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
AND opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team = ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_false.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority = '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent + ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
AND opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team <> ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_true.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority = '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent + ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
AND opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team <> ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_false.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority <> '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent + ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
AND opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team <> ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_false.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority = '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent - ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

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

View File

@@ -1,108 +0,0 @@
CLASS {{p}}news_dist_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_date TYPE d.
TYPES tt_date TYPE RANGE OF ty_date.
TYPES ty_dist TYPE c LENGTH 4.
TYPES tt_dist TYPE RANGE OF ty_dist.
METHODS run
IMPORTING it_date TYPE tt_date OPTIONAL
it_dist TYPE tt_dist 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_agents FOR TESTING.
METHODS sorted_by_rate FOR TESTING.
METHODS sums_and_rate FOR TESTING.
METHODS district_filter FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS zero_copies FOR TESTING.
METHODS no_deliveries FOR TESTING.
METHODS outside_period FOR TESTING.
ENDCLASS.
CLASS {{p}}news_dist_hidden IMPLEMENTATION.
METHOD run.
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
SUBMIT {{p}}news_dist_old WITH s_date IN it_date WITH s_dist IN it_dist 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> ) ).
ENDMETHOD.
METHOD all_agents.
cl_abap_unit_assert=>assert_equals( exp = 6 act = lines_of( run( ) ) ).
ENDMETHOD.
METHOD sorted_by_rate.
DATA(lr_data) = run( ).
cl_abap_unit_assert=>assert_equals( exp = `A5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `A6` act = value_of( ir_data = lr_data iv_row = 6 iv_col = `AGENT` ) ).
ENDMETHOD.
METHOD sums_and_rate.
DATA(lr_data) = run( it_date = VALUE #( ( sign = 'I' option = 'BT' low = '20260101' high = '20260131' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 6 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `A1` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `AGENT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `200` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `COPIES` ) ).
cl_abap_unit_assert=>assert_equals( exp = `15` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `RETURNED` ) ).
cl_abap_unit_assert=>assert_equals( exp = `7.50` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `RATE` ) ).
ENDMETHOD.
METHOD district_filter.
DATA(lr_data) = run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'W' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `A5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ).
ENDMETHOD.
METHOD date_filter.
DATA(lr_data) = run( it_date = VALUE #( ( sign = 'I' option = 'GE' low = '20260110' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `A1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `A3` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `AGENT` ) ).
ENDMETHOD.
METHOD zero_copies.
DATA(lr_data) = run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'W' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = `A6` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `AGENT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `0` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `COPIES` ) ).
cl_abap_unit_assert=>assert_equals( exp = `0.00` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `RATE` ) ).
ENDMETHOD.
METHOD no_deliveries.
cl_abap_unit_assert=>assert_equals(
exp = 0
act = lines_of( run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'E' ) ) ) ) ).
ENDMETHOD.
METHOD outside_period.
cl_abap_unit_assert=>assert_equals(
exp = 0
act = lines_of( run( it_date = VALUE #( ( sign = 'I' option = 'BT' low = '20270101' high = '20271231' ) ) ) ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,107 @@
CLASS {{p}}t15_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES tt_team TYPE RANGE OF {{p}}ticket-team.
METHODS run
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team 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 counts_and_urgent FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter_from FOR TESTING.
METHODS date_filter_to FOR TESTING.
METHODS team_filter 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}}helpdesk_old
WITH p_from = iv_from
WITH p_to = iv_to
WITH s_team IN it_team
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> ) ).
ENDMETHOD.
METHOD counts_and_urgent.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `DELTA` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `GAMMA` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `TEAM` ) ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `URGENT` ) ).
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `0` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `URGENT` ) ).
ENDMETHOD.
METHOD date_filter_from.
DATA(lr_data) = run( iv_from = '20260201' iv_to = '20260331' ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ).
ENDMETHOD.
METHOD date_filter_to.
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 = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `TEAM` ) ).
ENDMETHOD.
METHOD team_filter.
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260331'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'BETA' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ).
cl_abap_unit_assert=>assert_equals( exp = `4` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ).
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -1,34 +1,74 @@
{
"task": "E21",
"task": "G0141",
"mutants": [
{
"object": "{{P}}NEWS_DIST_OLD",
"mutant": "SORT: DESCENDING -> ASCENDING",
"object": "{{P}}HELPDESK_OLD",
"mutant": "line 42: AND -> OR (logic)",
"status": "killed",
"hidden": "4/8",
"hidden": "0/6",
"failed_tests": [
"sorted_by_rate",
"sums_and_rate",
"district_filter",
"zero_copies"
"COUNTS_AND_URGENT",
"DATE_FILTER_FROM",
"DATE_FILTER_TO",
"SORTED_BY_TICKETS",
"TEAM_FILTER",
"URGENT_RULE"
]
},
{
"object": "{{P}}NEWS_DIST_OLD",
"mutant": "rate guard: > -> >=",
"object": "{{P}}HELPDESK_OLD",
"mutant": "line 52: <> -> = (rel)",
"status": "killed",
"hidden": "5/8",
"hidden": "0/6",
"failed_tests": [
"all_agents",
"sorted_by_rate",
"sums_and_rate",
"district_filter",
"zero_copies"
"COUNTS_AND_URGENT",
"DATE_FILTER_FROM",
"DATE_FILTER_TO",
"SORTED_BY_TICKETS",
"TEAM_FILTER",
"URGENT_RULE"
]
},
{
"object": "{{P}}HELPDESK_OLD",
"mutant": "line 56: abap_false -> abap_true (bool)",
"status": "killed",
"hidden": "0/6",
"failed_tests": [
"COUNTS_AND_URGENT",
"DATE_FILTER_FROM",
"DATE_FILTER_TO",
"SORTED_BY_TICKETS",
"TEAM_FILTER",
"URGENT_RULE"
]
},
{
"object": "{{P}}HELPDESK_OLD",
"mutant": "line 59: = -> <> (eq)",
"status": "killed",
"hidden": "3/6",
"failed_tests": [
"COUNTS_AND_URGENT",
"TEAM_FILTER",
"URGENT_RULE"
]
},
{
"object": "{{P}}HELPDESK_OLD",
"mutant": "line 60: + -> - (arith)",
"status": "killed",
"hidden": "2/6",
"failed_tests": [
"COUNTS_AND_URGENT",
"DATE_FILTER_FROM",
"TEAM_FILTER",
"URGENT_RULE"
]
}
],
"valid": 2,
"killed": 2,
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,160 @@
REPORT {{p}}helpdesk_old.
DATA gv_team TYPE {{p}}ticket-team.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line,
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
tt_team TYPE RANGE OF {{p}}ticket-team.
TYPES:
BEGIN OF ty_group,
team TYPE {{p}}ticket-team,
priority TYPE {{p}}ticket-priority,
cnt TYPE i,
END OF ty_group,
tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY.
METHODS select_teams
IMPORTING iv_from TYPE d
iv_to TYPE d
it_team TYPE tt_team
RETURNING VALUE(rt_line) TYPE tt_line.
METHODS display
CHANGING ct_line TYPE tt_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_teams.
SELECT team, priority, COUNT(*) AS cnt
FROM {{p}}ticket
WHERE opened_on >= @iv_from
AND opened_on <= @iv_to
AND team IN @it_team
GROUP BY team, priority
INTO TABLE @DATA(lt_group).
SORT lt_group BY team.
DATA ls_line TYPE ty_line.
DATA lv_first TYPE abap_bool VALUE abap_true.
LOOP AT lt_group INTO DATA(ls_group).
IF lv_first = abap_false AND ls_line-team <> ls_group-team.
APPEND ls_line TO rt_line.
CLEAR ls_line.
ENDIF.
lv_first = abap_false.
ls_line-team = ls_group-team.
ls_line-tickets = ls_line-tickets + ls_group-cnt.
IF ls_group-priority = '1' OR ls_group-priority = '2'.
ls_line-urgent = ls_line-urgent + ls_group-cnt.
ENDIF.
ENDLOOP.
IF lv_first = abap_false.
APPEND ls_line TO rt_line.
ENDIF.
SORT rt_line BY tickets DESCENDING team ASCENDING.
ENDMETHOD.
METHOD display.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = ct_line ).
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_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ).
go_report->display( CHANGING ct_line = gt_line ).
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 setup.
METHODS counts_per_team FOR TESTING.
METHODS urgent_rule FOR TESTING.
METHODS date_filter FOR TESTING.
METHODS team_filter FOR TESTING.
METHODS sorted_by_tickets FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY.
lt_ticket = VALUE #(
( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' )
( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' )
( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' )
( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ).
go_env->insert_test_data( lt_ticket ).
ENDMETHOD.
METHOD counts_per_team.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD urgent_rule.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ).
ENDMETHOD.
METHOD date_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD team_filter.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131'
it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ).
ENDMETHOD.
METHOD sorted_by_tickets.
DATA(lt_line) = NEW lcl_report( )->select_teams(
iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ).
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ).
ENDMETHOD.
ENDCLASS.

View File

@@ -1,131 +0,0 @@
REPORT {{p}}news_dist_old.
TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2.
TYPES: BEGIN OF ty_line,
agent TYPE {{p}}agent-agent_id,
name TYPE {{p}}agent-agent_name,
district TYPE {{p}}agent-district,
copies TYPE i,
returned TYPE i,
rate TYPE ty_rate,
END OF ty_line.
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
TYPES ty_date TYPE d.
TYPES tt_date TYPE RANGE OF ty_date.
TYPES ty_dist TYPE c LENGTH 4.
TYPES tt_dist TYPE RANGE OF ty_dist.
DATA gv_date TYPE ty_date.
DATA gv_dist TYPE ty_dist.
SELECT-OPTIONS s_date FOR gv_date.
SELECT-OPTIONS s_dist FOR gv_dist.
CLASS lcl_report DEFINITION FINAL.
PUBLIC SECTION.
METHODS select_lines
IMPORTING it_date TYPE tt_date
it_dist TYPE tt_dist
RETURNING VALUE(rt_lines) TYPE tt_line.
METHODS display
CHANGING ct_lines TYPE tt_line.
PRIVATE SECTION.
METHODS add_rate
CHANGING cs_line TYPE ty_line.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD select_lines.
SELECT a~agent_id AS agent,
a~agent_name AS name,
a~district AS district,
SUM( d~del_copies ) AS copies,
SUM( d~ret_copies ) AS returned
FROM {{p}}agent AS a
INNER JOIN {{p}}deliv AS d ON d~agent_id = a~agent_id
WHERE d~del_date IN @it_date
AND a~district IN @it_dist
GROUP BY a~agent_id, a~agent_name, a~district
INTO CORRESPONDING FIELDS OF TABLE @rt_lines.
LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(<ls_line>).
add_rate( CHANGING cs_line = <ls_line> ).
ENDLOOP.
SORT rt_lines BY rate DESCENDING agent ASCENDING.
ENDMETHOD.
METHOD add_rate.
DATA lv_copies TYPE p LENGTH 15 DECIMALS 2.
lv_copies = cs_line-copies.
IF lv_copies > 0.
cs_line-rate = cs_line-returned * 100 / lv_copies.
ELSE.
cs_line-rate = 0.
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(go_report) = NEW lcl_report( ).
DATA(gt_lines) = go_report->select_lines( it_date = s_date[]
it_dist = s_dist[] ).
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 sums_per_agent FOR TESTING.
METHODS rate_with_zero_copies FOR TESTING.
ENDCLASS.
CLASS ltc_report IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create(
i_dependency_list = VALUE #( ( '{{P}}AGENT' ) ( '{{P}}DELIV' ) ) ).
DATA lt_agent TYPE STANDARD TABLE OF {{p}}agent WITH EMPTY KEY.
lt_agent = VALUE #( ( agent_id = 'A1' agent_name = 'One' district = 'N' )
( agent_id = 'A2' agent_name = 'Two' district = 'S' ) ).
go_env->insert_test_data( lt_agent ).
DATA lt_deliv TYPE STANDARD TABLE OF {{p}}deliv WITH EMPTY KEY.
lt_deliv = VALUE #( ( deliv_id = 1 agent_id = 'A1' del_date = '20260105' del_copies = 100 ret_copies = 5 )
( deliv_id = 2 agent_id = 'A1' del_date = '20260112' del_copies = 100 ret_copies = 15 )
( deliv_id = 3 agent_id = 'A2' del_date = '20260106' del_copies = 0 ret_copies = 0 ) ).
go_env->insert_test_data( lt_deliv ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD sums_per_agent.
DATA(lt_lines) = NEW lcl_report( )->select_lines( it_date = VALUE tt_date( )
it_dist = VALUE tt_dist( ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
cl_abap_unit_assert=>assert_equals( exp = 'A1' act = lt_lines[ 1 ]-agent ).
cl_abap_unit_assert=>assert_equals( exp = 200 act = lt_lines[ 1 ]-copies ).
cl_abap_unit_assert=>assert_equals( exp = 20 act = lt_lines[ 1 ]-returned ).
cl_abap_unit_assert=>assert_equals( exp = '10.00' act = |{ lt_lines[ 1 ]-rate }| ).
ENDMETHOD.
METHOD rate_with_zero_copies.
DATA(lt_lines) = NEW lcl_report( )->select_lines( it_date = VALUE tt_date( )
it_dist = VALUE tt_dist( ) ).
cl_abap_unit_assert=>assert_equals( exp = 'A2' act = lt_lines[ 2 ]-agent ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 2 ]-copies ).
cl_abap_unit_assert=>assert_equals( exp = '0.00' act = |{ lt_lines[ 2 ]-rate }| ).
ENDMETHOD.
ENDCLASS.

View File

@@ -1,11 +0,0 @@
@EndUserText.label : 'Newsagent'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}agent {
key client : abap.clnt not null;
key agent_id : abap.char(6) not null;
agent_name : abap.char(40);
district : abap.char(4);
}

View File

@@ -1,13 +0,0 @@
@EndUserText.label : 'News delivery'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}deliv {
key client : abap.clnt not null;
key deliv_id : abap.int4 not null;
agent_id : abap.char(6);
del_date : abap.dats;
del_copies : abap.int4;
ret_copies : abap.int4;
}

View File

@@ -0,0 +1,23 @@
CLASS {{p}}hd_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}hd_seed IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DELETE FROM {{p}}ticket.
INSERT {{p}}ticket FROM TABLE @( VALUE #(
( ticket_id = 1 team = 'ALPHA' priority = '1' opened_on = '20260105' )
( ticket_id = 2 team = 'ALPHA' priority = '3' opened_on = '20260110' )
( ticket_id = 3 team = 'ALPHA' priority = '2' opened_on = '20260201' )
( ticket_id = 4 team = 'BETA' priority = '1' opened_on = '20260107' )
( ticket_id = 5 team = 'BETA' priority = '1' opened_on = '20260108' )
( ticket_id = 6 team = 'BETA' priority = '4' opened_on = '20260109' )
( ticket_id = 7 team = 'BETA' priority = '2' opened_on = '20260301' )
( ticket_id = 8 team = 'GAMMA' priority = '3' opened_on = '20260115' )
( ticket_id = 9 team = 'GAMMA' priority = '1' opened_on = '20251220' )
( ticket_id = 10 team = 'DELTA' priority = '2' opened_on = '20260120' )
( ticket_id = 11 team = 'EPSILON' priority = '1' opened_on = '20251101' ) ) ).
out->write( sy-dbcnt ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,51 @@
REPORT {{p}}helpdesk_old.
TYPES: BEGIN OF ty_line,
team TYPE {{p}}ticket-team,
tickets TYPE i,
urgent TYPE i,
END OF ty_line.
DATA: gt_line TYPE STANDARD TABLE OF ty_line,
gt_team TYPE STANDARD TABLE OF {{p}}ticket-team,
gv_tickets TYPE i,
gv_urgent TYPE i,
ls_line TYPE ty_line,
lv_team TYPE {{p}}ticket-team,
gv_team TYPE {{p}}ticket-team,
lo_alv TYPE REF TO cl_salv_table.
PARAMETERS p_from TYPE d OBLIGATORY.
PARAMETERS p_to TYPE d OBLIGATORY.
SELECT-OPTIONS s_team FOR gv_team.
START-OF-SELECTION.
SELECT DISTINCT team FROM {{p}}ticket INTO TABLE gt_team
WHERE opened_on >= p_from AND opened_on <= p_to
AND team IN s_team.
LOOP AT gt_team INTO lv_team.
SELECT COUNT(*) FROM {{p}}ticket INTO gv_tickets
WHERE team = lv_team
AND opened_on >= p_from AND opened_on <= p_to.
SELECT COUNT(*) FROM {{p}}ticket INTO gv_urgent
WHERE team = lv_team
AND opened_on >= p_from AND opened_on <= p_to
AND ( priority = '1' OR priority = '2' ).
ls_line-team = lv_team.
ls_line-tickets = gv_tickets.
ls_line-urgent = gv_urgent.
APPEND ls_line TO gt_line.
ENDLOOP.
SORT gt_line BY tickets DESCENDING team ASCENDING.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv
CHANGING t_table = gt_line ).
lo_alv->display( ).
CATCH cx_salv_msg INTO DATA(lx_error).
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.

View File

@@ -1,72 +0,0 @@
REPORT {{p}}news_dist_old.
* Legacy distribution report of the newspaper publisher.
* Shows the delivered copies and the returns of each newsagent.
TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2.
TYPES: BEGIN OF ty_out,
agent TYPE {{p}}agent-agent_id,
name TYPE {{p}}agent-agent_name,
district TYPE {{p}}agent-district,
copies TYPE i,
returned TYPE i,
rate TYPE ty_rate,
END OF ty_out.
DATA: gt_agent TYPE STANDARD TABLE OF {{p}}agent,
gs_agent TYPE {{p}}agent,
gt_deliv TYPE STANDARD TABLE OF {{p}}deliv,
gs_deliv TYPE {{p}}deliv,
gs_out TYPE ty_out,
gt_out TYPE STANDARD TABLE OF ty_out,
gt_list TYPE STANDARD TABLE OF ty_out,
gv_date TYPE d,
gv_dist TYPE c LENGTH 4,
go_alv TYPE REF TO cl_salv_table.
SELECT-OPTIONS s_date FOR gv_date.
SELECT-OPTIONS s_dist FOR gv_dist.
START-OF-SELECTION.
SELECT * FROM {{p}}agent INTO TABLE gt_agent.
LOOP AT gt_agent INTO gs_agent.
SELECT * FROM {{p}}deliv INTO TABLE gt_deliv
WHERE agent_id = gs_agent-agent_id
AND del_date IN s_date.
IF gt_deliv IS NOT INITIAL.
CLEAR gs_out.
gs_out-agent = gs_agent-agent_id.
gs_out-name = gs_agent-agent_name.
gs_out-district = gs_agent-district.
LOOP AT gt_deliv INTO gs_deliv.
gs_out-copies = gs_out-copies + gs_deliv-del_copies.
gs_out-returned = gs_out-returned + gs_deliv-ret_copies.
ENDLOOP.
PERFORM calc_rate USING gs_out-returned gs_out-copies
CHANGING gs_out-rate.
APPEND gs_out TO gt_out.
ENDIF.
ENDLOOP.
LOOP AT gt_out INTO gs_out WHERE district IN s_dist.
APPEND gs_out TO gt_list.
ENDLOOP.
SORT gt_list BY rate DESCENDING agent ASCENDING.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_list ).
go_alv->display( ).
CATCH cx_salv_msg.
ENDTRY.
FORM calc_rate USING iv_returned TYPE i
iv_copies TYPE i
CHANGING cv_rate TYPE ty_rate.
DATA lv_copies TYPE p LENGTH 15 DECIMALS 2.
lv_copies = iv_copies.
IF lv_copies > 0.
cv_rate = iv_returned * 100 / lv_copies.
ELSE.
CLEAR cv_rate.
ENDIF.
ENDFORM.

View File

@@ -1,33 +0,0 @@
CLASS {{p}}news_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}news_seed IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DELETE FROM {{p}}deliv.
DELETE FROM {{p}}agent.
INSERT {{p}}agent FROM TABLE @( VALUE #(
( agent_id = 'A1' agent_name = 'Corner Shop' district = 'N' )
( agent_id = 'A2' agent_name = 'Station Kiosk' district = 'N' )
( agent_id = 'A3' agent_name = 'City News' district = 'S' )
( agent_id = 'A4' agent_name = 'Harbour Store' district = 'S' )
( agent_id = 'A5' agent_name = 'Airport Shop' district = 'W' )
( agent_id = 'A6' agent_name = 'Closed Kiosk' district = 'W' )
( agent_id = 'A7' agent_name = 'Village Store' district = 'E' ) ) ).
INSERT {{p}}deliv FROM TABLE @( VALUE #(
( deliv_id = 1 agent_id = 'A1' del_date = '20260105' del_copies = 100 ret_copies = 5 )
( deliv_id = 2 agent_id = 'A1' del_date = '20260112' del_copies = 100 ret_copies = 10 )
( deliv_id = 3 agent_id = 'A2' del_date = '20251220' del_copies = 40 ret_copies = 4 )
( deliv_id = 4 agent_id = 'A2' del_date = '20260106' del_copies = 50 ret_copies = 0 )
( deliv_id = 5 agent_id = 'A3' del_date = '20260107' del_copies = 200 ret_copies = 40 )
( deliv_id = 6 agent_id = 'A3' del_date = '20260114' del_copies = 200 ret_copies = 20 )
( deliv_id = 7 agent_id = 'A4' del_date = '20260108' del_copies = 80 ret_copies = 8 )
( deliv_id = 8 agent_id = 'A5' del_date = '20260109' del_copies = 60 ret_copies = 30 )
( deliv_id = 9 agent_id = 'A6' del_date = '20260103' del_copies = 0 ret_copies = 0 ) ) ).
out->write( 'Seed done' ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Support tickets'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}ticket {
key client : abap.clnt not null;
key ticket_id : abap.int4 not null;
team : abap.char(12);
priority : abap.char(1);
opened_on : abap.dats;
}

View File

@@ -1,52 +1,51 @@
# 1. Goal
The program {{P}}NEWS_DIST_OLD in package $TMP is the legacy distribution
report of a regional newspaper publisher. It shows, for a period, the copies
that each newsagent received and returned. The report works, but its source
does not meet the current quality standards of the company. Refactor the
source of {{P}}NEWS_DIST_OLD in place. The behavior of the program stays the
The report {{P}}HELPDESK_OLD in package $TMP shows the support tickets of a
service desk. The report works, but its source code is old and hard to
maintain. Refactor the report in place. The behaviour of the report stays the
same.
# 2. Open questions
None.
# 3. Context
- The executable program {{P}}NEWS_DIST_OLD exists in package $TMP and is
active. Its source is the legacy code that you refactor.
- The tables {{P}}AGENT and {{P}}DELIV exist in package $TMP and contain data.
- Users run the program with the selection screen and read the ALV list.
- The executable program {{P}}HELPDESK_OLD already exists in package $TMP and
is active. Its source code is the specification of the behaviour. Read the
source code before you change it.
- The report reads the table {{P}}TICKET. The table contains data.
Fields:
- TICKET_ID (INT4, key): the number of the ticket.
- TEAM (CHAR 12): the support team that owns the ticket.
- PRIORITY (CHAR 1): the priority of the ticket.
- OPENED_ON (DATS): the day on which the ticket was opened.
# 4. Contract
- Object: the executable program {{P}}NEWS_DIST_OLD in package $TMP.
Refactor this program in place. Keep the name. Do not create a new program.
- Refactor the executable program {{P}}HELPDESK_OLD in package $TMP. The name
of the program and its public interface do not change.
- Selection screen, unchanged:
- Select-option S_DATE for the delivery date.
- Select-option S_DIST for the district.
- The program shows the result with CL_SALV_TABLE, as before.
- The ALV list keeps these column names:
AGENT, NAME, DISTRICT, COPIES, RETURNED, RATE.
- Parameter P_FROM, type DATS, mandatory.
- Parameter P_TO, type DATS, mandatory.
- Select-option S_TEAM for the team.
- The report shows the result with CL_SALV_TABLE. The output table has these
columns with these names: TEAM, TICKETS, URGENT.
# 5. Business rules
The behavior of the program does not change. The legacy source of
{{P}}NEWS_DIST_OLD is the specification of the behavior. Read the source and
keep all of it:
- the filters of the selection screen,
- the set of lines of the list,
- the values of the columns,
- the sort order of the lines.
Do not change the result of the program.
The behaviour of the report stays the same. The current source code of
{{P}}HELPDESK_OLD defines the behaviour: which tickets are included, the
values of the output columns, and the order of the output lines. Read the
source code and keep all of it.
# 6. Constraints
- Release target: 8.16.
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP.
- The refactored program has no database access inside a loop.
- No method of the program has more than 40 statements.
- The program has no ATC finding of priority 1 or 2.
- Write ABAP Unit tests as local test classes in the program.
- Out of scope: do not change the tables {{P}}AGENT and {{P}}DELIV.
Do not change the selection screen names and the ALV column names.
- Read the ticket data with one database access. Do not read the database
in a loop.
- Keep the methods below 40 statements.
- Pass large parameters by reference.
- The refactored program has no ATC finding of priority 1 or priority 2.
- Out of scope: do not change the table {{P}}TICKET.
# 7. Acceptance
- {{P}}NEWS_DIST_OLD is active and has no syntax error.
- The result of the program is the same as before the refactoring.
- The program {{P}}HELPDESK_OLD is active and has no syntax error.
- The behaviour of the program is unchanged.
- The hidden tests pass.
- The local test classes pass.
- Write ABAP Unit tests as local test classes in the program.

View File

@@ -12,58 +12,52 @@
"seed": [
{
"type": "TABL",
"name": "{{P}}AGENT",
"file": "seed/agent.tabl.asabap",
"description": "Newsagents"
},
{
"type": "TABL",
"name": "{{P}}DELIV",
"file": "seed/deliv.tabl.asabap",
"description": "News deliveries"
"name": "{{P}}TICKET",
"file": "seed/ticket.tabl.asabap",
"description": "Support tickets"
},
{
"type": "CLAS",
"name": "{{P}}NEWS_SEED",
"file": "seed/news_seed.clas.abap",
"description": "Seed data",
"name": "{{P}}HD_SEED",
"file": "seed/hd_seed.clas.abap",
"description": "T15 seed data",
"run": true
},
{
"type": "PROG",
"name": "{{P}}NEWS_DIST_OLD",
"file": "seed/news_dist_old.prog.abap",
"description": "Legacy distribution report"
"name": "{{P}}HELPDESK_OLD",
"file": "seed/helpdesk_old.prog.abap",
"description": "Legacy helpdesk report"
}
],
"contract": [
{
"type": "PROG",
"name": "{{P}}NEWS_DIST_OLD",
"name": "{{P}}HELPDESK_OLD",
"parameters": [
"s_date",
"s_dist"
"p_from",
"p_to",
"s_team"
]
}
],
"out_of_scope": [
"{{P}}AGENT",
"{{P}}DELIV"
"{{P}}TICKET"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}NEWS_DIST_HIDDEN",
"file": "hidden/news_dist_hidden.clas.abap",
"description": "Hidden tests for the distribution report"
"name": "{{P}}T15_HIDDEN",
"file": "hidden/t15_hidden.clas.abap",
"description": "T15 hidden tests"
}
],
"reference": [
{
"type": "PROG",
"name": "{{P}}NEWS_DIST_OLD",
"file": "reference/news_dist_old.prog.abap",
"description": "Refactored distribution report"
"name": "{{P}}HELPDESK_OLD",
"file": "reference/helpdesk_old.prog.abap",
"description": "Refactored helpdesk report"
}
],
"craft_checks": [