Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
111
tasks_gen/train/G1118/faulty/m0_subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/faulty/m0_subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status <> 'A'
|
||||
AND start_date >= iv_from
|
||||
AND magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs >= 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
111
tasks_gen/train/G1118/faulty/m1_subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/faulty/m1_subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status = 'A'
|
||||
OR start_date >= iv_from
|
||||
AND magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs >= 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
111
tasks_gen/train/G1118/faulty/m2_subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/faulty/m2_subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status = 'A'
|
||||
AND start_date < iv_from
|
||||
AND magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs >= 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
111
tasks_gen/train/G1118/faulty/m3_subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/faulty/m3_subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status = 'A'
|
||||
AND start_date >= iv_from
|
||||
OR magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs >= 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
111
tasks_gen/train/G1118/faulty/m4_subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/faulty/m4_subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status = 'A'
|
||||
AND start_date >= iv_from
|
||||
AND magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs < 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/train/G1118/generation.json
Normal file
24
tasks_gen/train/G1118/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1118",
|
||||
"pool": "train",
|
||||
"object_type": "PROG",
|
||||
"category": "G",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 95.5,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
100
tasks_gen/train/G1118/hidden/t15_hidden.clas.abap
Normal file
100
tasks_gen/train/G1118/hidden/t15_hidden.clas.abap
Normal file
@@ -0,0 +1,100 @@
|
||||
CLASS {{p}}t15_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
METHODS run
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine 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 two_magazines FOR TESTING.
|
||||
METHODS sorted_by_revenue FOR TESTING.
|
||||
METHODS totals_and_counts FOR TESTING.
|
||||
METHODS cancelled_excluded FOR TESTING.
|
||||
METHODS small_group_hidden FOR TESTING.
|
||||
METHODS magazine_filter FOR TESTING.
|
||||
METHODS date_filter FOR TESTING.
|
||||
METHODS empty_result 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}}subs_sum WITH p_from = iv_from WITH s_mag IN it_magazine 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 two_magazines.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( run( '20260101' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_revenue.
|
||||
DATA(lr_data) = run( '20260101' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NATURE` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MAGAZINE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `ORBIT` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `MAGAZINE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_and_counts.
|
||||
DATA(lr_data) = run( '20260101' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `40.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REVENUE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `NUM_SUBS` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cancelled_excluded.
|
||||
DATA(lr_data) = run( '20260101' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `20.00` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `REVENUE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD small_group_hidden.
|
||||
DATA(lr_data) = run( iv_from = '20260101'
|
||||
it_magazine = VALUE #( ( sign = 'I' option = 'EQ' low = 'SPORT' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines_of( lr_data ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD magazine_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101'
|
||||
it_magazine = VALUE #( ( sign = 'I' option = 'EQ' low = 'NATURE' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NATURE` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `MAGAZINE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `40.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REVENUE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_filter.
|
||||
DATA(lr_data) = run( '20251201' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `45.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REVENUE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `NUM_SUBS` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_result.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines_of( run( '20260201' ) ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
82
tasks_gen/train/G1118/mutation.json
Normal file
82
tasks_gen/train/G1118/mutation.json
Normal file
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"task": "G1118",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}SUBS_SUM",
|
||||
"mutant": "line 34: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "2/8",
|
||||
"failed_tests": [
|
||||
"CANCELLED_EXCLUDED",
|
||||
"DATE_FILTER",
|
||||
"MAGAZINE_FILTER",
|
||||
"SORTED_BY_REVENUE",
|
||||
"TOTALS_AND_COUNTS",
|
||||
"TWO_MAGAZINES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SUBS_SUM",
|
||||
"mutant": "line 35: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "2/8",
|
||||
"failed_tests": [
|
||||
"CANCELLED_EXCLUDED",
|
||||
"EMPTY_RESULT",
|
||||
"MAGAZINE_FILTER",
|
||||
"SMALL_GROUP_HIDDEN",
|
||||
"TOTALS_AND_COUNTS",
|
||||
"TWO_MAGAZINES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SUBS_SUM",
|
||||
"mutant": "line 35: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "1/8",
|
||||
"failed_tests": [
|
||||
"CANCELLED_EXCLUDED",
|
||||
"DATE_FILTER",
|
||||
"EMPTY_RESULT",
|
||||
"MAGAZINE_FILTER",
|
||||
"SORTED_BY_REVENUE",
|
||||
"TOTALS_AND_COUNTS",
|
||||
"TWO_MAGAZINES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SUBS_SUM",
|
||||
"mutant": "line 36: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "2/8",
|
||||
"failed_tests": [
|
||||
"CANCELLED_EXCLUDED",
|
||||
"EMPTY_RESULT",
|
||||
"MAGAZINE_FILTER",
|
||||
"SMALL_GROUP_HIDDEN",
|
||||
"TOTALS_AND_COUNTS",
|
||||
"TWO_MAGAZINES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SUBS_SUM",
|
||||
"mutant": "line 43: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "0/8",
|
||||
"failed_tests": [
|
||||
"CANCELLED_EXCLUDED",
|
||||
"DATE_FILTER",
|
||||
"EMPTY_RESULT",
|
||||
"MAGAZINE_FILTER",
|
||||
"SMALL_GROUP_HIDDEN",
|
||||
"SORTED_BY_REVENUE",
|
||||
"TOTALS_AND_COUNTS",
|
||||
"TWO_MAGAZINES"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
111
tasks_gen/train/G1118/reference/subs_sum.prog.abap
Normal file
111
tasks_gen/train/G1118/reference/subs_sum.prog.abap
Normal file
@@ -0,0 +1,111 @@
|
||||
REPORT {{p}}subs_sum.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
magazine TYPE {{p}}subs-magazine,
|
||||
num_subs TYPE i,
|
||||
revenue TYPE {{p}}subs-monthly_fee,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
|
||||
TYPES tt_magazine TYPE RANGE OF {{p}}subs-magazine.
|
||||
|
||||
DATA gv_magazine TYPE {{p}}subs-magazine.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_mag FOR gv_magazine.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_magazine TYPE tt_magazine
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS keep_regulars
|
||||
IMPORTING it_lines TYPE tt_line
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
CLASS-METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT magazine COUNT( * ) AS num_subs SUM( monthly_fee ) AS revenue
|
||||
FROM {{p}}subs
|
||||
INTO CORRESPONDING FIELDS OF TABLE rt_lines
|
||||
WHERE sub_status = 'A'
|
||||
AND start_date >= iv_from
|
||||
AND magazine IN it_magazine
|
||||
GROUP BY magazine.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keep_regulars.
|
||||
DATA ls_line TYPE ty_line.
|
||||
LOOP AT it_lines INTO ls_line.
|
||||
IF ls_line-num_subs >= 2.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY revenue DESCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA: lo_alv TYPE REF TO cl_salv_table,
|
||||
lo_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lo_error.
|
||||
MESSAGE lo_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA gt_lines TYPE tt_line.
|
||||
gt_lines = lcl_report=>select_totals( iv_from = p_from it_magazine = s_mag[] ).
|
||||
gt_lines = lcl_report=>keep_regulars( gt_lines ).
|
||||
lcl_report=>display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS removes_small_groups FOR TESTING.
|
||||
METHODS sorts_by_revenue FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD removes_small_groups.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'SMALL'.
|
||||
ls_line-num_subs = 1.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'BIG'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 20.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_kept ) ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BIG' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_revenue.
|
||||
DATA: lt_lines TYPE tt_line,
|
||||
lt_kept TYPE tt_line,
|
||||
ls_line TYPE ty_line.
|
||||
ls_line-magazine = 'LOW'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 10.
|
||||
APPEND ls_line TO lt_lines.
|
||||
ls_line-magazine = 'HIGH'.
|
||||
ls_line-num_subs = 2.
|
||||
ls_line-revenue = 30.
|
||||
APPEND ls_line TO lt_lines.
|
||||
lt_kept = lcl_report=>keep_regulars( lt_lines ).
|
||||
READ TABLE lt_kept INTO ls_line INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = ls_line-magazine ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
13
tasks_gen/train/G1118/seed/subs.tabl.asabap
Normal file
13
tasks_gen/train/G1118/seed/subs.tabl.asabap
Normal file
@@ -0,0 +1,13 @@
|
||||
@EndUserText.label : 'Magazine subscriptions'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}subs {
|
||||
key client : abap.clnt not null;
|
||||
key subs_id : abap.int4 not null;
|
||||
magazine : abap.char(12);
|
||||
sub_status : abap.char(1);
|
||||
start_date : abap.dats;
|
||||
monthly_fee : abap.dec(15,2);
|
||||
}
|
||||
20
tasks_gen/train/G1118/seed/t15_seed.clas.abap
Normal file
20
tasks_gen/train/G1118/seed/t15_seed.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}t15_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}t15_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}subs.
|
||||
INSERT {{p}}subs FROM TABLE @( VALUE #(
|
||||
( subs_id = 1 magazine = 'ORBIT' sub_status = 'A' start_date = '20260101' monthly_fee = '12.00' )
|
||||
( subs_id = 2 magazine = 'ORBIT' sub_status = 'A' start_date = '20260201' monthly_fee = '8.00' )
|
||||
( subs_id = 3 magazine = 'ORBIT' sub_status = 'C' start_date = '20260101' monthly_fee = '20.00' )
|
||||
( subs_id = 4 magazine = 'NATURE' sub_status = 'A' start_date = '20260115' monthly_fee = '30.00' )
|
||||
( subs_id = 5 magazine = 'NATURE' sub_status = 'A' start_date = '20260301' monthly_fee = '10.00' )
|
||||
( subs_id = 6 magazine = 'NATURE' sub_status = 'A' start_date = '20251201' monthly_fee = '5.00' )
|
||||
( subs_id = 7 magazine = 'SPORT' sub_status = 'A' start_date = '20260110' monthly_fee = '25.00' )
|
||||
( subs_id = 8 magazine = 'SPORT' sub_status = 'C' start_date = '20260210' monthly_fee = '15.00' ) ) ).
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
38
tasks_gen/train/G1118/spec.md
Normal file
38
tasks_gen/train/G1118/spec.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# 1. Goal
|
||||
Show the subscriptions of each magazine in an ALV list. The publisher uses the
|
||||
list to compare the magazines for a period.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Table {{P}}SUBS exists in package $TMP. It contains data.
|
||||
Fields: SUBS_ID (INT4, key), MAGAZINE (CHAR 12), SUB_STATUS (CHAR 1),
|
||||
START_DATE (DATS), MONTHLY_FEE (DEC 15,2).
|
||||
- SUB_STATUS is 'A' for an active subscription and 'C' for a cancelled
|
||||
subscription.
|
||||
|
||||
# 4. Contract
|
||||
- Create the executable program {{P}}SUBS_SUM in package $TMP.
|
||||
- Selection screen:
|
||||
- Parameter P_FROM, type DATS, mandatory: the first start date to include.
|
||||
- Select-option S_MAG for the magazine.
|
||||
- Show the result with CL_SALV_TABLE. The output table has these columns, with
|
||||
these names: MAGAZINE, NUM_SUBS (number of included subscriptions),
|
||||
REVENUE (sum of MONTHLY_FEE).
|
||||
|
||||
# 5. Business rules
|
||||
1. Include a subscription only if SUB_STATUS is 'A', START_DATE is on or after
|
||||
P_FROM, and MAGAZINE is in S_MAG.
|
||||
2. Show one line for each magazine that has at least two included subscriptions.
|
||||
3. Sort the lines by REVENUE, the highest revenue first.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.40 SP05. Use only syntax that this release supports.
|
||||
- Coding standards: Clean ABAP. Read the data with one database access.
|
||||
- Out of scope: do not change {{P}}SUBS.
|
||||
|
||||
# 7. Acceptance
|
||||
- The program is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests as local test classes in the program.
|
||||
60
tasks_gen/train/G1118/task.json
Normal file
60
tasks_gen/train/G1118/task.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"id": "G1118",
|
||||
"category": "G",
|
||||
"object_type": "PROG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v740sp05",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}SUBS",
|
||||
"file": "seed/subs.tabl.asabap",
|
||||
"description": "Magazine subscriptions"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T15_SEED",
|
||||
"file": "seed/t15_seed.clas.abap",
|
||||
"description": "T15 seed data",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}SUBS_SUM",
|
||||
"parameters": [
|
||||
"p_from",
|
||||
"s_mag"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}SUBS"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T15_HIDDEN",
|
||||
"file": "hidden/t15_hidden.clas.abap",
|
||||
"description": "T15 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}SUBS_SUM",
|
||||
"file": "reference/subs_sum.prog.abap",
|
||||
"description": "Subscriptions per magazine"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"db_operation_in_loop",
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user