Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
89
tasks_gen/eval/G0174/reference/flower_sales.prog.abap
Normal file
89
tasks_gen/eval/G0174/reference/flower_sales.prog.abap
Normal file
@@ -0,0 +1,89 @@
|
||||
REPORT {{p}}flower_sales.
|
||||
|
||||
DATA gv_flower TYPE {{p}}flsale-flower_type.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_flower FOR gv_flower.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
flower_type TYPE {{p}}flsale-flower_type,
|
||||
total_revenue TYPE {{p}}flsale-amount,
|
||||
count TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
|
||||
TYPES tt_flower TYPE RANGE OF {{p}}flsale-flower_type.
|
||||
METHODS select_totals
|
||||
IMPORTING iv_from TYPE d
|
||||
it_flower TYPE tt_flower
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_totals.
|
||||
SELECT flower_type, SUM( amount ) AS total_revenue, COUNT( * ) AS count
|
||||
FROM {{p}}flsale
|
||||
WHERE sale_date >= @iv_from
|
||||
AND flower_type IN @it_flower
|
||||
GROUP BY flower_type
|
||||
ORDER BY total_revenue DESCENDING
|
||||
INTO CORRESPONDING FIELDS OF TABLE @rt_lines.
|
||||
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_totals( iv_from = p_from it_flower = s_flower[] ).
|
||||
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 totals_per_flower FOR TESTING.
|
||||
METHODS flower_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}FLSALE' ) ) ).
|
||||
DATA lt_sale TYPE STANDARD TABLE OF {{p}}flsale WITH EMPTY KEY.
|
||||
lt_sale = VALUE #( ( sale_id = 1 flower_type = 'ROSE' sale_date = '20260101' amount = 10 )
|
||||
( sale_id = 2 flower_type = 'ROSE' sale_date = '20260102' amount = 5 )
|
||||
( sale_id = 3 flower_type = 'TULIP' sale_date = '20260101' amount = 40 ) ).
|
||||
go_env->insert_test_data( lt_sale ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_per_flower.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_totals( iv_from = '20260101' it_flower = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TULIP' act = lt_lines[ 1 ]-flower_type ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 2 ]-count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD flower_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_totals(
|
||||
iv_from = '20260101' it_flower = VALUE #( ( sign = 'I' option = 'EQ' low = 'ROSE' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}flsale-amount( 15 ) act = lt_lines[ 1 ]-total_revenue ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user