From b4751e72763b591121aa9a06d6f341d8af206af7 Mon Sep 17 00:00:00 2001 From: ConjuringCoffee <72548231+ConjuringCoffee@users.noreply.github.com> Date: Fri, 13 Jun 2025 10:34:00 +0000 Subject: [PATCH 1/2] Make check for modification compatible with RFC --- src/checks/zcl_aoc_super.clas.abap | 40 +++++++++++++++---- .../zaoc_get_author_of_active_versrf.sush.xml | 36 +++++++++++++++++ src/utils/zaoc_wrapper.fugr.xml | 36 +++++++++++++++++ ...r.fugr.zaoc_get_author_of_active_vers.abap | 19 +++++++++ 4 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 src/utils/zaoc_get_author_of_active_versrf.sush.xml create mode 100644 src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap diff --git a/src/checks/zcl_aoc_super.clas.abap b/src/checks/zcl_aoc_super.clas.abap index 478cbf81..ecfe160e 100644 --- a/src/checks/zcl_aoc_super.clas.abap +++ b/src/checks/zcl_aoc_super.clas.abap @@ -111,12 +111,16 @@ CLASS zcl_aoc_super DEFINITION METHODS set_uses_checksum IMPORTING !iv_enable TYPE abap_bool DEFAULT abap_true. - + METHODS is_active_version_by_sap + IMPORTING + iv_program_name TYPE progname + RETURNING + VALUE(rv_result) TYPE abap_bool. ENDCLASS. -CLASS ZCL_AOC_SUPER IMPLEMENTATION. +CLASS zcl_aoc_super IMPLEMENTATION. METHOD check. @@ -493,12 +497,7 @@ CLASS ZCL_AOC_SUPER IMPLEMENTATION. ENDIF. IF cl_enh_badi_def_utility=>is_sap_system( ) = abap_false. - SELECT SINGLE cnam FROM reposrc INTO lv_cnam - WHERE progname = p_sub_obj_name AND r3state = 'A'. - IF sy-subrc = 0 - AND ( lv_cnam = 'SAP' - OR lv_cnam = 'SAP*' - OR lv_cnam = 'DDIC' ). + IF is_active_version_by_sap( p_sub_obj_name ). RETURN. ENDIF. ENDIF. @@ -739,4 +738,29 @@ CLASS ZCL_AOC_SUPER IMPLEMENTATION. ENDIF. ENDMETHOD. + + METHOD is_active_version_by_sap. + DATA lv_author TYPE cnam. + + CALL FUNCTION 'ZAOC_GET_AUTHOR_OF_ACTIVE_VERS' + DESTINATION rfc_destination + EXPORTING + iv_program_name = iv_program_name + IMPORTING + ev_author = lv_author + EXCEPTIONS + no_active_version = 1 + OTHERS = 2. + + IF sy-subrc <> 0. + " Ignore for now + RETURN. + ENDIF. + + CASE lv_author. + WHEN 'SAP' OR 'SAP*' OR 'DDIC'. + rv_result = abap_true. + ENDCASE. + ENDMETHOD. + ENDCLASS. diff --git a/src/utils/zaoc_get_author_of_active_versrf.sush.xml b/src/utils/zaoc_get_author_of_active_versrf.sush.xml new file mode 100644 index 00000000..45c37567 --- /dev/null +++ b/src/utils/zaoc_get_author_of_active_versrf.sush.xml @@ -0,0 +1,36 @@ + + + + + + ZAOC_GET_AUTHOR_OF_ACTIVE_VERS + RF + ZAOC_GET_AUTHOR_OF_ACTIVE_VERS + Get author of active version + + + + ZAOC_GET_AUTHOR_OF_ACTIVE_VERS + RF + S_RFC + X + + + + + S_RFC + Authorization Check for RFC Access + AAAB + X + BC-MID-RFC + Check + Check + No + 3 + Okay + @08@ + + + + + diff --git a/src/utils/zaoc_wrapper.fugr.xml b/src/utils/zaoc_wrapper.fugr.xml index 0abfb5c5..2f6df480 100644 --- a/src/utils/zaoc_wrapper.fugr.xml +++ b/src/utils/zaoc_wrapper.fugr.xml @@ -8,6 +8,42 @@ SAPLZAOC_WRAPPER + + ZAOC_GET_AUTHOR_OF_ACTIVE_VERS + R + Get author of active version + + + IV_PROGRAM_NAME + PROGNAME + + + + + EV_AUTHOR + CNAM + + + + + NO_ACTIVE_VERSION + + + + + IV_PROGRAM_NAME + P + + + EV_AUTHOR + P + + + NO_ACTIVE_VERSION + X + + + ZAOC_IS_FUNCTION_MODULE_RFC R diff --git a/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap b/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap new file mode 100644 index 00000000..4089b39b --- /dev/null +++ b/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap @@ -0,0 +1,19 @@ +FUNCTION zaoc_get_author_of_active_vers. +*"---------------------------------------------------------------------- +*"*"Local Interface: +*" IMPORTING +*" VALUE(IV_PROGRAM_NAME) TYPE PROGNAME +*" EXPORTING +*" VALUE(EV_AUTHOR) TYPE CNAM +*" EXCEPTIONS +*" NO_ACTIVE_VERSION +*"---------------------------------------------------------------------- + SELECT SINGLE cnam + FROM reposrc + INTO @ev_author + WHERE progname = @iv_program_name AND r3state = 'A'. + + IF sy-subrc <> 0. + RAISE no_active_version. + ENDIF. +ENDFUNCTION. From 091928721f07d4a3473f406c9e3918a0f8bbcc25 Mon Sep 17 00:00:00 2001 From: ConjuringCoffee <72548231+ConjuringCoffee@users.noreply.github.com> Date: Fri, 13 Jun 2025 10:36:18 +0000 Subject: [PATCH 2/2] Fix linting errors --- src/checks/zcl_aoc_super.clas.abap | 7 +++---- .../zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/checks/zcl_aoc_super.clas.abap b/src/checks/zcl_aoc_super.clas.abap index ecfe160e..5ce17aca 100644 --- a/src/checks/zcl_aoc_super.clas.abap +++ b/src/checks/zcl_aoc_super.clas.abap @@ -496,10 +496,9 @@ CLASS zcl_aoc_super IMPLEMENTATION. RETURN. " custom HR infotype includes ENDIF. - IF cl_enh_badi_def_utility=>is_sap_system( ) = abap_false. - IF is_active_version_by_sap( p_sub_obj_name ). - RETURN. - ENDIF. + IF cl_enh_badi_def_utility=>is_sap_system( ) = abap_false + AND is_active_version_by_sap( p_sub_obj_name ) = abap_true. + RETURN. ENDIF. ENDIF. diff --git a/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap b/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap index 4089b39b..d847184d 100644 --- a/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap +++ b/src/utils/zaoc_wrapper.fugr.zaoc_get_author_of_active_vers.abap @@ -10,8 +10,9 @@ FUNCTION zaoc_get_author_of_active_vers. *"---------------------------------------------------------------------- SELECT SINGLE cnam FROM reposrc - INTO @ev_author - WHERE progname = @iv_program_name AND r3state = 'A'. + INTO ev_author + WHERE progname = iv_program_name + AND r3state = 'A'. IF sy-subrc <> 0. RAISE no_active_version.