From 25f4ee28bf9024622ddfb9024454c4b6af8bde68 Mon Sep 17 00:00:00 2001 From: Lucas Borin <5233413+lucasborin@users.noreply.github.com> Date: Wed, 31 Mar 2021 17:09:37 +0200 Subject: [PATCH 1/2] adding missing checks feature --- .../y_profile_admin_classes.prog.abap | 59 +++++++++++++++++++ src/profiles/y_profile_administrator.prog.xml | 6 ++ 2 files changed, 65 insertions(+) diff --git a/src/profiles/y_profile_admin_classes.prog.abap b/src/profiles/y_profile_admin_classes.prog.abap index d234d704..9b55ae26 100644 --- a/src/profiles/y_profile_admin_classes.prog.abap +++ b/src/profiles/y_profile_admin_classes.prog.abap @@ -269,6 +269,8 @@ CLASS lcl_util DEFINITION. "#EC NUMBER_METHODS RAISING cx_failed. CLASS-METHODS remove_all_checks. + CLASS-METHODS add_missing_checks. + PRIVATE SECTION. CLASS-METHODS request_confirmation IMPORTING @@ -383,6 +385,9 @@ CLASS lcl_check_events IMPLEMENTATION. WHEN 'BTN_REMOVE_ALL'. lcl_util=>remove_all_checks( ). + WHEN 'BTN_MISSING_CK'. + lcl_util=>add_missing_checks( ). + ENDCASE. lcl_util=>refresh_checks( ). @@ -517,6 +522,11 @@ CLASS lcl_util IMPLEMENTATION. butn_type = cntb_btype_button quickinfo = 'Remove All'(059) ). + checks_tree->toolbar_control( )->add_button( fcode = 'BTN_MISSING_CK' + icon = '@A7@' + butn_type = cntb_btype_button + quickinfo = 'Add Missing Checks'(000) ). + checks_tree->set_field_visibility( fieldname = 'START_DATE' is_visible = abap_true ). checks_tree->set_field_visibility( fieldname = 'END_DATE' @@ -1429,4 +1439,53 @@ CLASS lcl_util IMPLEMENTATION. MESSAGE 'Action Executed Successfully!'(056) TYPE 'S'. ENDMETHOD. + METHOD add_missing_checks. + TRY. + DATA(profile) = lcl_util=>get_selected_profile( )-profile. + CATCH ycx_entry_not_found. + MESSAGE 'Please select a profile!'(005) TYPE 'I'. + ENDTRY. + + TRY. + profile_manager->check_delegation_rights( profile ). + CATCH ycx_no_delegation_rights. + MESSAGE 'You are not a delegate of the profile!'(006) TYPE 'W'. + ENDTRY. + + TRY. + DATA(checks_available) = profile_manager->select_checks( profile ). + request_confirmation( | Would you like to add all missing checks? | ). + CATCH ycx_entry_not_found. + add_all_checks( ). + RETURN. + ENDTRY. + + DATA(list_of_all_checks) = profile_manager->get_checks_from_db( ). + + DATA missing_checks TYPE STANDARD TABLE OF ycicc_checkid. + LOOP AT list_of_all_checks ASSIGNING FIELD-SYMBOL(). + TRY. + DATA(tmp) = checks_available[ checkid = -obj_name ]-checkid. + CATCH cx_sy_itab_line_not_found. + APPEND -obj_name TO missing_checks. + ENDTRY. + ENDLOOP. + + IF NOT line_exists( missing_checks[ 1 ] ). + MESSAGE 'No checks are missing!'(060) TYPE 'I'. + RETURN. + ENDIF. + + LOOP AT missing_checks ASSIGNING FIELD-SYMBOL(). + io_check_id = . + init_add_check( ). + TRY. + add_check( ). + CATCH cx_failed. + CONTINUE. + ENDTRY. + ENDLOOP. + MESSAGE 'Action Executed Successfully!'(056) TYPE 'S'. + ENDMETHOD. + ENDCLASS. diff --git a/src/profiles/y_profile_administrator.prog.xml b/src/profiles/y_profile_administrator.prog.xml index ff3ff103..c00f32c7 100644 --- a/src/profiles/y_profile_administrator.prog.xml +++ b/src/profiles/y_profile_administrator.prog.xml @@ -1540,6 +1540,12 @@ Remove All 27 + + I + 060 + No checks are missing! + 44 + R Profile Administrator for code pal for ABAP From 90c2c436ce8652ce26bece00f06e26170e9e1217 Mon Sep 17 00:00:00 2001 From: Eugen Guenther Date: Thu, 1 Apr 2021 09:46:25 +0200 Subject: [PATCH 2/2] minor update --- src/profiles/y_profile_admin_classes.prog.abap | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/profiles/y_profile_admin_classes.prog.abap b/src/profiles/y_profile_admin_classes.prog.abap index 9b55ae26..56274f64 100644 --- a/src/profiles/y_profile_admin_classes.prog.abap +++ b/src/profiles/y_profile_admin_classes.prog.abap @@ -1464,14 +1464,12 @@ CLASS lcl_util IMPLEMENTATION. DATA missing_checks TYPE STANDARD TABLE OF ycicc_checkid. LOOP AT list_of_all_checks ASSIGNING FIELD-SYMBOL(). - TRY. - DATA(tmp) = checks_available[ checkid = -obj_name ]-checkid. - CATCH cx_sy_itab_line_not_found. - APPEND -obj_name TO missing_checks. - ENDTRY. + IF NOT line_exists( checks_available[ checkid = -obj_name ] ). + APPEND -obj_name TO missing_checks. + ENDIF. ENDLOOP. - IF NOT line_exists( missing_checks[ 1 ] ). + IF missing_checks IS INITIAL. MESSAGE 'No checks are missing!'(060) TYPE 'I'. RETURN. ENDIF.