class ZSAPLINK_DATA_ELEMENTS definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_DATA_ELEMENTS *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_DATA_ELEMENTS *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_DATA_ELEMENTS *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CHECKEXISTS. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd04v_wa type dd04v. l_name = objname. CALL FUNCTION 'DDIF_DTEL_GET' EXPORTING name = l_name IMPORTING DD04V_WA = DD04V_WA EXCEPTIONS ILLEGAL_INPUT = 1 OTHERS = 2. IF sy-subrc = 0 AND dd04v_wa-ROLLNAME IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createixmldocfromobject. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd04v_wa TYPE dd04v, tpara_wa TYPE tpara. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA tpara_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _dtelname TYPE ddobjname. _dtelname = objname. CALL FUNCTION 'DDIF_DTEL_GET' EXPORTING name = _dtelname langu = sy-langu IMPORTING gotstate = gotstate dd04v_wa = dd04v_wa tpara_wa = tpara_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd04v_wa-rollname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd04v_wa ). tpara_node = xmldoc->create_element( 'tpara' ). setattributesfromstructure( node = tpara_node structure = tpara_wa ). rc = rootnode->append_child( tpara_node ). *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createobjectfromixmldoc. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd04v_wa TYPE dd04v, tpara_wa TYPE tpara. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA tpara_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _dtelname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd04v_wa. objname = dd04v_wa-rollname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. * retrieve Domain details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'tpara' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). IF node IS NOT INITIAL. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = tpara_wa. ENDIF. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. DATA: itadir TYPE tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. MODIFY tadir FROM itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. WHEN 1 OR 9 OR 7 OR 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_DTEL_PUT' EXPORTING name = l_dd_objname dd04v_wa = dd04v_wa EXCEPTIONS dtel_not_found = 1 name_inconsistent = 2 dtel_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. DATA: trobjtype TYPE trobjtype, trobj_name TYPE trobj_name. trobjtype = l_object. trobj_name = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = trobjtype obj_name = trobj_name EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'DTEL'. "Data Elements endmethod. class ZSAPLINK_DOMAINS definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_DOMAINS *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_DOMAINS *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_DOMAINS *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD checkexists. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd01v_wa type dd01v. l_name = objname. CALL FUNCTION 'DDIF_DOMA_GET' EXPORTING name = l_name IMPORTING dd01v_wa = dd01v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd01v_wa-domname IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createixmldocfromobject. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd01v_wa TYPE dd01v, dd07v_tab TYPE STANDARD TABLE OF dd07v. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd07v_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _domaname TYPE ddobjname. _domaname = objname. CALL FUNCTION 'DDIF_DOMA_GET' EXPORTING name = _domaname langu = sy-langu IMPORTING gotstate = gotstate dd01v_wa = dd01v_wa TABLES dd07v_tab = dd07v_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd01v_wa-domname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd01v_wa ). DATA: wa_dd07v LIKE LINE OF dd07v_tab. LOOP AT dd07v_tab INTO wa_dd07v. dd07v_node = xmldoc->create_element( 'dd07v' ). setattributesfromstructure( node = dd07v_node structure = wa_dd07v ). rc = rootnode->append_child( dd07v_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createobjectfromixmldoc. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd01v_wa TYPE dd01v, dd07v_tab TYPE STANDARD TABLE OF dd07v. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd07v_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _domaname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd01v_wa. objname = dd01v_wa-domname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. * retrieve Domain details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd07v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). DATA: wa_dd07v LIKE LINE OF dd07v_tab. WHILE node IS NOT INITIAL. CLEAR dd07v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = wa_dd07v. APPEND wa_dd07v TO dd07v_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. data: itadir type tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. modify tadir from itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. when 1 or 9 or 7 or 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_DOMA_PUT' EXPORTING name = l_dd_objname dd01v_wa = dd01v_wa TABLES dd07v_tab = dd07v_tab EXCEPTIONS doma_not_found = 1 name_inconsistent = 2 doma_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. data: TROBJTYPE type TROBJTYPE, TROBJ_NAME type TROBJ_NAME. TROBJTYPE = l_object. TROBJ_NAME = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = TROBJTYPE obj_name = TROBJ_NAME EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'DOMA'. "Domain endmethod. class ZSAPLINK_INDEX definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_INDEX *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_DOMAINS *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_DOMAINS *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CHECKEXISTS. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd12v_wa type dd12v. l_name = objname. CALL FUNCTION 'DDIF_INDX_GET' EXPORTING name = l_name IMPORTING dd12v_wa = dd12v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd12v_wa-INDEXNAME IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEIXMLDOCFROMOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd12v_wa TYPE dd12v, dd17v_tab TYPE STANDARD TABLE OF dd17v. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _indxname TYPE ddobjname. _indxname = objname. CALL FUNCTION 'DDIF_INDX_GET' EXPORTING name = _indxname langu = sy-langu IMPORTING gotstate = gotstate dd12v_wa = dd12v_wa TABLES dd17v_tab = dd17v_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd12v_wa-INDEXNAME IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd12v_wa ). DATA: wa_dd17v LIKE LINE OF dd17v_tab. LOOP AT dd17v_tab INTO wa_dd17v. dd17v_node = xmldoc->create_element( 'dd17v' ). setattributesfromstructure( node = dd17v_node structure = wa_dd17v ). rc = rootnode->append_child( dd17v_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEOBJECTFROMIXMLDOC. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd12v_wa TYPE dd12v, dd17v_tab TYPE STANDARD TABLE OF dd17v. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _indxname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd12v_wa. objname = dd12v_wa-INDEXNAME. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. * retrieve Domain details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd17v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). DATA: wa_dd17v LIKE LINE OF dd17v_tab. WHILE node IS NOT INITIAL. CLEAR dd17v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = wa_dd17v. APPEND wa_dd17v TO dd17v_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. data: itadir type tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. modify tadir from itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. when 1 or 9 or 7 or 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_INDX_PUT' EXPORTING name = l_dd_objname dd12v_wa = dd12v_wa TABLES dd17v_tab = dd17v_tab EXCEPTIONS indx_not_found = 1 name_inconsistent = 2 indx_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. data: TROBJTYPE type TROBJTYPE, TROBJ_NAME type TROBJ_NAME. TROBJTYPE = l_object. TROBJ_NAME = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = TROBJTYPE obj_name = TROBJ_NAME EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'INDX'. "Index endmethod. class ZSAPLINK_LOCK_OBJECTS definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_LOCK_OBJECTS *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_TABLES *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_TABLES *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CHECKEXISTS. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd25v_wa TYPE dd25v. l_name = objname. CALL FUNCTION 'DDIF_ENQU_GET' EXPORTING name = l_name IMPORTING dd25v_wa = dd25v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd25v_wa-VIEWNAME IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEIXMLDOCFROMOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd25v_wa TYPE dd25v, dd26e_tab TYPE STANDARD TABLE OF dd26e, dd26e_wa LIKE LINE OF dd26e_tab, dd27p_tab TYPE STANDARD TABLE OF dd27p, dd27p_wa LIKE LINE OF dd27p_tab, ddena_tab TYPE STANDARD TABLE OF ddena, ddena_wa LIKE LINE OF ddena_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd26e_node TYPE REF TO if_ixml_element. DATA dd27p_node TYPE REF TO if_ixml_element. DATA ddena_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _enquname TYPE ddobjname. _enquname = objname. CALL FUNCTION 'DDIF_ENQU_GET' EXPORTING name = _enquname langu = sy-langu IMPORTING gotstate = gotstate dd25v_wa = dd25v_wa TABLES dd26e_tab = dd26e_tab dd27p_tab = dd27p_tab ddena_tab = ddena_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd25v_wa-viewname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd25v_wa ). LOOP AT dd26e_tab INTO dd26e_wa. dd26e_node = xmldoc->create_element( 'dd26e' ). setattributesfromstructure( node = dd26e_node structure = dd26e_wa ). rc = rootnode->append_child( dd26e_node ). ENDLOOP. LOOP AT dd27p_tab INTO dd27p_wa. dd27p_node = xmldoc->create_element( 'dd27p' ). setattributesfromstructure( node = dd27p_node structure = dd27p_wa ). rc = rootnode->append_child( dd27p_node ). ENDLOOP. LOOP AT ddena_tab INTO ddena_wa. ddena_node = xmldoc->create_element( 'ddena' ). setattributesfromstructure( node = ddena_node structure = ddena_wa ). rc = rootnode->append_child( ddena_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEOBJECTFROMIXMLDOC. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd25v_wa TYPE dd25v, dd26e_tab TYPE STANDARD TABLE OF dd26e, dd26e_wa LIKE LINE OF dd26e_tab, dd27p_tab TYPE STANDARD TABLE OF dd27p, dd27p_wa LIKE LINE OF dd27p_tab, ddena_tab TYPE STANDARD TABLE OF ddena, ddena_wa LIKE LINE OF ddena_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd26e_node TYPE REF TO if_ixml_element. DATA dd27p_node TYPE REF TO if_ixml_element. DATA ddena_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _enquname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd25v_wa. objname = dd25v_wa-viewname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. * retrieve Tabl details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd26e' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd26e_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd26e_wa. APPEND dd26e_wa TO dd26e_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd27p' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd27p_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd27p_wa. APPEND dd27p_wa TO dd27p_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'ddena' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR ddena_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = ddena_wa. APPEND ddena_wa TO ddena_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. DATA: itadir TYPE tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. MODIFY tadir FROM itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. WHEN 1 OR 9 OR 7 OR 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_ENQU_PUT' EXPORTING name = l_dd_objname dd25v_wa = dd25v_wa TABLES dd26e_tab = dd26e_tab dd27p_tab = dd27p_tab EXCEPTIONS enqu_not_found = 1 name_inconsistent = 2 enqu_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. DATA: trobjtype TYPE trobjtype, trobj_name TYPE trobj_name. trobjtype = l_object. trobj_name = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = trobjtype obj_name = trobj_name EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'ENQU'. "Lock Objects endmethod. class ZSAPLINK_SEARCH_HELPS definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_SEARCH_HELPS *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_TABLES *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_TABLES *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CHECKEXISTS. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd30v_wa TYPE dd30v. l_name = objname. CALL FUNCTION 'DDIF_SHLP_GET' EXPORTING name = l_name IMPORTING dd30v_wa = dd30v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd30v_wa-SHLPNAME IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEIXMLDOCFROMOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd30v_wa TYPE dd30v, dd31v_tab TYPE STANDARD TABLE OF dd31v, dd31v_wa LIKE LINE OF dd31v_tab, dd32p_tab TYPE STANDARD TABLE OF dd32p, dd32p_wa LIKE LINE OF dd32p_tab, dd33v_tab TYPE STANDARD TABLE OF dd33v, dd33v_wa LIKE LINE OF dd33v_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd31v_node TYPE REF TO if_ixml_element. DATA dd32p_node TYPE REF TO if_ixml_element. DATA dd33v_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _shlpname TYPE ddobjname. _shlpname = objname. CALL FUNCTION 'DDIF_SHLP_GET' EXPORTING name = _shlpname langu = sy-langu IMPORTING gotstate = gotstate dd30v_wa = dd30v_wa TABLES dd31v_tab = dd31v_tab dd32p_tab = dd32p_tab dd33v_tab = dd33v_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd30v_wa-SHLPNAME IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd30v_wa ). LOOP AT dd31v_tab INTO dd31v_wa. dd31v_node = xmldoc->create_element( 'dd31v' ). setattributesfromstructure( node = dd31v_node structure = dd31v_wa ). rc = rootnode->append_child( dd31v_node ). ENDLOOP. LOOP AT dd32p_tab INTO dd32p_wa. dd32p_node = xmldoc->create_element( 'dd32p' ). setattributesfromstructure( node = dd32p_node structure = dd32p_wa ). rc = rootnode->append_child( dd32p_node ). ENDLOOP. LOOP AT dd33v_tab INTO dd33v_wa. dd33v_node = xmldoc->create_element( 'dd33v' ). setattributesfromstructure( node = dd33v_node structure = dd33v_wa ). rc = rootnode->append_child( dd33v_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD CREATEOBJECTFROMIXMLDOC. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd30v_wa TYPE dd30v, dd31v_tab TYPE STANDARD TABLE OF dd31v, dd31v_wa LIKE LINE OF dd31v_tab, dd32p_tab TYPE STANDARD TABLE OF dd32p, dd32p_wa LIKE LINE OF dd32p_tab, dd33v_tab TYPE STANDARD TABLE OF dd33v, dd33v_wa LIKE LINE OF dd33v_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd31v_node TYPE REF TO if_ixml_element. DATA dd32p_node TYPE REF TO if_ixml_element. DATA dd33v_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _shlpname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd30v_wa. objname = dd30v_wa-shlpname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. * retrieve Tabl details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd31v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd31v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd31v_wa. APPEND dd31v_wa TO dd31v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd32p' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd32p_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd32p_wa. APPEND dd32p_wa TO dd32p_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd33v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd33v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd33v_wa. APPEND dd33v_wa TO dd33v_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. DATA: itadir TYPE tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. MODIFY tadir FROM itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. WHEN 1 OR 9 OR 7 OR 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_SHLP_PUT' EXPORTING name = l_dd_objname dd30v_wa = dd30v_wa TABLES dd31v_tab = dd31v_tab dd32p_tab = dd32p_tab dd33v_tab = dd33v_tab EXCEPTIONS shlp_not_found = 1 name_inconsistent = 2 shlp_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. DATA: trobjtype TYPE trobjtype, trobj_name TYPE trobj_name. trobjtype = l_object. trobj_name = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = trobjtype obj_name = trobj_name EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'SHLP'. "Search Helps endmethod. class ZSAPLINK_TABLES definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_TABLES *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_TABLES *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_TABLES *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes *"* use this source file for any type declarations (class *"* definitions, interfaces or data types) you need for method *"* implementation or private method's signature *"* use this source file for any macro definitions you need *"* in the implementation part of the class */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD checkexists. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: l_name TYPE ddobjname, dd02v_wa TYPE dd02v. l_name = objname. CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = l_name IMPORTING dd02v_wa = dd02v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd02v_wa-tabname IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createixmldocfromobject. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd02v_wa TYPE dd02v, dd09l_wa TYPE dd09v, dd03p_tab TYPE STANDARD TABLE OF dd03p, dd03p_wa LIKE LINE OF dd03p_tab, dd05m_tab TYPE STANDARD TABLE OF dd05m, dd05m_wa LIKE LINE OF dd05m_tab, dd08v_tab TYPE STANDARD TABLE OF dd08v, dd08v_wa LIKE LINE OF dd08v_tab, dd12v_tab TYPE STANDARD TABLE OF dd12v, dd12v_wa LIKE LINE OF dd12v_tab, dd17v_tab TYPE STANDARD TABLE OF dd17v, dd17v_wa LIKE LINE OF dd17v_tab, dd35v_tab TYPE STANDARD TABLE OF dd35v, dd35v_wa LIKE LINE OF dd35v_tab, dd36m_tab TYPE STANDARD TABLE OF dd36m, dd36m_wa LIKE LINE OF dd36m_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd09l_node TYPE REF TO if_ixml_element. DATA dd03p_node TYPE REF TO if_ixml_element. DATA dd05m_node TYPE REF TO if_ixml_element. DATA dd08v_node TYPE REF TO if_ixml_element. DATA dd12v_node TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA dd35v_node TYPE REF TO if_ixml_element. DATA dd36m_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _tablname TYPE ddobjname. _tablname = objname. CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = _tablname langu = sy-langu IMPORTING gotstate = gotstate dd02v_wa = dd02v_wa dd09l_wa = dd09l_wa TABLES dd03p_tab = dd03p_tab dd05m_tab = dd05m_tab dd08v_tab = dd08v_tab dd12v_tab = dd12v_tab dd17v_tab = dd17v_tab dd35v_tab = dd35v_tab dd36m_tab = dd36m_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd02v_wa-tabname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd02v_wa ). dd09l_node = xmldoc->create_element( 'dd09l' ). setattributesfromstructure( node = dd09l_node structure = dd09l_wa ). rc = rootnode->append_child( dd09l_node ). LOOP AT dd03p_tab INTO dd03p_wa. dd03p_node = xmldoc->create_element( 'dd03p' ). setattributesfromstructure( node = dd03p_node structure = dd03p_wa ). rc = rootnode->append_child( dd03p_node ). ENDLOOP. LOOP AT dd05m_tab INTO dd05m_wa. dd05m_node = xmldoc->create_element( 'dd05m' ). setattributesfromstructure( node = dd05m_node structure = dd05m_wa ). rc = rootnode->append_child( dd05m_node ). ENDLOOP. LOOP AT dd08v_tab INTO dd08v_wa. dd08v_node = xmldoc->create_element( 'dd08v' ). setattributesfromstructure( node = dd08v_node structure = dd08v_wa ). rc = rootnode->append_child( dd08v_node ). ENDLOOP. LOOP AT dd12v_tab INTO dd12v_wa. dd12v_node = xmldoc->create_element( 'dd12v' ). setattributesfromstructure( node = dd12v_node structure = dd12v_wa ). rc = rootnode->append_child( dd12v_node ). ENDLOOP. LOOP AT dd17v_tab INTO dd17v_wa. dd17v_node = xmldoc->create_element( 'dd17v' ). setattributesfromstructure( node = dd17v_node structure = dd17v_wa ). rc = rootnode->append_child( dd17v_node ). ENDLOOP. LOOP AT dd35v_tab INTO dd35v_wa. dd35v_node = xmldoc->create_element( 'dd35v' ). setattributesfromstructure( node = dd35v_node structure = dd35v_wa ). rc = rootnode->append_child( dd35v_node ). ENDLOOP. LOOP AT dd36m_tab INTO dd36m_wa. dd36m_node = xmldoc->create_element( 'dd36m' ). setattributesfromstructure( node = dd36m_node structure = dd36m_wa ). rc = rootnode->append_child( dd36m_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createobjectfromixmldoc. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com DATA: gotstate TYPE ddgotstate, dd02v_wa TYPE dd02v, dd09l_wa TYPE dd09v, dd03p_tab TYPE STANDARD TABLE OF dd03p, dd03p_wa LIKE LINE OF dd03p_tab, dd05m_tab TYPE STANDARD TABLE OF dd05m, dd05m_wa LIKE LINE OF dd05m_tab, dd08v_tab TYPE STANDARD TABLE OF dd08v, dd08v_wa LIKE LINE OF dd08v_tab, dd12v_tab TYPE STANDARD TABLE OF dd12v, dd12v_wa LIKE LINE OF dd12v_tab, dd17v_tab TYPE STANDARD TABLE OF dd17v, dd17v_wa LIKE LINE OF dd17v_tab, dd35v_tab TYPE STANDARD TABLE OF dd35v, dd35v_wa LIKE LINE OF dd35v_tab, dd36m_tab TYPE STANDARD TABLE OF dd36m, dd36m_wa LIKE LINE OF dd36m_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd09l_node TYPE REF TO if_ixml_element. DATA dd03p_node TYPE REF TO if_ixml_element. DATA dd05m_node TYPE REF TO if_ixml_element. DATA dd08v_node TYPE REF TO if_ixml_element. DATA dd12v_node TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA dd35v_node TYPE REF TO if_ixml_element. DATA dd36m_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _tablname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd02v_wa. objname = dd02v_wa-tabname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. dd09l_node = xmldoc->find_from_name( 'dd09l' ). CALL METHOD getstructurefromattributes EXPORTING node = dd09l_node CHANGING structure = dd09l_wa. * retrieve Tabl details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd03p' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd03p_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd03p_wa. APPEND dd03p_wa TO dd03p_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd05m' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd05m_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd05m_wa. APPEND dd05m_wa TO dd05m_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd08v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd08v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd08v_wa. APPEND dd08v_wa TO dd08v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd12v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd12v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd12v_wa. APPEND dd12v_wa TO dd12v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd17v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd17v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd17v_wa. APPEND dd17v_wa TO dd17v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd35v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd35v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd35v_wa. APPEND dd35v_wa TO dd35v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd36m' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd36m_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd36m_wa. APPEND dd36m_wa TO dd36m_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. DATA: itadir TYPE tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. MODIFY tadir FROM itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. WHEN 1 OR 9 OR 7 OR 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_TABL_PUT' EXPORTING name = l_dd_objname dd02v_wa = dd02v_wa dd09l_wa = dd09l_wa TABLES dd03p_tab = dd03p_tab dd05m_tab = dd05m_tab dd08v_tab = dd08v_tab dd35v_tab = dd35v_tab dd36m_tab = dd36m_tab EXCEPTIONS tabl_not_found = 1 name_inconsistent = 2 tabl_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. DATA: trobjtype TYPE trobjtype, trobj_name TYPE trobj_name. trobjtype = l_object. trobj_name = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = trobjtype obj_name = trobj_name EXCEPTIONS wrong_object_name = 1. name = objName. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Thomas Jung * thomas.jung1@gmail.com objecttype = 'TABL'. "Tables and Structures endmethod. class ZSAPLINK_TABLE_TECH_SETTINGS definition public inheriting from ZSAPLINK final create public . *"* public components of class ZSAPLINK_TABLE_TECH_SETTINGS *"* do not include other source files here!!! public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_DATA_ELEMENTS *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_DATA_ELEMENTS *"* do not include other source files here!!! private section. *"* local class implementation for public class *"* use this source file for the implementation part of *&quo