Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
17
tasks_gen/train/G1091/reference/i_po_value.ddls.asddls
Normal file
17
tasks_gen/train/G1091/reference/i_po_value.ddls.asddls
Normal file
@@ -0,0 +1,17 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
@EndUserText.label: 'Purchase order value'
|
||||
define view entity {{P}}I_PO_VALUE
|
||||
as select from {{p}}po_head as head
|
||||
inner join {{p}}po_item as item on item.po_no = head.po_no
|
||||
and item.fiscal_year = head.fiscal_year
|
||||
{
|
||||
key head.po_no as po_no,
|
||||
key head.fiscal_year as fiscal_year,
|
||||
head.supplier as supplier,
|
||||
count( * ) as item_count,
|
||||
sum( cast( item.quantity as abap.dec( 13, 0 ) ) * item.price ) as total_value
|
||||
}
|
||||
group by
|
||||
head.po_no,
|
||||
head.fiscal_year,
|
||||
head.supplier
|
||||
53
tasks_gen/train/G1091/reference/tpo_test.clas.abap
Normal file
53
tasks_gen/train/G1091/reference/tpo_test.clas.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
CLASS {{p}}tpo_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
METHODS same_number_two_years FOR TESTING.
|
||||
METHODS single_item_orders FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}tpo_test IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_PO_VALUE' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
DATA lt_head TYPE STANDARD TABLE OF {{p}}po_head WITH EMPTY KEY.
|
||||
DATA lt_item TYPE STANDARD TABLE OF {{p}}po_item WITH EMPTY KEY.
|
||||
go_env->clear_doubles( ).
|
||||
lt_head = VALUE #( ( po_no = '5000' fiscal_year = '2022' supplier = 'SUP1' )
|
||||
( po_no = '5000' fiscal_year = '2023' supplier = 'SUP2' ) ).
|
||||
lt_item = VALUE #( ( po_no = '5000' fiscal_year = '2022' item_no = 1 quantity = 1 price = '1.00' )
|
||||
( po_no = '5000' fiscal_year = '2023' item_no = 1 quantity = 2 price = '2.00' ) ).
|
||||
go_env->insert_test_data( lt_head ).
|
||||
go_env->insert_test_data( lt_item ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD same_number_two_years.
|
||||
SELECT SINGLE total_value FROM {{p}}i_po_value
|
||||
WHERE po_no = '5000' AND fiscal_year = '2022' INTO @DATA(lv_total).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1.00' )
|
||||
act = CONV decfloat34( lv_total ) ).
|
||||
SELECT SINGLE total_value FROM {{p}}i_po_value
|
||||
WHERE po_no = '5000' AND fiscal_year = '2023' INTO @DATA(lv_total_2023).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.00' )
|
||||
act = CONV decfloat34( lv_total_2023 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_item_orders.
|
||||
SELECT SINGLE item_count FROM {{p}}i_po_value
|
||||
WHERE po_no = '5000' AND fiscal_year = '2022' INTO @DATA(lv_count).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ).
|
||||
SELECT SINGLE item_count FROM {{p}}i_po_value
|
||||
WHERE po_no = '5000' AND fiscal_year = '2023' INTO @DATA(lv_count_2023).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count_2023 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user