Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Details of an Object in Inspection

norbert_genat1
Explorer
0 Kudos
316

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.
TRY.
ep_ret_ci_check = gc_success.

CALL METHOD cl_ci_check=>single
EXPORTING
p_variant_user = ''
p_variant = ip_variant
p_obj_type = l_object
p_obj_name = l_obj_name
IMPORTING
p_ok = l_ok
p_result = ep_insp_res.

lr_inspection = ep_insp_res->get_inspection( ).

* CALL METHOD lr_inspection->get_err_objects
* EXPORTING
* p_rest = lr_inspection->scirestps
** IMPORTING
** p_errobjs =
.


LOOP AT lr_inspection->scirestps INTO ls_scirestps.

SCIRESTPS (want to obtain the method of the objects in the rectangle)

Thanks in advance for any help.

Kind regards,

Norbert

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos
176

Try something like CL_OO_INCLUDE_NAMING->GET_TRKEY_BY_INCLUDE(<fs>-sobjname) or similar code

norbert_genat1
Explorer
0 Kudos
176

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.