1

我想从 SAP 中的扩展检查器中获取结果。我想我找到了存储结果的表(我认为它是 slin_cache_res)。但是该值以原始字符串格式存储。如何以可读格式获得最后一次扩展检查的结果?我需要它们来完成进一步的处理任务。

4

1 回答 1

0

如果可能的话,我会尝试为此使用代码检查器,因为它更灵活,提供更多检查,并且具有类似于 API 的东西,可用于运行检查并获得结果:

  DATA: lr_inspection       TYPE REF TO cl_ci_inspection,
        lr_object_set       TYPE REF TO cl_ci_objectset,
        lr_check_variant    TYPE REF TO cl_ci_checkvariant,
        lt_result           TYPE scit_alvlist.

  FIELD-SYMBOLS: <ls_result>    TYPE scir_alvlist.

* create an inspection
  CALL METHOD cl_ci_inspection=>create
    EXPORTING
      p_user              = ''
      p_name              = 'MY_INSPECTION_NAME'
    RECEIVING
      p_ref               = lr_inspection
    EXCEPTIONS
      OTHERS              = 1.
  IF sy-subrc <> 0.
*   ... error handling ...
  ELSE.

*   load object set
    CALL METHOD cl_ci_objectset=>get_ref
      EXPORTING
        p_objsnam                 = 'MY_OBJECT_SET_NAME'
      RECEIVING
        p_ref                     = lr_object_set
      EXCEPTIONS
        OTHERS                    = 1.
    IF sy-subrc <> 0.
*     ... error handling ...
    ELSE.

*     load check variant
      CALL METHOD cl_ci_checkvariant=>get_ref
        EXPORTING
          p_user            = ''
          p_name            = 'MY_VARIANT_NAME'
        RECEIVING
          p_ref             = lr_check_variant
        EXCEPTIONS
          OTHERS            = 1.
      IF sy-subrc <> 0.
*       ... error handling ...
      ELSE.

*       assemble inspection
        CALL METHOD lr_inspection->set
          EXPORTING
            p_chkv = lr_check_variant
            p_objs = lr_object_set.
        CALL METHOD lr_inspection->save.

*       run inspection
        CALL METHOD lr_inspection->run
          EXPORTING
            p_howtorun             = 'D' " cl_ci_inspection=>c_run_direct
          EXCEPTIONS
            OTHERS                 = 1.
        IF sy-subrc <> 0.
*         ... error handling ...
        ELSE.

*         get the result list
          CALL METHOD lr_inspection->plain_list
            IMPORTING
              p_list = lt_result.

*         ... do something with the results ...

        ENDIF. " sy-subrc after lr_inspection->run
      ENDIF. " sy-subrc after cl_ci_checkvariant=>get_ref
    ENDIF. " sy-subrc after cl_ci_objectset=>get_ref
  ENDIF. " sy-subrc after cl_ci_inspection=>create
于 2013-07-03T12:34:43.980 回答