mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-03 13:26:12 +08:00
94 lines
2.7 KiB
ABAP
94 lines
2.7 KiB
ABAP
CLASS zcl_abapgit_object_enhs_badi_d DEFINITION PUBLIC.
|
|
|
|
PUBLIC SECTION.
|
|
INTERFACES: zif_abapgit_object_enhs.
|
|
|
|
PROTECTED SECTION.
|
|
PRIVATE SECTION.
|
|
ENDCLASS.
|
|
|
|
|
|
|
|
CLASS ZCL_ABAPGIT_OBJECT_ENHS_BADI_D IMPLEMENTATION.
|
|
|
|
|
|
METHOD zif_abapgit_object_enhs~deserialize.
|
|
|
|
DATA: lv_parent TYPE enhspotcompositename,
|
|
lt_enh_badi TYPE enh_badi_data_it,
|
|
lo_badidef_tool TYPE REF TO cl_enh_tool_badi_def,
|
|
lv_enh_shorttext TYPE string,
|
|
li_enh_object TYPE REF TO if_enh_object,
|
|
li_enh_object_docu TYPE REF TO if_enh_object_docu,
|
|
lv_text TYPE string,
|
|
lx_error TYPE REF TO cx_enh_root.
|
|
|
|
FIELD-SYMBOLS: <ls_enh_badi> LIKE LINE OF lt_enh_badi.
|
|
|
|
io_xml->read( EXPORTING iv_name = 'PARENT_COMP'
|
|
CHANGING cg_data = lv_parent ).
|
|
|
|
io_xml->read( EXPORTING iv_name = 'BADI_DATA'
|
|
CHANGING cg_data = lt_enh_badi ).
|
|
|
|
io_xml->read( EXPORTING iv_name = 'SHORTTEXT'
|
|
CHANGING cg_data = lv_enh_shorttext ).
|
|
|
|
li_enh_object ?= ii_enh_spot_tool.
|
|
li_enh_object_docu ?= ii_enh_spot_tool.
|
|
|
|
TRY.
|
|
li_enh_object_docu->set_shorttext( lv_enh_shorttext ).
|
|
|
|
lo_badidef_tool ?= ii_enh_spot_tool.
|
|
|
|
LOOP AT lt_enh_badi ASSIGNING <ls_enh_badi>.
|
|
lo_badidef_tool->add_badi_def( <ls_enh_badi> ).
|
|
ENDLOOP.
|
|
|
|
li_enh_object->save( ).
|
|
li_enh_object->activate( ).
|
|
li_enh_object->unlock( ).
|
|
|
|
CATCH cx_enh_root INTO lx_error.
|
|
lv_text = lx_error->get_text( ).
|
|
zcx_abapgit_exception=>raise( lv_text ).
|
|
ENDTRY.
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD zif_abapgit_object_enhs~serialize.
|
|
|
|
DATA: lv_spot_name TYPE enhspotname,
|
|
lv_parent TYPE enhspotcompositename,
|
|
lt_enh_badi TYPE enh_badi_data_it,
|
|
lo_badidef_tool TYPE REF TO cl_enh_tool_badi_def,
|
|
lv_enh_shorttext TYPE string,
|
|
li_enh_object_docu TYPE REF TO if_enh_object_docu.
|
|
|
|
lo_badidef_tool ?= ii_enh_spot_tool.
|
|
|
|
li_enh_object_docu ?= ii_enh_spot_tool.
|
|
lv_enh_shorttext = li_enh_object_docu->get_shorttext( ).
|
|
|
|
"get parent = composite enhs (ENHC)
|
|
lv_parent = cl_r3standard_persistence=>enh_find_parent_composite( lv_spot_name ).
|
|
"get subsequent BADI definitions
|
|
lt_enh_badi = lo_badidef_tool->get_badi_defs( ).
|
|
|
|
io_xml->add( ig_data = ii_enh_spot_tool->get_tool( )
|
|
iv_name = 'TOOL' ).
|
|
|
|
io_xml->add( ig_data = lv_enh_shorttext
|
|
iv_name = 'SHORTTEXT' ).
|
|
|
|
io_xml->add( ig_data = lv_parent
|
|
iv_name = 'PARENT_COMP' ).
|
|
|
|
io_xml->add( ig_data = lt_enh_badi
|
|
iv_name = 'BADI_DATA' ).
|
|
|
|
ENDMETHOD.
|
|
ENDCLASS.
|