Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

conditional deletion of metrics in metric store #154

Merged
merged 2 commits into from
Feb 11, 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
31 changes: 21 additions & 10 deletions src/zamp_store/zamp_clear_zamp_store.prog.abap
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
*&---------------------------------------------------------------------*
*& Report zamp_clear_zamp_store
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zamp_clear_zamp_store.

IF NEW zcl_amp_auth_checker( )->is_deleting_allowed( ) = abap_true.
DELETE FROM zamp_store.
ELSE.
MESSAGE 'no authority' TYPE 'E'.
ENDIF.
TABLES zamp_store.

SELECT-OPTIONS scenario FOR zamp_store-metric_scenario.
SELECT-OPTIONS group FOR zamp_store-metric_group.
SELECT-OPTIONS key FOR zamp_store-metric_key.

START-OF-SELECTION.

IF NEW zcl_amp_auth_checker( )->is_deleting_allowed( ) = abap_true.
DELETE FROM zamp_store
WHERE metric_scenario IN @scenario
AND metric_group IN @group
AND metric_key IN @key.
IF sy-subrc = 0.
WRITE |{ sy-dbcnt } entries deleted|.
ELSE.
WRITE |no entries deleted|.
ENDIF.
ELSE.
MESSAGE 'no authority' TYPE 'E'.
ENDIF.
21 changes: 21 additions & 0 deletions src/zamp_store/zamp_clear_zamp_store.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@
<ENTRY>Clear ZAMP_STORE</ENTRY>
<LENGTH>16</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>GROUP</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>KEY</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>SCENARIO</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
Expand Down