mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
ENHS: changed_by and add tool type
Add tool type to XML, to allow for adding additional tool types in the future implement code to find changed_by user
This commit is contained in:
parent
32cac9d00e
commit
8e8d68cc71
|
@ -6,6 +6,7 @@
|
||||||
* CLASS lcl_object_enhs DEFINITION
|
* CLASS lcl_object_enhs DEFINITION
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
CLASS lcl_object_enhs DEFINITION INHERITING FROM lcl_objects_super FINAL.
|
CLASS lcl_object_enhs DEFINITION INHERITING FROM lcl_objects_super FINAL.
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
INTERFACES lif_object.
|
INTERFACES lif_object.
|
||||||
ALIASES mo_files FOR lif_object~mo_files.
|
ALIASES mo_files FOR lif_object~mo_files.
|
||||||
|
@ -22,10 +23,20 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
ENDMETHOD. "lif_object~has_changed_since
|
ENDMETHOD. "lif_object~has_changed_since
|
||||||
|
|
||||||
METHOD lif_object~changed_by.
|
METHOD lif_object~changed_by.
|
||||||
rv_user = c_user_unknown. " todo
|
|
||||||
|
DATA: lv_spot_name TYPE enhspotname,
|
||||||
|
li_spot_ref TYPE REF TO if_enh_spot_tool.
|
||||||
|
|
||||||
|
|
||||||
|
lv_spot_name = ms_item-obj_name.
|
||||||
|
|
||||||
|
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
|
||||||
|
li_spot_ref->get_attributes( IMPORTING changedby = rv_user ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object~deserialize.
|
METHOD lif_object~deserialize.
|
||||||
|
|
||||||
DATA: lv_message TYPE string,
|
DATA: lv_message TYPE string,
|
||||||
lv_parent TYPE enhspotcompositename,
|
lv_parent TYPE enhspotcompositename,
|
||||||
lv_spot_name TYPE enhspotname,
|
lv_spot_name TYPE enhspotname,
|
||||||
|
@ -86,22 +97,24 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
ENDMETHOD. "deserialize
|
ENDMETHOD. "deserialize
|
||||||
|
|
||||||
METHOD lif_object~serialize.
|
METHOD lif_object~serialize.
|
||||||
DATA: lv_message TYPE string,
|
|
||||||
lv_spot_name TYPE enhspotname,
|
DATA: lv_spot_name TYPE enhspotname,
|
||||||
lv_enh_shtext TYPE string,
|
lv_enh_shtext TYPE string,
|
||||||
lv_parent TYPE enhspotcompositename,
|
lv_parent TYPE enhspotcompositename,
|
||||||
lt_enh_badi TYPE enh_badi_data_it,
|
lt_enh_badi TYPE enh_badi_data_it,
|
||||||
|
lv_tool TYPE enhspottooltype,
|
||||||
lx_root TYPE REF TO cx_root,
|
lx_root TYPE REF TO cx_root,
|
||||||
li_spot_ref TYPE REF TO if_enh_spot_tool,
|
li_spot_ref TYPE REF TO if_enh_spot_tool,
|
||||||
lo_badidef_tool TYPE REF TO cl_enh_tool_badi_def.
|
lo_badidef_tool TYPE REF TO cl_enh_tool_badi_def.
|
||||||
|
|
||||||
|
|
||||||
lv_spot_name = ms_item-obj_name.
|
lv_spot_name = ms_item-obj_name.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
|
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
|
||||||
|
lv_tool = li_spot_ref->get_tool( ).
|
||||||
|
|
||||||
lo_badidef_tool ?= li_spot_ref.
|
lo_badidef_tool ?= li_spot_ref.
|
||||||
|
|
||||||
lv_enh_shtext = lo_badidef_tool->if_enh_object_docu~get_shorttext( ).
|
lv_enh_shtext = lo_badidef_tool->if_enh_object_docu~get_shorttext( ).
|
||||||
|
|
||||||
"get parent = composite enhs (ENHC)
|
"get parent = composite enhs (ENHC)
|
||||||
|
@ -109,6 +122,8 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
"get subsequent BADI definitions
|
"get subsequent BADI definitions
|
||||||
lt_enh_badi = lo_badidef_tool->get_badi_defs( ).
|
lt_enh_badi = lo_badidef_tool->get_badi_defs( ).
|
||||||
|
|
||||||
|
io_xml->add( ig_data = lv_tool
|
||||||
|
iv_name = 'TOOL' ).
|
||||||
io_xml->add( ig_data = lv_parent
|
io_xml->add( ig_data = lv_parent
|
||||||
iv_name = 'PARENT_COMP' ).
|
iv_name = 'PARENT_COMP' ).
|
||||||
io_xml->add( ig_data = lv_enh_shtext
|
io_xml->add( ig_data = lv_enh_shtext
|
||||||
|
@ -117,9 +132,8 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
iv_name = 'BADI_DATA' ).
|
iv_name = 'BADI_DATA' ).
|
||||||
|
|
||||||
CATCH cx_enh_root INTO lx_root.
|
CATCH cx_enh_root INTO lx_root.
|
||||||
lv_message = `Error occured while serializing EHNS: `
|
lcx_exception=>raise( `Error occured while serializing EHNS: `
|
||||||
&& lx_root->get_text( ) ##NO_TEXT.
|
&& lx_root->get_text( ) ) ##NO_TEXT.
|
||||||
lcx_exception=>raise( lv_message ).
|
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
ENDMETHOD. "serialize
|
ENDMETHOD. "serialize
|
||||||
|
@ -127,6 +141,7 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
METHOD lif_object~exists.
|
METHOD lif_object~exists.
|
||||||
|
|
||||||
DATA: lv_spot_name TYPE enhspotname,
|
DATA: lv_spot_name TYPE enhspotname,
|
||||||
|
lv_tool TYPE enhspottooltype,
|
||||||
li_spot_ref TYPE REF TO if_enh_spot_tool.
|
li_spot_ref TYPE REF TO if_enh_spot_tool.
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,12 +150,14 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
TRY.
|
TRY.
|
||||||
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
|
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
|
||||||
|
|
||||||
* Check that is is realy a BAdI
|
lv_tool = li_spot_ref->get_tool( ).
|
||||||
IF li_spot_ref->get_tool( ) = cl_enh_tool_badi_def=>tooltype.
|
CASE lv_tool.
|
||||||
rv_bool = abap_true.
|
WHEN cl_enh_tool_badi_def=>tooltype.
|
||||||
ELSE.
|
rv_bool = abap_true.
|
||||||
rv_bool = abap_false.
|
WHEN OTHERS.
|
||||||
ENDIF.
|
* todo: implement additional tool types
|
||||||
|
rv_bool = abap_false.
|
||||||
|
ENDCASE.
|
||||||
CATCH cx_enh_root.
|
CATCH cx_enh_root.
|
||||||
rv_bool = abap_false.
|
rv_bool = abap_false.
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
@ -148,6 +165,7 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
ENDMETHOD. "exists
|
ENDMETHOD. "exists
|
||||||
|
|
||||||
METHOD lif_object~delete.
|
METHOD lif_object~delete.
|
||||||
|
|
||||||
DATA: lv_spot_name TYPE enhspotname,
|
DATA: lv_spot_name TYPE enhspotname,
|
||||||
lv_message TYPE string,
|
lv_message TYPE string,
|
||||||
lx_root TYPE REF TO cx_root,
|
lx_root TYPE REF TO cx_root,
|
||||||
|
@ -159,19 +177,18 @@ CLASS lcl_object_enhs IMPLEMENTATION.
|
||||||
TRY.
|
TRY.
|
||||||
li_spot_ref = cl_enh_factory=>get_enhancement_spot(
|
li_spot_ref = cl_enh_factory=>get_enhancement_spot(
|
||||||
spot_name = lv_spot_name
|
spot_name = lv_spot_name
|
||||||
lock = 'X' ).
|
lock = abap_true ).
|
||||||
|
|
||||||
IF li_spot_ref IS BOUND.
|
IF li_spot_ref IS BOUND.
|
||||||
lo_badidef_tool ?= li_spot_ref.
|
lo_badidef_tool ?= li_spot_ref.
|
||||||
lo_badidef_tool->if_enh_object~delete(
|
lo_badidef_tool->if_enh_object~delete(
|
||||||
nevertheless_delete = 'X'
|
nevertheless_delete = abap_true
|
||||||
run_dark = 'X' ).
|
run_dark = abap_true ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
lo_badidef_tool->if_enh_object~unlock( ).
|
lo_badidef_tool->if_enh_object~unlock( ).
|
||||||
CATCH cx_enh_root INTO lx_root.
|
CATCH cx_enh_root INTO lx_root.
|
||||||
lv_message = `Error occured while deleting EHNS: `
|
lcx_exception=>raise( `Error occured while deleting EHNS: `
|
||||||
&& lx_root->get_text( ) ##NO_TEXT.
|
&& lx_root->get_text( ) ) ##NO_TEXT.
|
||||||
lcx_exception=>raise( lv_message ).
|
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
ENDMETHOD. "delete
|
ENDMETHOD. "delete
|
||||||
|
|
Loading…
Reference in New Issue
Block a user