Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged
- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
95
tasks_gen/eval/G0015/reference/bill_age.prog.abap
Normal file
95
tasks_gen/eval/G0015/reference/bill_age.prog.abap
Normal file
@@ -0,0 +1,95 @@
|
||||
REPORT {{p}}bill_age.
|
||||
|
||||
DATA gv_customer TYPE {{p}}bill-customer.
|
||||
|
||||
PARAMETERS p_date TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_cust FOR gv_customer.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
customer TYPE {{p}}bill-customer,
|
||||
open_count TYPE i,
|
||||
open_amount TYPE {{p}}bill-amount,
|
||||
overdue_amount TYPE {{p}}bill-amount,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_customer TYPE RANGE OF {{p}}bill-customer.
|
||||
METHODS select_open_items
|
||||
IMPORTING iv_date TYPE d
|
||||
it_customer TYPE tt_customer
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_open_items.
|
||||
SELECT customer,
|
||||
COUNT( * ) AS open_count,
|
||||
SUM( amount ) AS open_amount,
|
||||
SUM( CASE WHEN due_date < @iv_date THEN amount ELSE 0 END ) AS overdue_amount
|
||||
FROM {{p}}bill
|
||||
WHERE paid <> 'X'
|
||||
AND customer IN @it_customer
|
||||
GROUP BY customer
|
||||
ORDER BY open_amount 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_open_items( iv_date = p_date it_customer = s_cust[] ).
|
||||
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 open_invoices_only FOR TESTING.
|
||||
METHODS overdue_amount FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}BILL' ) ) ).
|
||||
DATA lt_bill TYPE STANDARD TABLE OF {{p}}bill WITH EMPTY KEY.
|
||||
lt_bill = VALUE #( ( bill_id = 1 customer = 'A' due_date = '20260101' amount = 10 paid = ' ' )
|
||||
( bill_id = 2 customer = 'A' due_date = '20260301' amount = 5 paid = ' ' )
|
||||
( bill_id = 3 customer = 'B' due_date = '20260101' amount = 40 paid = 'X' ) ).
|
||||
go_env->insert_test_data( lt_bill ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD open_invoices_only.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_open_items( iv_date = '20260101'
|
||||
it_customer = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_lines[ 1 ]-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-open_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}bill-amount( 15 ) act = lt_lines[ 1 ]-open_amount ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD overdue_amount.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_open_items( iv_date = '20260201'
|
||||
it_customer = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}bill-amount( 10 )
|
||||
act = lt_lines[ 1 ]-overdue_amount ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user