2023 Jun 07 12:03 PM
Dear Olga,
I have created a method with a code inspector inspection. When checking a class SCIRESTPS is displaying the errors, but I have no transparent information on the concerned methods, which I need for further operation.
I wonder whether I can work with CL_CI_INSPECTION->get_err_objects but I don’t understand with which value I should fill p_rest and how to define p_errobjs.
Example: check class (please see document for images)
* Naming convention code inspector
IF l_valid_object EQ 1.
SCIRESTPS (want to obtain the method of the objects in the rectangle)
Thanks in advance for any help.
Kind regards,
Norbert
2023 Jun 07 5:02 PM
Try something like CL_OO_INCLUDE_NAMING->GET_TRKEY_BY_INCLUDE(<fs>-sobjname) or similar code
2023 Jun 23 10:27 AM
Sorry for late answer. I have realized as follows:
WHEN 'METH'.
*** Correction for Methods checked for ILM
IF lv_position = abap_true.
READ TABLE lr_inspection->scirestps INTO ls_scirestps
WITH KEY sobjname = g_funcname.
ASSIGN ls_scirestps-sobjname TO <fs_sobjname>.
CALL METHOD cl_oo_include_naming=>get_trkey_by_include
EXPORTING
progname = <fs_sobjname>
IMPORTING
* pgmid =
object = lv_local_object
obj_name = lv_local_obj_name
EXCEPTIONS
no_objecttype = 1
invalid_include = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ELSE.
REPLACE l_obj_name IN lv_local_obj_name WITH space.
CONDENSE lv_local_obj_name.
ENDIF.
* search in gt_obj_list
READ TABLE gt_obj_list INTO ls_obj_list
WITH KEY obj_name = lv_local_obj_name.
IF sy-subrc = 0 AND lv_local_obj_name = g_obj_name.
ls_obj_list-codeins_warn = ls_obj_list-codeins_warn + 1.
APPEND ls_obj_list TO lt_obj_list.
ep_obj_list = lt_obj_list.
DELETE lr_inspection->scirestps WHERE sobjname NE <fs_sobjname>.
ELSE.
DELETE lr_inspection->scirestps WHERE sobjname EQ <fs_sobjname>.
ENDIF.
ENDIF.
ENDCASE.