Skip to content

Commit e56422a

Browse files
lucasborinEugen Guenther
andauthored
adding missing checks feature (#346)
* adding missing checks feature * minor update Co-authored-by: Eugen Guenther <eugen.guenther@sap.com>
1 parent 1b61970 commit e56422a

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

src/profiles/y_profile_admin_classes.prog.abap

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ CLASS lcl_util DEFINITION. "#EC NUMBER_METHODS
269269
RAISING
270270
cx_failed.
271271
CLASS-METHODS remove_all_checks.
272+
CLASS-METHODS add_missing_checks.
273+
272274
PRIVATE SECTION.
273275
CLASS-METHODS request_confirmation
274276
IMPORTING
@@ -383,6 +385,9 @@ CLASS lcl_check_events IMPLEMENTATION.
383385
WHEN 'BTN_REMOVE_ALL'.
384386
lcl_util=>remove_all_checks( ).
385387

388+
WHEN 'BTN_MISSING_CK'.
389+
lcl_util=>add_missing_checks( ).
390+
386391
ENDCASE.
387392

388393
lcl_util=>refresh_checks( ).
@@ -517,6 +522,11 @@ CLASS lcl_util IMPLEMENTATION.
517522
butn_type = cntb_btype_button
518523
quickinfo = 'Remove All'(059) ).
519524

525+
checks_tree->toolbar_control( )->add_button( fcode = 'BTN_MISSING_CK'
526+
icon = '@A7@'
527+
butn_type = cntb_btype_button
528+
quickinfo = 'Add Missing Checks'(000) ).
529+
520530
checks_tree->set_field_visibility( fieldname = 'START_DATE'
521531
is_visible = abap_true ).
522532
checks_tree->set_field_visibility( fieldname = 'END_DATE'
@@ -1429,4 +1439,51 @@ CLASS lcl_util IMPLEMENTATION.
14291439
MESSAGE 'Action Executed Successfully!'(056) TYPE 'S'.
14301440
ENDMETHOD.
14311441

1442+
METHOD add_missing_checks.
1443+
TRY.
1444+
DATA(profile) = lcl_util=>get_selected_profile( )-profile.
1445+
CATCH ycx_entry_not_found.
1446+
MESSAGE 'Please select a profile!'(005) TYPE 'I'.
1447+
ENDTRY.
1448+
1449+
TRY.
1450+
profile_manager->check_delegation_rights( profile ).
1451+
CATCH ycx_no_delegation_rights.
1452+
MESSAGE 'You are not a delegate of the profile!'(006) TYPE 'W'.
1453+
ENDTRY.
1454+
1455+
TRY.
1456+
DATA(checks_available) = profile_manager->select_checks( profile ).
1457+
request_confirmation( | Would you like to add all missing checks? | ).
1458+
CATCH ycx_entry_not_found.
1459+
add_all_checks( ).
1460+
RETURN.
1461+
ENDTRY.
1462+
1463+
DATA(list_of_all_checks) = profile_manager->get_checks_from_db( ).
1464+
1465+
DATA missing_checks TYPE STANDARD TABLE OF ycicc_checkid.
1466+
LOOP AT list_of_all_checks ASSIGNING FIELD-SYMBOL(<check>).
1467+
IF NOT line_exists( checks_available[ checkid = <check>-obj_name ] ).
1468+
APPEND <check>-obj_name TO missing_checks.
1469+
ENDIF.
1470+
ENDLOOP.
1471+
1472+
IF missing_checks IS INITIAL.
1473+
MESSAGE 'No checks are missing!'(060) TYPE 'I'.
1474+
RETURN.
1475+
ENDIF.
1476+
1477+
LOOP AT missing_checks ASSIGNING FIELD-SYMBOL(<checkname>).
1478+
io_check_id = <checkname>.
1479+
init_add_check( ).
1480+
TRY.
1481+
add_check( ).
1482+
CATCH cx_failed.
1483+
CONTINUE.
1484+
ENDTRY.
1485+
ENDLOOP.
1486+
MESSAGE 'Action Executed Successfully!'(056) TYPE 'S'.
1487+
ENDMETHOD.
1488+
14321489
ENDCLASS.

src/profiles/y_profile_administrator.prog.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,12 @@
15401540
<ENTRY>Remove All</ENTRY>
15411541
<LENGTH>27</LENGTH>
15421542
</item>
1543+
<item>
1544+
<ID>I</ID>
1545+
<KEY>060</KEY>
1546+
<ENTRY>No checks are missing!</ENTRY>
1547+
<LENGTH>44</LENGTH>
1548+
</item>
15431549
<item>
15441550
<ID>R</ID>
15451551
<ENTRY>Profile Administrator for code pal for ABAP</ENTRY>

0 commit comments

Comments
 (0)