Skip to content

Commit

Permalink
Issue #11 - Update Codebase to ABAP 7.40 SP 02
Browse files Browse the repository at this point in the history
Fixed some issues (Commit 5 / n)
  • Loading branch information
NeumannJoerg committed Jul 8, 2024
1 parent b2b34f4 commit 8b160c4
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 212 deletions.
10 changes: 5 additions & 5 deletions src/#usi#bal_data_containers/#usi#cl_bal_dc_collection.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ CLASS /usi/cl_bal_dc_collection DEFINITION PUBLIC FINAL CREATE PUBLIC.
data_container_classname TYPE /usi/bal_data_cont_classname,
data_container TYPE REF TO /usi/if_bal_data_container,
END OF ty_data_cont_coll_item,
ty_data_cont_coll_items TYPE SORTED TABLE OF ty_data_cont_coll_item WITH NON-UNIQUE KEY data_container_classname.
ty_data_cont_coll_items TYPE SORTED TABLE OF ty_data_cont_coll_item
WITH NON-UNIQUE KEY data_container_classname.

TYPES: BEGIN OF ty_serialized_data_container,
data_container_classname TYPE /usi/bal_data_cont_classname,
Expand Down Expand Up @@ -131,10 +132,9 @@ CLASS /usi/cl_bal_dc_collection IMPLEMENTATION.
ENDIF.

data_container_classname = i_data_container->get_classname( ).
IF line_exists( data_cont_coll_items[ data_container_classname = data_container_classname ] ).
" Would violate Cardinality-Restriction [0-1]
r_result = abap_true.
ENDIF.

" Existing line would violate Cardinality-Restriction [0-1]
r_result = boolc( line_exists( data_cont_coll_items[ data_container_classname = data_container_classname ] ) ).
ENDMETHOD.

METHOD is_duplicate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,9 @@ CLASS lcl_unit_test_cardinality IMPLEMENTATION.
ENDMETHOD.

METHOD has_container.
DATA data_containers TYPE /usi/bal_data_containers.
DATA(data_containers) = cut->get_data_containers( ).

data_containers = cut->get_data_containers( ).

IF line_exists( data_containers[ table_line = i_data_container ] ).
r_result = abap_true.
ENDIF.
r_result = boolc( line_exists( data_containers[ table_line = i_data_container ] ) ).
ENDMETHOD.
ENDCLASS.

Expand Down
2 changes: 1 addition & 1 deletion src/#usi#bal_data_containers/#usi#cl_bal_dc_html.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CLASS /usi/cl_bal_dc_html DEFINITION PUBLIC FINAL CREATE PUBLIC.

PRIVATE SECTION.
TYPES: ty_html_table_line TYPE c LENGTH 1000,
ty_html_table TYPE STANDARD TABLE OF ty_html_table_line WITH NON-UNIQUE DEFAULT KEY.
ty_html_table TYPE STANDARD TABLE OF ty_html_table_line WITH EMPTY KEY.

DATA: html_document TYPE string,
document_title TYPE REF TO /usi/if_bal_text_container_c40,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,7 @@ CLASS lcl_fieldcatalog_collection IMPLEMENTATION.
ENDMETHOD.

METHOD has_fieldcatalog.
IF line_exists( fieldcatalogs[ name = i_fieldcatalog_name->value ] ).
r_result = abap_true.
ENDIF.
r_result = boolc( line_exists( fieldcatalogs[ name = i_fieldcatalog_name->value ] ) ).
ENDMETHOD.
ENDCLASS.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ CLASS lcl_unit_tests_serialization IMPLEMENTATION.
field3 TYPE n LENGTH 10,
field4 TYPE p LENGTH 5 DECIMALS 2,
END OF ty_line,
ty_table TYPE STANDARD TABLE OF ty_line WITH NON-UNIQUE DEFAULT KEY.
ty_table TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.

DATA: cut TYPE REF TO /usi/cl_bal_dc_itab,
input TYPE ty_input,
Expand Down Expand Up @@ -304,7 +304,7 @@ CLASS lcl_unit_test_table_line_types IMPLEMENTATION.
TYPES: BEGIN OF ty_non_ddic_table_line,
mandt TYPE mandt,
END OF ty_non_ddic_table_line,
ty_non_ddic_table TYPE STANDARD TABLE OF ty_non_ddic_table_line WITH NON-UNIQUE DEFAULT KEY.
ty_non_ddic_table TYPE STANDARD TABLE OF ty_non_ddic_table_line WITH EMPTY KEY.

DATA: cut TYPE REF TO /usi/cl_bal_dc_itab,
input TYPE ty_non_ddic_table,
Expand Down Expand Up @@ -335,7 +335,7 @@ CLASS lcl_unit_test_table_line_types IMPLEMENTATION.

METHOD test_rejects_table_of_tables.
DATA: cut TYPE REF TO /usi/cl_bal_dc_itab,
input TYPE STANDARD TABLE OF bapirettab WITH NON-UNIQUE DEFAULT KEY.
input TYPE STANDARD TABLE OF bapirettab WITH EMPTY KEY.

TRY.
cut = NEW #( i_internal_table = input ).
Expand All @@ -351,7 +351,7 @@ CLASS lcl_unit_test_table_line_types IMPLEMENTATION.

METHOD test_rejects_table_of_orefs.
DATA: cut TYPE REF TO /usi/cl_bal_dc_itab,
input TYPE STANDARD TABLE OF REF TO cl_gui_alv_grid WITH NON-UNIQUE DEFAULT KEY.
input TYPE STANDARD TABLE OF REF TO cl_gui_alv_grid WITH EMPTY KEY.

TRY.
cut = NEW #( i_internal_table = input ).
Expand Down
2 changes: 1 addition & 1 deletion src/#usi#bal_data_containers/#usi#cl_bal_dc_json.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CLASS /usi/cl_bal_dc_json DEFINITION PUBLIC FINAL CREATE PUBLIC.

PRIVATE SECTION.
TYPES: ty_html_table_line TYPE c LENGTH 1000,
ty_html_table TYPE STANDARD TABLE OF ty_html_table_line WITH NON-UNIQUE DEFAULT KEY.
ty_html_table TYPE STANDARD TABLE OF ty_html_table_line WITH EMPTY KEY.

DATA: json_document TYPE /usi/bal_json_string,
document_title TYPE REF TO /usi/if_bal_text_container_c40,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ INTERFACE /usi/if_bal_delete_custom_data PUBLIC.
"! <p><strong>HINT:</strong> The BAdI is called from function module /USI/BAL_DELETE_CUSTOM_DATA and allows
"! multiple use.</p>
"!
"! @parameter i_log_headers | <p class="shorttext synchronized" lang="en"></p>
"! @parameter i_log_headers | <p class="shorttext synchronized" lang="en">Log headers to delete</p>
METHODS delete_custom_data
IMPORTING
i_log_headers TYPE balhdr_t.
Expand Down
2 changes: 1 addition & 1 deletion src/#usi#bal_enum/#usi#cl_bal_enum_log_level.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CLASS /usi/cl_bal_enum_log_level DEFINITION PUBLIC FINAL CREATE PRIVATE.

"! <h1>Create instances</h1>
"!
"! @parameter i_value |
"! @parameter i_value | Technical value
METHODS constructor
IMPORTING i_value TYPE /usi/bal_log_level.

Expand Down
55 changes: 28 additions & 27 deletions src/#usi#bal_enum/#usi#cl_bal_enum_log_level.clas.testclasses.abap
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
*"* use this source file for your ABAP unit test classes

*--------------------------------------------------------------------*
* Test all public static object references are bound & read-only
*--------------------------------------------------------------------*
CLASS lcl_unit_test_public_attribs DEFINITION FINAL FOR TESTING CREATE PUBLIC.
" ---------------------------------------------------------------------
" Test all public static object references are bound & read-only
" ---------------------------------------------------------------------
CLASS lcl_unit_test_public_attribs DEFINITION FINAL CREATE PUBLIC FOR TESTING.
"#AU Risk_Level Harmless
"#AU Duration Short

PRIVATE SECTION.
DATA cut_description TYPE REF TO /usi/cl_bal_aunit_cut_descr_cl.

METHODS setup.
METHODS assert_public_is_read_only FOR TESTING.
METHODS assert_public_is_read_only FOR TESTING.
METHODS assert_public_statics_bound FOR TESTING.
ENDCLASS.


CLASS lcl_unit_test_public_attribs IMPLEMENTATION.
METHOD setup.
cut_description = /usi/cl_bal_aunit_cut_descr_cl=>get_instance( ).
Expand All @@ -28,40 +30,39 @@ CLASS lcl_unit_test_public_attribs IMPLEMENTATION.
ENDMETHOD.
ENDCLASS.

*--------------------------------------------------------------------*
* Check the various helper methods of the class
*--------------------------------------------------------------------*

" ---------------------------------------------------------------------
" Check the various helper methods of the class
" ---------------------------------------------------------------------
CLASS lcl_unit_test_behavior DEFINITION FINAL FOR TESTING.
"#AU Risk_Level Harmless
"#AU Duration Short

PRIVATE SECTION.
METHODS test_raise_on_invalid_value FOR TESTING.
METHODS test_get_by_value FOR TESTING.
METHODS test_static_instances FOR TESTING.
METHODS test_is_higher FOR TESTING.
METHODS test_is_problem_class_relevant FOR TESTING.
METHODS test_raise_on_invalid_value FOR TESTING.
METHODS test_get_by_value FOR TESTING.
METHODS test_static_instances FOR TESTING.
METHODS test_is_higher FOR TESTING.
METHODS test_is_problem_class_relevant FOR TESTING.

METHODS assert_get_by_value_returns
IMPORTING
i_value TYPE /usi/bal_log_level
i_expected TYPE REF TO /usi/cl_bal_enum_log_level.
IMPORTING i_value TYPE /usi/bal_log_level
i_expected TYPE REF TO /usi/cl_bal_enum_log_level.

METHODS assert_value
IMPORTING
i_instance TYPE REF TO /usi/cl_bal_enum_log_level
i_expected TYPE /usi/bal_log_level.
IMPORTING i_instance TYPE REF TO /usi/cl_bal_enum_log_level
i_expected TYPE /usi/bal_log_level.

METHODS assert_bound
IMPORTING
i_instance TYPE REF TO /usi/cl_bal_enum_log_level.
IMPORTING i_instance TYPE REF TO /usi/cl_bal_enum_log_level.

METHODS assert_prob_class_relevant_for
IMPORTING
i_problem_class TYPE REF TO /usi/cl_bal_enum_problem_class
i_relevant_from TYPE /usi/bal_log_level
i_relevant_to TYPE /usi/bal_log_level.
IMPORTING i_problem_class TYPE REF TO /usi/cl_bal_enum_problem_class
i_relevant_from TYPE /usi/bal_log_level
i_relevant_to TYPE /usi/bal_log_level.
ENDCLASS.


CLASS lcl_unit_test_behavior IMPLEMENTATION.
METHOD test_raise_on_invalid_value.
TRY.
Expand Down Expand Up @@ -157,7 +158,7 @@ CLASS lcl_unit_test_behavior IMPLEMENTATION.
act = actual_result ).

actual_result = /usi/cl_bal_enum_log_level=>very_important->is_higher_than(
/usi/cl_bal_enum_log_level=>very_important ).
/usi/cl_bal_enum_log_level=>very_important ).
cl_aunit_assert=>assert_equals( exp = abap_false
act = actual_result ).

Expand Down Expand Up @@ -196,7 +197,7 @@ CLASS lcl_unit_test_behavior IMPLEMENTATION.
unexpected_exception TYPE REF TO /usi/cx_bal_root.

log_level = /usi/cl_bal_enum_log_level=>nothing->value.
WHILE log_level LE /usi/cl_bal_enum_log_level=>everything->value.
WHILE log_level <= /usi/cl_bal_enum_log_level=>everything->value.
TRY.
cut = /usi/cl_bal_enum_log_level=>get_by_value( log_level ).
CATCH /usi/cx_bal_root INTO unexpected_exception.
Expand Down
11 changes: 5 additions & 6 deletions src/#usi#bal_exception_mappers/#usi#cl_bal_em_base.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ CLASS /usi/cl_bal_em_base IMPLEMENTATION.
METHOD get_exceptions_oref_attributes.
DATA class_description TYPE REF TO cl_abap_classdescr.

FIELD-SYMBOLS: <attribute> TYPE abap_attrdescr,
<object> TYPE any.

class_description ?= cl_abap_classdescr=>describe_by_object_ref( exception ).
LOOP AT class_description->attributes ASSIGNING <attribute> WHERE visibility = cl_abap_classdescr=>public
AND type_kind = cl_abap_classdescr=>typekind_oref.
ASSIGN exception->(<attribute>-name) TO <object>.
LOOP AT class_description->attributes ASSIGNING FIELD-SYMBOL(<attribute>)
WHERE visibility = cl_abap_classdescr=>public
AND type_kind = cl_abap_classdescr=>typekind_oref.

ASSIGN exception->(<attribute>-name) TO FIELD-SYMBOL(<object>).
IF NOT ( sy-subrc = 0
AND <object> IS BOUND ).
CONTINUE.
Expand Down
Loading

0 comments on commit 8b160c4

Please sign in to comment.