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 4 / n)
  • Loading branch information
NeumannJoerg committed Jul 8, 2024
1 parent 9c32fd5 commit dc2bc40
Show file tree
Hide file tree
Showing 67 changed files with 2,140 additions and 3,241 deletions.
11 changes: 5 additions & 6 deletions src/#usi#bal_cust_evaluation/#usi#cl_bal_ce_cx_mapper.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ CLASS /usi/cl_bal_ce_cx_mapper IMPLEMENTATION.
ENDMETHOD.

METHOD get_mapper_class.
DATA: customizing_entry TYPE ty_customizing_entry,
exception_classname TYPE /usi/bal_exception_classname,
DATA: exception_classname TYPE /usi/bal_exception_classname,
superclass_description TYPE REF TO cl_abap_classdescr.

FIELD-SYMBOLS: <customizing_entry> TYPE ty_customizing_entry,
Expand Down Expand Up @@ -102,10 +101,10 @@ CLASS /usi/cl_bal_ce_cx_mapper IMPLEMENTATION.
ENDIF.

" Extend customizing to speed up subsequent calls
customizing_entry-exception_class_type = class_type-class.
customizing_entry-exception_class_name = i_exception_class_description->get_relative_name( ).
customizing_entry-mapper_class_name = r_result.
INSERT customizing_entry INTO TABLE customizing_entries.
INSERT VALUE #( exception_class_type = class_type-class
exception_class_name = i_exception_class_description->get_relative_name( )
mapper_class_name = r_result )
INTO TABLE customizing_entries.
ENDMETHOD.

METHOD get_validated_customizing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,19 @@ CLASS lcl_unit_tests IMPLEMENTATION.
METHOD test_ignore_invalid_mappers.
DATA: test_exception TYPE REF TO /usi/cx_bal_root,
customizing_records TYPE /usi/if_bal_cd_cx_mapper=>ty_records,
customizing_record TYPE /usi/if_bal_cd_cx_mapper=>ty_record,
expected_result TYPE /usi/bal_exception_mapper.

TRY.
RAISE EXCEPTION TYPE /usi/cx_bal_not_found.
CATCH /usi/cx_bal_root INTO test_exception.
ENDTRY.

customizing_record-exception_class = '/USI/CX_BAL_NOT_FOUND'.
customizing_record-mapper_class = 'CL_GUI_ALV_GRID'.
INSERT customizing_record INTO TABLE customizing_records.
customizing_record-exception_class = '/USI/CX_BAL_ROOT'.
customizing_record-mapper_class = '/USI/CL_BAL_EM_BASE'.
INSERT customizing_record INTO TABLE customizing_records.
customizing_record-exception_class = '/USI/CX_EXCEPTION'.
customizing_record-mapper_class = '/USI/CL_BAL_UNKNOWN_CLASS'.
INSERT customizing_record INTO TABLE customizing_records.
customizing_records = VALUE #( ( exception_class = '/USI/CX_BAL_NOT_FOUND'
mapper_class = 'CL_GUI_ALV_GRID' )
( exception_class = '/USI/CX_BAL_ROOT'
mapper_class = '/USI/CL_BAL_EM_BASE' )
( exception_class = '/USI/CX_EXCEPTION'
mapper_class = '/USI/CL_BAL_UNKNOWN_CLASS' ) ).

expected_result = cut->get_fallback_mapper_classname( ).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ CLASS /usi/cl_bal_object_descr IMPLEMENTATION.
ENDMETHOD.

METHOD is_interface.
IF object_description->kind = cl_abap_typedescr=>kind_intf.
r_result = abap_true.
ENDIF.
r_result = boolc( object_description->kind = cl_abap_typedescr=>kind_intf ).
ENDMETHOD.
ENDCLASS.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ ENDCLASS.

CLASS lcl_unit_test_read_only IMPLEMENTATION.
METHOD assert_public_attrib_read_only.
DATA cut_description TYPE REF TO /usi/cl_bal_aunit_cut_descr_cl.
cut_description = /usi/cl_bal_aunit_cut_descr_cl=>get_instance( ).
DATA(cut_description) = /usi/cl_bal_aunit_cut_descr_cl=>get_instance( ).
cut_description->assert_public_attrib_read_only( ).
ENDMETHOD.
ENDCLASS.
32 changes: 13 additions & 19 deletions src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,11 @@ CLASS /usi/cl_bal_dc_callstack IMPLEMENTATION.
ENDMETHOD.

METHOD /usi/if_bal_data_container~deserialize.
DATA: callstack TYPE abap_callstack,
deserializer TYPE REF TO /usi/cl_bal_serializer.
DATA callstack TYPE abap_callstack.

deserializer = NEW #( ).
deserializer->deserialize_field( EXPORTING i_serialized_data = i_serialized_data_container
i_name = 'CALLSTACK'
CHANGING c_data = callstack ).
NEW /usi/cl_bal_serializer( )->deserialize_field( EXPORTING i_serialized_data = i_serialized_data_container
i_name = 'CALLSTACK'
CHANGING c_data = callstack ).

r_result = NEW /usi/cl_bal_dc_callstack( i_callstack = callstack ).
ENDMETHOD.
Expand All @@ -89,27 +87,23 @@ CLASS /usi/cl_bal_dc_callstack IMPLEMENTATION.
ENDMETHOD.

METHOD /usi/if_bal_data_container~serialize.
DATA serializer TYPE REF TO /usi/cl_bal_serializer.

serializer = NEW #( ).
r_result = serializer->serialize_field_as_json( i_data = callstack
i_name = 'CALLSTACK' ).
r_result = NEW /usi/cl_bal_serializer( )->serialize_field_as_json( i_data = callstack
i_name = 'CALLSTACK' ).
ENDMETHOD.


METHOD constructor.
callstack = i_callstack.
ENDMETHOD.


METHOD get_excluded_grid_functions.
INSERT cl_gui_alv_grid=>mc_fc_excl_all INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_loc_copy INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_col_optimize INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_unfix_columns INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_fix_columns INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_col_invisible INTO TABLE r_result.
INSERT cl_gui_alv_grid=>mc_fc_current_variant INTO TABLE r_result.
r_result = VALUE #( ( cl_gui_alv_grid=>mc_fc_excl_all )

Check failure on line 100 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_loc_copy )

Check failure on line 101 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_col_optimize )

Check failure on line 102 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_unfix_columns )

Check failure on line 103 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_fix_columns )

Check failure on line 104 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_col_invisible )

Check failure on line 105 in src/#usi#bal_data_containers/#usi#cl_bal_dc_callstack.clas.abap

View workflow job for this annotation

GitHub Actions / results

Remove double space

double_space
( cl_gui_alv_grid=>mc_fc_current_variant ) ).
ENDMETHOD.


Expand Down
87 changes: 31 additions & 56 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 @@ -6,15 +6,12 @@ CLASS /usi/cl_bal_dc_collection DEFINITION PUBLIC FINAL CREATE PUBLIC.
ALIASES: deserialize FOR /usi/if_bal_data_container_col~deserialize,
insert FOR /usi/if_bal_data_container_col~insert.

PROTECTED SECTION.

PRIVATE SECTION.
TYPES: BEGIN OF ty_data_cont_coll_item,
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.

Check failure on line 14 in src/#usi#bal_data_containers/#usi#cl_bal_dc_collection.clas.abap

View workflow job for this annotation

GitHub Actions / results

Reduce line length to max 120, currently 124

line_length

TYPES: BEGIN OF ty_serialized_data_container,
data_container_classname TYPE /usi/bal_data_cont_classname,
Expand All @@ -25,83 +22,67 @@ CLASS /usi/cl_bal_dc_collection DEFINITION PUBLIC FINAL CREATE PUBLIC.
DATA data_cont_coll_items TYPE ty_data_cont_coll_items.

METHODS is_cardinality_violation
IMPORTING
i_data_container TYPE REF TO /usi/if_bal_data_container
RETURNING
VALUE(r_result) TYPE abap_bool.
IMPORTING i_data_container TYPE REF TO /usi/if_bal_data_container
RETURNING VALUE(r_result) TYPE abap_bool.

METHODS is_duplicate
IMPORTING
i_data_container TYPE REF TO /usi/if_bal_data_container
RETURNING
VALUE(r_result) TYPE abap_bool
RAISING
/usi/cx_bal_root.
IMPORTING i_data_container TYPE REF TO /usi/if_bal_data_container
RETURNING VALUE(r_result) TYPE abap_bool
RAISING /usi/cx_bal_root.

ENDCLASS.



CLASS /usi/cl_bal_dc_collection IMPLEMENTATION.
METHOD /usi/if_bal_data_container_col~deserialize.
DATA: data_container TYPE REF TO /usi/if_bal_data_container,
exception TYPE REF TO cx_root,
exception_text TYPE string,
serialized_data_containers TYPE ty_serialized_data_containers.

FIELD-SYMBOLS <serialized_data_container> TYPE ty_serialized_data_container.

TRY.
CALL TRANSFORMATION id
SOURCE XML i_serialized_data_cont_coll
RESULT serialized_data_containers = serialized_data_containers.
SOURCE XML i_serialized_data_cont_coll
RESULT serialized_data_containers = serialized_data_containers.
CATCH cx_transformation_error INTO exception.
RAISE EXCEPTION TYPE /usi/cx_bal_type_mismatch
EXPORTING
textid = /usi/cx_bal_type_mismatch=>/usi/cx_bal_type_mismatch
previous = exception.
EXPORTING textid = /usi/cx_bal_type_mismatch=>/usi/cx_bal_type_mismatch
previous = exception.
ENDTRY.

CREATE OBJECT r_result TYPE /usi/cl_bal_dc_collection.
LOOP AT serialized_data_containers ASSIGNING <serialized_data_container>.
r_result = NEW /usi/cl_bal_dc_collection( ).
LOOP AT serialized_data_containers ASSIGNING FIELD-SYMBOL(<serialized_data_container>).
TRY.
CALL METHOD (<serialized_data_container>-data_container_classname)=>/usi/if_bal_data_container~deserialize
EXPORTING
i_serialized_data_container = <serialized_data_container>-serialized_data_container
RECEIVING
r_result = data_container.
EXPORTING i_serialized_data_container = <serialized_data_container>-serialized_data_container
RECEIVING r_result = data_container.

r_result->insert( data_container ).
CATCH cx_sy_dyn_call_error
/usi/cx_bal_root INTO exception.
exception_text = exception->get_text( ).
ASSERT ID /usi/bal_log_writer
FIELDS exception_text
CONDITION exception IS NOT BOUND.
FIELDS exception_text
CONDITION exception IS NOT BOUND.

CONTINUE.
ENDTRY.
ENDLOOP.
ENDMETHOD.


METHOD /usi/if_bal_data_container_col~get_data_containers.
FIELD-SYMBOLS <data_cont_coll_item> TYPE ty_data_cont_coll_item.
LOOP AT data_cont_coll_items ASSIGNING <data_cont_coll_item>.
LOOP AT data_cont_coll_items ASSIGNING FIELD-SYMBOL(<data_cont_coll_item>).
INSERT <data_cont_coll_item>-data_container INTO TABLE r_result.
ENDLOOP.
ENDMETHOD.


METHOD /usi/if_bal_data_container_col~has_data_containers.
IF data_cont_coll_items IS NOT INITIAL.
r_result = abap_true.
ENDIF.
ENDMETHOD.

METHOD /usi/if_bal_data_container_col~insert.
DATA new_data_cont_coll_item TYPE ty_data_cont_coll_item.

r_result = me.

TRY.
Expand All @@ -113,38 +94,32 @@ CLASS /usi/cl_bal_dc_collection IMPLEMENTATION.
RETURN.
ENDTRY.

new_data_cont_coll_item-data_container_classname = i_data_container->get_classname( ).
new_data_cont_coll_item-data_container = i_data_container.
INSERT new_data_cont_coll_item INTO TABLE data_cont_coll_items.
INSERT VALUE #( data_container_classname = i_data_container->get_classname( )
data_container = i_data_container )
INTO TABLE data_cont_coll_items.
ENDMETHOD.


METHOD /usi/if_bal_data_container_col~serialize.
DATA: exception TYPE REF TO /usi/cx_bal_root,
exception_text TYPE string,
serialized_data_containers TYPE ty_serialized_data_containers,
serialized_data_container TYPE ty_serialized_data_container.
DATA serialized_data_containers TYPE ty_serialized_data_containers.

FIELD-SYMBOLS <data_cont_coll_item> TYPE ty_data_cont_coll_item.

LOOP AT data_cont_coll_items ASSIGNING <data_cont_coll_item>.
LOOP AT data_cont_coll_items ASSIGNING FIELD-SYMBOL(<data_cont_coll_item>).
TRY.
serialized_data_container-data_container_classname = <data_cont_coll_item>-data_container_classname.
serialized_data_container-serialized_data_container = <data_cont_coll_item>-data_container->serialize( ).
INSERT serialized_data_container INTO TABLE serialized_data_containers.
CATCH /usi/cx_bal_root INTO exception.
INSERT VALUE #( data_container_classname = <data_cont_coll_item>-data_container_classname
serialized_data_container = <data_cont_coll_item>-data_container->serialize( ) )
INTO TABLE serialized_data_containers.
CATCH /usi/cx_bal_root INTO DATA(exception).
" Corrupt container data? Drop container!
exception_text = exception->get_text( ).
DATA(exception_text) = exception->get_text( ).
ASSERT ID /usi/bal_log_writer
FIELDS exception_text
CONDITION exception IS NOT BOUND.
FIELDS exception_text
CONDITION exception IS NOT BOUND.
CONTINUE.
ENDTRY.
ENDLOOP.

CALL TRANSFORMATION id
SOURCE serialized_data_containers = serialized_data_containers
RESULT XML r_result.
SOURCE serialized_data_containers = serialized_data_containers
RESULT XML r_result.
ENDMETHOD.

METHOD is_cardinality_violation.
Expand Down
Loading

0 comments on commit dc2bc40

Please sign in to comment.