Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example implementation for custom_serialize_abap_clif
CLASS zcl_abapgit_user_exit DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES:
zif_abapgit_exit.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_user_exit IMPLEMENTATION.
METHOD zif_abapgit_exit~custom_serialize_abap_clif.
DATA: lo_source TYPE REF TO cl_oo_source,
lv_begin TYPE string,
lv_end TYPE string,
lv_remove TYPE abap_bool,
lv_source LIKE LINE OF rt_source,
lt_package_range TYPE RANGE OF devclass.
lt_package_range = VALUE #(
( sign = 'I' option = 'EQ' low = '/ABC/PROJECT_A' )
( sign = 'I' option = 'EQ' low = '/ABC/PROJECT_B' )
( sign = 'I' option = 'CP' low = '/DMO/*' )
).
DATA(lv_package) = zcl_abapgit_factory=>get_tadir( )->get_object_package(
iv_object = 'CLAS'
iv_obj_name = CONV #( is_class_key-clsname )
).
IF lv_package IS INITIAL.
RETURN. " Probably INTF instead of CLAS
ENDIF.
DATA(li_package) = zcl_abapgit_factory=>get_sap_package( lv_package ).
LOOP AT li_package->list_superpackages( ) TRANSPORTING NO FIELDS WHERE table_line IN lt_package_range.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
RETURN. " Normal serialization
ENDIF.
CREATE OBJECT lo_source
EXPORTING
clskey = is_class_key
EXCEPTIONS
class_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from CL_OO_SOURCE. Subrc = { sy-subrc }| ).
ENDIF.
lo_source->read( 'A' ).
rt_source = lo_source->get_old_source( ).
CONCATENATE '* <SIGNATURE>------------------------------------'
'---------------------------------------------------+'
INTO lv_begin.
CONCATENATE '* +------------------------------------------------'
'--------------------------------------</SIGNATURE>'
INTO lv_end.
lv_remove = abap_false.
LOOP AT rt_source INTO lv_source.
IF lv_source = lv_begin.
lv_remove = abap_true.
ENDIF.
IF lv_remove = abap_true.
DELETE rt_source INDEX sy-tabix.
ENDIF.
IF lv_source = lv_end.
lv_remove = abap_false.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_exit~allow_sap_objects.
ENDMETHOD.
METHOD zif_abapgit_exit~change_local_host.
ENDMETHOD.
METHOD zif_abapgit_exit~change_proxy_authentication.
ENDMETHOD.
METHOD zif_abapgit_exit~change_proxy_port.
ENDMETHOD.
METHOD zif_abapgit_exit~change_proxy_url.
ENDMETHOD.
METHOD zif_abapgit_exit~change_tadir.
ENDMETHOD.
METHOD zif_abapgit_exit~create_http_client.
ENDMETHOD.
METHOD zif_abapgit_exit~get_ssl_id.
ENDMETHOD.
METHOD zif_abapgit_exit~http_client.
ENDMETHOD.
ENDCLASS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.