anchor.diff:  *&  Include           ZABAPGIT_OBJECT_ENHO
   *&---------------------------------------------------------------------*
   
  -* todo, this include could use some refactoring
  -
   * todo, CL_ENH_TOOL_CLASS inherits from CL_ENH_TOOL_CLIF so this
   * should also be reflected in the code in this include
   
  -*----------------------------------------------------------------------*
  -*       CLASS lcl_object_enho DEFINITION
  -*----------------------------------------------------------------------*
  -*
  -*----------------------------------------------------------------------*
  -CLASS lcl_object_enho DEFINITION INHERITING FROM lcl_objects_super FINAL.
   * For complete list of tool_type - see ENHTOOLS table
  +
  +INTERFACE lif_object_enho.
  +
  +  METHODS:
  +    deserialize
  +      IMPORTING io_xml     TYPE REF TO lcl_xml_input
  +                iv_package TYPE devclass
  +      RAISING   lcx_exception,
  +    serialize
  +      IMPORTING io_xml      TYPE REF TO lcl_xml_output
  +                ii_enh_tool TYPE REF TO if_enh_tool
  +      RAISING   lcx_exception.
  +
  +ENDINTERFACE.
  +
  +CLASS lcl_object_enho_badi DEFINITION.
  +
     PUBLIC SECTION.
  -    INTERFACES lif_object.
  -    ALIASES mo_files FOR lif_object~mo_files.
  +    METHODS: constructor
  +      IMPORTING
  +        is_item  TYPE ty_item
  +        io_files TYPE REF TO lcl_objects_files.
  +    INTERFACES: lif_object_enho.
  +
  +  PRIVATE SECTION.
  +    DATA: ms_item TYPE ty_item.
  +    DATA: mo_files TYPE REF TO lcl_objects_files.
  +
  +ENDCLASS.
  +
  +CLASS lcl_object_enho_badi IMPLEMENTATION.
  +
  +  METHOD constructor.
  +    ms_item = is_item.
  +    mo_files = io_files.
  +  ENDMETHOD.
  +
  +  METHOD lif_object_enho~serialize.
  +
  +    DATA: lo_badi_impl TYPE REF TO cl_enh_tool_badi_impl,
  +          lv_spot_name TYPE enhspotname,
  +          lv_shorttext TYPE string,
  +          lt_impl      TYPE enh_badi_impl_data_it.
  +
  +    FIELD-SYMBOLS: <ls_impl>   LIKE LINE OF lt_impl,
  +                   <ls_values> LIKE LINE OF <ls_impl>-filter_values,
  +                   <ls_filter> LIKE LINE OF <ls_impl>-filters.
  +
  +
  +    lo_badi_impl ?= ii_enh_tool.
  +
  +    lv_shorttext = lo_badi_impl->if_enh_object_docu~get_shorttext( ).
  +    lv_spot_name = lo_badi_impl->get_spot_name( ).
  +    lt_impl      = lo_badi_impl->get_implementations( ).
  +
  +    LOOP AT lt_impl ASSIGNING <ls_impl>.
  +* make sure the XML serialization does not dump, field type = N
  +      LOOP AT <ls_impl>-filter_values ASSIGNING <ls_values>.
  +        IF <ls_values>-filter_numeric_value1 CA space.
  +          CLEAR <ls_values>-filter_numeric_value1.
  +        ENDIF.
  +      ENDLOOP.
  +      LOOP AT <ls_impl>-filters ASSIGNING <ls_filter>.
  +        IF <ls_filter>-filter_numeric_value1 CA space.
  +          CLEAR <ls_filter>-filter_numeric_value1.
  +        ENDIF.
  +      ENDLOOP.
  +    ENDLOOP.
  +
  +    io_xml->add( iv_name = 'TOOL'
  +                 ig_data = ii_enh_tool->get_tool( ) ).
  +    io_xml->add( ig_data = lv_shorttext
  +                 iv_name = 'SHORTTEXT' ).
  +    io_xml->add( iv_name = 'SPOT_NAME'
  +                 ig_data = lv_spot_name ).
  +    io_xml->add( iv_name = 'IMPL'
  +                 ig_data = lt_impl ).
  +
  +  ENDMETHOD.
  +
  +  METHOD lif_object_enho~deserialize.
  +
  +    DATA: lv_spot_name TYPE enhspotname,
  +          lv_shorttext TYPE string,
  +          lv_enhname   TYPE enhname,
  +          lo_badi      TYPE REF TO cl_enh_tool_badi_impl,
  +          li_tool      TYPE REF TO if_enh_tool,
  +          lv_package   TYPE devclass,
  +          lt_impl      TYPE enh_badi_impl_data_it.
  +
  +    FIELD-SYMBOLS: <ls_impl> LIKE LINE OF lt_impl.
  +
  +
  +    io_xml->read( EXPORTING iv_name = 'SHORTTEXT'
  +                  CHANGING cg_data  = lv_shorttext ).
  +    io_xml->read( EXPORTING iv_name = 'SPOT_NAME'
  +                  CHANGING cg_data  = lv_spot_name ).
  +    io_xml->read( EXPORTING iv_name = 'IMPL'
  +                  CHANGING cg_data  = lt_impl ).
  +
  +    lv_enhname = ms_item-obj_name.
  +    lv_package = iv_package.
  +    TRY.
  +        cl_enh_factory=>create_enhancement(
  +          EXPORTING
  +            enhname     = lv_enhname
  +            enhtype     = cl_abstract_enh_tool_redef=>credefinition
  +            enhtooltype = cl_enh_tool_badi_impl=>tooltype
  +          IMPORTING
  +            enhancement = li_tool
  +          CHANGING
  +            devclass    = lv_package ).
  +        lo_badi ?= li_tool.
  +
  +        lo_badi->set_spot_name( lv_spot_name ).
  +        lo_badi->if_enh_object_docu~set_shorttext( lv_shorttext ).
  +        LOOP AT lt_impl ASSIGNING <ls_impl>.
  +          lo_badi->add_implementation( <ls_impl> ).
  +        ENDLOOP.
  +        lo_badi->if_enh_object~save( ).
  +        lo_badi->if_enh_object~unlock( ).
  +      CATCH cx_enh_root.
  +        lcx_exception=>raise( 'error deserializing ENHO badi' ).
  +    ENDTRY.
  +
  +  ENDMETHOD.
  +
  +ENDCLASS.
  +
  +CLASS lcl_object_enho_hook DEFINITION.
  +  PUBLIC SECTION.
  +    METHODS: constructor
  +      IMPORTING
  +        is_item  TYPE ty_item
  +        io_files TYPE REF TO lcl_objects_files.
  +
  +    INTERFACES: lif_object_enho.
   
     PRIVATE SECTION.
       TYPES: BEGIN OF ty_spaces,
  
positive.code:         lcx_exception=>raise( 'error deserializing ENHO hook' ).
      ENDTRY.
  
    ENDMETHOD.                    "deserialize_hook
  
    METHOD serialize_badi.
  
      DATA: lo_badi_impl TYPE REF TO cl_enh_tool_badi_impl,
            lv_spot_name TYPE enhspotname,
            lv_shorttext TYPE string,
            lt_impl      TYPE enh_badi_impl_data_it.
  
      FIELD-SYMBOLS: <ls_impl>   LIKE LINE OF lt_impl,
                     <ls_values> LIKE LINE OF <ls_impl>-filter_values,
                     <ls_filter> LIKE LINE OF <ls_impl>-filters.
  
  
      lo_badi_impl ?= ii_enh_tool.
  
      lv_shorttext = lo_badi_impl->if_enh_object_docu~get_shorttext( ).
      lv_spot_name = lo_badi_impl->get_spot_name( ).
      lt_impl      = lo_badi_impl->get_implementations( ).
  
      LOOP AT lt_impl ASSIGNING <ls_impl>.
  * make sure the XML serialization does not dump, field type = N
        LOOP AT <ls_impl>-filter_values ASSIGNING <ls_values>.
          IF <ls_values>-filter_numeric_value1 CA space.
            CLEAR <ls_values>-filter_numeric_value1.
          ENDIF.
        ENDLOOP.
        LOOP AT <ls_impl>-filters ASSIGNING <ls_filter>.
          IF <ls_filter>-filter_numeric_value1 CA space.
            CLEAR <ls_filter>-filter_numeric_value1.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
  
      io_xml->add( iv_name = 'TOOL'
                   ig_data = iv_tool ).
      io_xml->add( ig_data = lv_shorttext
                   iv_name = 'SHORTTEXT' ).
      io_xml->add( iv_name = 'SPOT_NAME'
                   ig_data = lv_spot_name ).
      io_xml->add( iv_name = 'IMPL'
                   ig_data = lt_impl ).
  
    ENDMETHOD.                    "serialize_badi
  
    METHOD serialize_class.
  
      DATA: lo_enh_class TYPE REF TO cl_enh_tool_class,
            lt_owr       TYPE enhmeth_tabkeys,
  
negative.code: 
      TYPES: ty_spaces_tt TYPE STANDARD TABLE OF ty_spaces WITH DEFAULT KEY.
  
      DATA: ms_item TYPE ty_item.
      DATA: mo_files TYPE REF TO lcl_objects_files.
  
      METHODS hook_impl_deserialize
        IMPORTING it_spaces TYPE ty_spaces_tt
        CHANGING  ct_impl   TYPE enh_hook_impl_it
        RAISING   lcx_exception.
  
      METHODS hook_impl_serialize
        EXPORTING et_spaces TYPE ty_spaces_tt
        CHANGING  ct_impl   TYPE enh_hook_impl_it
        RAISING   lcx_exception.
  
  ENDCLASS.
  
  CLASS lcl_object_enho_hook IMPLEMENTATION.
  
    METHOD constructor.
      ms_item = is_item.
      mo_files = io_files.
    ENDMETHOD.
  
    METHOD lif_object_enho~serialize.
  
      DATA: lv_shorttext       TYPE string,
            lo_hook_impl       TYPE REF TO cl_enh_tool_hook_impl,
            ls_original_object TYPE enh_hook_admin,
            lt_spaces          TYPE ty_spaces_tt,
            lt_enhancements    TYPE enh_hook_impl_it.
  
  
      lo_hook_impl ?= ii_enh_tool.
  
      lv_shorttext = lo_hook_impl->if_enh_object_docu~get_shorttext( ).
      lo_hook_impl->get_original_object(
        IMPORTING
          pgmid     = ls_original_object-pgmid
          obj_name  = ls_original_object-org_obj_name
          obj_type  = ls_original_object-org_obj_type
          main_type = ls_original_object-org_main_type
          main_name = ls_original_object-org_main_name
          program   = ls_original_object-programname ).
      ls_original_object-include_bound = lo_hook_impl->get_include_bound( ).
      lt_enhancements = lo_hook_impl->get_hook_impls( ).
  
      hook_impl_serialize(
        IMPORTING et_spaces = lt_spaces
        CHANGING ct_impl = lt_enhancements ).
  
      io_xml->add( iv_name = 'TOOL'
                   ig_data = ii_enh_tool->get_tool( ) ).
      io_xml->add( ig_data = lv_shorttext
                   iv_name = 'SHORTTEXT' ).
      io_xml->add( ig_data = ls_original_object
                   iv_name = 'ORIGINAL_OBJECT' ).
      io_xml->add( iv_name = 'ENHANCEMENTS'
                   ig_data = lt_enhancements ).
      io_xml->add( iv_name = 'SPACES'
                   ig_data = lt_spaces ).
  
    ENDMETHOD.
  
    METHOD hook_impl_serialize.
  