Group unsupported object type messages (#4589)

* Group unsupported messages per object type

When number of unsupported objects increase in a package, user needs to scroll through the long list of messages. This change groups messages per object type reducing the number of messages. Also, the filtering before serialization is good in terms of effective work process utilization( in parallel mode ).

* Replace LINE_EXISTS with READ TABLE

* Cache the supported object types

* Show object name 

If there is only one object name for the unsupported object type, show the name.

* Spelling: "object(s)" to "objects"

Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
yellappam 2021-03-03 17:36:21 +13:00 committed by GitHub
parent 011dfc6590
commit 09353951eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 5 deletions

View File

@ -35,6 +35,12 @@ CLASS zcl_abapgit_serialize DEFINITION
zcx_abapgit_exception . zcx_abapgit_exception .
PROTECTED SECTION. PROTECTED SECTION.
TYPES: BEGIN OF ty_unsupported_count,
obj_type TYPE tadir-object,
obj_name TYPE tadir-obj_name,
count TYPE i,
END OF ty_unsupported_count,
ty_unsupported_count_tt TYPE HASHED TABLE OF ty_unsupported_count WITH UNIQUE KEY obj_type.
TYPES: TYPES:
ty_char32 TYPE c LENGTH 32 . ty_char32 TYPE c LENGTH 32 .
@ -102,12 +108,15 @@ CLASS zcl_abapgit_serialize DEFINITION
VALUE(rv_threads) TYPE i VALUE(rv_threads) TYPE i
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
METHODS filter_unsupported_objects
CHANGING
!ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt.
PRIVATE SECTION. PRIVATE SECTION.
ENDCLASS. ENDCLASS.
CLASS zcl_abapgit_serialize IMPLEMENTATION. CLASS ZCL_ABAPGIT_SERIALIZE IMPLEMENTATION.
METHOD add_apack. METHOD add_apack.
@ -326,6 +335,56 @@ CLASS zcl_abapgit_serialize IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD filter_unsupported_objects.
DATA: ls_unsupported_count TYPE ty_unsupported_count,
lt_supported_types TYPE zcl_abapgit_objects=>ty_types_tt,
lt_unsupported_count TYPE ty_unsupported_count_tt.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF ct_tadir,
<ls_unsupported_count> TYPE ty_unsupported_count.
lt_supported_types = zcl_abapgit_objects=>supported_list( ).
LOOP AT ct_tadir ASSIGNING <ls_tadir>.
CLEAR: ls_unsupported_count.
READ TABLE lt_supported_types WITH KEY table_line = <ls_tadir>-object TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
READ TABLE lt_unsupported_count ASSIGNING <ls_unsupported_count>
WITH TABLE KEY obj_type = <ls_tadir>-object.
IF sy-subrc <> 0.
ls_unsupported_count-obj_type = <ls_tadir>-object.
ls_unsupported_count-count = 1.
ls_unsupported_count-obj_name = <ls_tadir>-obj_name.
INSERT ls_unsupported_count INTO TABLE lt_unsupported_count ASSIGNING <ls_unsupported_count>.
ELSE.
CLEAR: <ls_unsupported_count>-obj_name.
<ls_unsupported_count>-count = <ls_unsupported_count>-count + 1.
ENDIF.
CLEAR: <ls_tadir>-object.
ENDLOOP.
IF lt_unsupported_count IS INITIAL.
RETURN.
ENDIF.
DELETE ct_tadir WHERE object IS INITIAL.
IF mi_log IS BOUND.
LOOP AT lt_unsupported_count ASSIGNING <ls_unsupported_count>.
IF <ls_unsupported_count>-count = 1.
mi_log->add_error( iv_msg = |Object type { <ls_unsupported_count>-obj_type } not supported, {
<ls_unsupported_count>-obj_name } ignored| ).
ELSE.
mi_log->add_error( iv_msg = |Object type { <ls_unsupported_count>-obj_type } not supported, {
<ls_unsupported_count>-count } objects ignored| ).
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD on_end_of_task. METHOD on_end_of_task.
* this method will be called from the parallel processing, thus it must be public * this method will be called from the parallel processing, thus it must be public
@ -440,7 +499,8 @@ CLASS zcl_abapgit_serialize IMPLEMENTATION.
* serializes only objects * serializes only objects
DATA: lv_max TYPE i, DATA: lv_max TYPE i,
li_progress TYPE REF TO zif_abapgit_progress. li_progress TYPE REF TO zif_abapgit_progress,
lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF it_tadir. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF it_tadir.
@ -451,9 +511,11 @@ CLASS zcl_abapgit_serialize IMPLEMENTATION.
mv_free = lv_max. mv_free = lv_max.
mi_log = ii_log. mi_log = ii_log.
li_progress = zcl_abapgit_progress=>get_instance( lines( it_tadir ) ). lt_tadir = it_tadir.
filter_unsupported_objects( CHANGING ct_tadir = lt_tadir ).
li_progress = zcl_abapgit_progress=>get_instance( lines( lt_tadir ) ).
LOOP AT it_tadir ASSIGNING <ls_tadir>. LOOP AT lt_tadir ASSIGNING <ls_tadir>.
li_progress->show( li_progress->show(
iv_current = sy-tabix iv_current = sy-tabix

View File

@ -94,6 +94,7 @@ CLASS zcl_abapgit_objects DEFINITION
ty_obj_serializer_map TYPE SORTED TABLE OF ty_obj_serializer_item WITH UNIQUE KEY item . ty_obj_serializer_map TYPE SORTED TABLE OF ty_obj_serializer_item WITH UNIQUE KEY item .
CLASS-DATA gt_obj_serializer_map TYPE ty_obj_serializer_map . CLASS-DATA gt_obj_serializer_map TYPE ty_obj_serializer_map .
CLASS-DATA gt_supported_obj_types TYPE ty_types_tt .
CLASS-METHODS files_to_deserialize CLASS-METHODS files_to_deserialize
IMPORTING IMPORTING
@ -229,7 +230,7 @@ ENDCLASS.
CLASS zcl_abapgit_objects IMPLEMENTATION. CLASS ZCL_ABAPGIT_OBJECTS IMPLEMENTATION.
METHOD adjust_namespaces. METHOD adjust_namespaces.
@ -1257,6 +1258,10 @@ CLASS zcl_abapgit_objects IMPLEMENTATION.
FIELD-SYMBOLS <ls_object> LIKE LINE OF lt_objects. FIELD-SYMBOLS <ls_object> LIKE LINE OF lt_objects.
IF gt_supported_obj_types IS NOT INITIAL.
rt_types = gt_supported_obj_types.
RETURN.
ENDIF.
CALL FUNCTION 'TR_OBJECT_TABLE' CALL FUNCTION 'TR_OBJECT_TABLE'
TABLES TABLES
@ -1275,6 +1280,7 @@ CLASS zcl_abapgit_objects IMPLEMENTATION.
INSERT <ls_object>-object INTO TABLE rt_types. INSERT <ls_object>-object INTO TABLE rt_types.
ENDIF. ENDIF.
ENDLOOP. ENDLOOP.
gt_supported_obj_types = rt_types.
ENDMETHOD. ENDMETHOD.