Skip to content

adding missing checks feature #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/profiles/y_profile_admin_classes.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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( ).
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -1429,4 +1439,51 @@ 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(<check>).
IF NOT line_exists( checks_available[ checkid = <check>-obj_name ] ).
APPEND <check>-obj_name TO missing_checks.
ENDIF.
ENDLOOP.

IF missing_checks IS INITIAL.
MESSAGE 'No checks are missing!'(060) TYPE 'I'.
RETURN.
ENDIF.

LOOP AT missing_checks ASSIGNING FIELD-SYMBOL(<checkname>).
io_check_id = <checkname>.
init_add_check( ).
TRY.
add_check( ).
CATCH cx_failed.
CONTINUE.
ENDTRY.
ENDLOOP.
MESSAGE 'Action Executed Successfully!'(056) TYPE 'S'.
ENDMETHOD.

ENDCLASS.
6 changes: 6 additions & 0 deletions src/profiles/y_profile_administrator.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,12 @@
<ENTRY>Remove All</ENTRY>
<LENGTH>27</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>060</KEY>
<ENTRY>No checks are missing!</ENTRY>
<LENGTH>44</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>Profile Administrator for code pal for ABAP</ENTRY>
Expand Down