CLASS {{p}}t15_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. TYPES tt_customer TYPE RANGE OF {{p}}sharpen-customer. METHODS run IMPORTING iv_from TYPE d it_customer TYPE tt_customer 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 all_customers FOR TESTING. METHODS sorted_by_fee FOR TESTING. METHODS fee_and_knives FOR TESTING. METHODS customer_filter FOR TESTING. METHODS date_filter FOR TESTING. METHODS unknown_type FOR TESTING. ENDCLASS. CLASS {{p}}t15_hidden IMPLEMENTATION. METHOD run. DATA(lt_customer) = it_customer. IF lt_customer IS INITIAL. lt_customer = VALUE #( ( sign = 'E' option = 'EQ' low = 'X' ) ). ENDIF. cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). SUBMIT {{p}}sharp_sum WITH p_from = iv_from WITH s_cust IN lt_customer 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 TYPE STANDARD TABLE. IF ir_data IS NOT BOUND. RETURN. ENDIF. ASSIGN ir_data->* TO . IF sy-subrc = 0. rv_lines = lines( ). ENDIF. ENDMETHOD. METHOD value_of. FIELD-SYMBOLS TYPE STANDARD TABLE. FIELD-SYMBOLS TYPE any. FIELD-SYMBOLS TYPE any. IF ir_data IS NOT BOUND. cl_abap_unit_assert=>fail( msg = 'No result table' ). ENDIF. ASSIGN ir_data->* TO . cl_abap_unit_assert=>assert_subrc( exp = 0 msg = 'No result table' ). READ TABLE INDEX iv_row ASSIGNING . cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Row { iv_row } is missing| ). ASSIGN COMPONENT iv_col OF STRUCTURE TO . cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } is missing| ). rv_value = condense( CONV string( ) ). ENDMETHOD. METHOD all_customers. cl_abap_unit_assert=>assert_equals( exp = 4 act = lines_of( run( '20260101' ) ) ). ENDMETHOD. METHOD sorted_by_fee. DATA(lr_data) = run( '20260101' ). cl_abap_unit_assert=>assert_equals( exp = `CANTEEN` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `CUSTOMER` ) ). cl_abap_unit_assert=>assert_equals( exp = `DELI` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `CUSTOMER` ) ). ENDMETHOD. METHOD fee_and_knives. DATA(lr_data) = run( '20260101' ). cl_abap_unit_assert=>assert_equals( exp = `TRATTORIA` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `CUSTOMER` ) ). cl_abap_unit_assert=>assert_equals( exp = `14` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `KNIVES` ) ). cl_abap_unit_assert=>assert_equals( exp = `26.00` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FEE` ) ). ENDMETHOD. METHOD customer_filter. DATA(lr_data) = run( iv_from = '20260101' it_customer = VALUE #( ( sign = 'I' option = 'EQ' low = 'BISTRO' ) ) ). cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). cl_abap_unit_assert=>assert_equals( exp = `12.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FEE` ) ). ENDMETHOD. METHOD date_filter. cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( run( '20260113' ) ) ). ENDMETHOD. METHOD unknown_type. DATA(lr_data) = run( iv_from = '20260101' it_customer = VALUE #( ( sign = 'I' option = 'EQ' low = 'DELI' ) ) ). cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). cl_abap_unit_assert=>assert_equals( exp = `5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `KNIVES` ) ). ENDMETHOD. ENDCLASS.