-
-
Save kgorin8/bf9309a440b8a26a3e767afd8703a572 to your computer and use it in GitHub Desktop.
Example implementation for custom_serialize_abap_clif
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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