如何从扩展语法检查中获得结果



我想从SAP中的扩展检查器中获得结果。我想我找到了存储结果的表(我想它是slin_check_res)。但该值是以rawstring格式存储的。如何以可读的格式获得上次扩展检查的结果?我需要它们来进一步处理任务。

如果可能的话,我会尝试使用代码检查器,因为它更灵活,提供更多的检查,并且有类似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

相关内容

  • 没有找到相关文章

最新更新