zsaplink installer

Download Zsaplink Installer

If you can't read please download the document

Upload: amit-patil

Post on 23-Oct-2015

87 views

Category:

Documents


5 download

DESCRIPTION

Zsaplink Installer

TRANSCRIPT

*/---------------------------------------------------------------------\ *| 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 | *\---------------------------------------------------------------------/ REPORT ZSAPLINK_INSTALLER_TEMPLATE. CLASS ZCX_SAPLINK DEFINITION INHERITING FROM CX_STATIC_CHECK CREATE PUBLIC . public section. constants EXISTING type SOTR_CONC value '44F5C1A35F5C09C200000000A7E42BB6'. "#EC NOTEXT constants SYSTEM_ERROR type SOTR_CONC value '44F5C1B55F5C09C200000000A7E42BB6'. "#EC NOTEXT constants ERROR_MESSAGE type SOTR_CONC value '44F5C21A5F5C09C200000000A7E42BB6'. "#EC NOTEXT constants NOT_AUTHORIZED type SOTR_CONC value '44F5C1A95F5C09C200000000A7E42BB6'. "#EC NOTEXT constants NOT_FOUND type SOTR_CONC value '44F5C1AF5F5C09C200000000A7E42BB6'. "#EC NOTEXT data MSG type STRING value '44F7518323DB08BC02000000A7E42BB6' . constants LOCKED type SOTR_CONC value '44F7518323DB08BC02000000A7E42BB6'. "#EC NOTEXT constants NO_PLUGIN type SOTR_CONC value '44F7C18C68D709C200000000A7E42BB6'. "#EC NOTEXT methods CONSTRUCTOR importing !TEXTID like TEXTID optional !PREVIOUS like PREVIOUS optional value(MSG) type STRING default '44F7518323DB08BC02000000A7E42BB6' . *"* protected components of class ZCX_SAPLINK *"* do not include other source files here!!! protected section. *"* private components of class ZCX_SAPLINK *"* do not include other source files here!!! private section. ENDCLASS. CLASS ZSAPLINK DEFINITION CREATE PUBLIC ABSTRACT . public section.class-methods GETOBJECTINFOFROMIXMLDOC importing !IXMLDOCUMENT type ref to IF_IXML_DOCUMENT exporting !OBJTYPENAME type STRING !OBJNAME type STRING . class-methods CONVERTSTRINGTOIXMLDOC importing value(XMLSTRING) type STRING returning value(IXMLDOCUMENT) type ref to IF_IXML_DOCUMENT . class-methods CONVERTIXMLDOCTOSTRING importing !IXMLDOCUMENT type ref to IF_IXML_DOCUMENT returning value(XMLSTRING) type STRING . methods CREATEOBJECTFROMIXMLDOC abstract importing !IXMLDOCUMENT type ref to IF_IXML_DOCUMENT !DEVCLASS type DEVCLASS default '$TMP' !OVERWRITE type FLAG optional returning value(NAME) type STRING raising ZCX_SAPLINK . methods CREATEIXMLDOCFROMOBJECT abstract returning value(IXMLDOCUMENT) type ref to IF_IXML_DOCUMENT raising ZCX_SAPLINK . methods CONSTRUCTOR importing !NAME type STRING . methods UPLOADXML final importing !XMLDATA type STRING . class-methods GETPLUGINS changing value(OBJECTTABLE) type TABLE . methods CHECKEXISTS abstract returning value(EXISTS) type FLAG . *"* protected components of class ZSAPLINK *"* do not include other source files here!!! protected section. data OBJNAME type STRING . data IXML type ref to IF_IXML . data XMLDOC type ref to IF_IXML_DOCUMENT . methods DELETEOBJECT abstract raising ZCX_SAPLINK . methods CREATENODEFROMOTRfinal importing !OTRGUID type SOTR_CONC returning value(NODE) type ref to IF_IXML_ELEMENT . class-methods SETATTRIBUTESFROMSTRUCTURE importing !NODE type ref to IF_IXML_ELEMENT !STRUCTURE type DATA . class-methods GETSTRUCTUREFROMATTRIBUTES importing !NODE type ref to IF_IXML_ELEMENT !PRESERVEVERSION type FLAG optional changing !STRUCTURE type DATA . methods CREATEXMLSTRING final returning value(XML) type STRING . class-methods BUILDTABLEFROMSTRING importing !SOURCE type STRING returning value(SOURCETABLE) type TABLE_OF_STRINGS . class-methods BUILDSOURCESTRING importing !SOURCETABLE type RSWSOURCET optional !PAGETABLE type O2PAGELINE_TABLE optional returning value(SOURCESTRING) type STRING . methods GETOBJECTTYPE abstract returning value(OBJECTTYPE) type STRING . methods CREATEOTRFROMNODE final importing value(NODE) type ref to IF_IXML_ELEMENT !DEVCLASS type DEVCLASS default '$TMP' exporting !CONCEPT type SOTR_TEXT-CONCEPT raising ZCX_SAPLINK . *"* private components of class ZSAPLINK *"* do not include other source files here!!! private section. data STREAMFACTORY type ref to IF_IXML_STREAM_FACTORY . data XMLDATA type STRING . ENDCLASS. CLASS ZSAPLINK_PROGRAM DEFINITION INHERITING FROM ZSAPLINK FINAL CREATE PUBLIC . public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECTredefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_PROGRAM *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_PROGRAM *"* do not include other source files here!!! private section. methods CREATE_TEXTPOOL importing !TEXTPOOLNODE type ref to IF_IXML_ELEMENT . methods DEQUEUE_ABAP raising ZCX_SAPLINK . methods GET_TEXTPOOL returning value(TEXTNODE) type ref to IF_IXML_ELEMENT . methods CREATE_SOURCE importing !SOURCE type TABLE_OF_STRINGS !ATTRIBS type TRDIR . methods ENQUEUE_ABAP raising ZCX_SAPLINK . methods TRANSPORT_COPY importing !AUTHOR type SYUNAME !DEVCLASS type DEVCLASS raising ZCX_SAPLINK . methods GET_DYNPRO returning value(DYNP_NODE) type ref to IF_IXML_ELEMENT . methods CREATE_DYNPRO importing !DYNP_NODE type ref to IF_IXML_ELEMENT . methods GET_PFSTATUS returning value(PFSTAT_NODE) type ref to IF_IXML_ELEMENT . methods CREATE_PFSTATUS importing !PFSTAT_NODE type ref to IF_IXML_ELEMENT . ENDCLASS. CLASS ZSAPLINK_CLASS DEFINITION INHERITING FROM ZSAPLINK CREATE PUBLIC . public section. type-pools ABAP . type-pools SEOP . type-pools SEOR . type-pools SEOS . type-pools SEOT .type-pools SEOX . methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . *"* protected components of class ZSAPLINK_CLASS *"* do not include other source files here!!! protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . *"* private components of class ZSAPLINK_CLASS *"* do not include other source files here!!! private section. methods FINDIMPLEMENTINGCLASS importing !METHODNAME type STRING !STARTCLASS type STRING optional returning value(CLASSNAME) type STRING . ENDCLASS. CLASS ZCX_SAPLINK IMPLEMENTATION. method CONSTRUCTOR . CALL METHOD SUPER->CONSTRUCTOR EXPORTING TEXTID = TEXTID PREVIOUS = PREVIOUS . me->MSG = MSG . endmethod. ENDCLASS. CLASS ZSAPLINK IMPLEMENTATION. */---------------------------------------------------------------------\ *| 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 BUILDSOURCESTRING . data sTemp type string. data pageLine type O2PAGELINE.if sourceTable is not initial. loop at sourceTable into sTemp. concatenate sourceString sTemp CL_ABAP_CHAR_UTILITIES=>NEWLINE into sourceString. endloop. elseif pageTable is not initial. loop at pageTable into pageLine. concatenate sourceString pageLine-line CL_ABAP_CHAR_UTILITIES=>NEWLINE into sourceString. endloop. endif. * remove extra newline characters for conversion comparison consistency shift sourceString left deleting leading CL_ABAP_CHAR_UTILITIES=>NEWLINE. shift sourceString right deleting trailing CL_ABAP_CHAR_UTILITIES=>NEWLINE. shift sourceString left deleting leading space. 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 BUILDTABLEFROMSTRING . split source at CL_ABAP_CHAR_UTILITIES=>NEWLINE into table sourceTable. 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 CONSTRUCTOR . * * * * * * data meTypeDescr type ref to CL_ABAP_TYPEDESCR. clear className. objName = name. meTypeDescr = CL_ABAP_TYPEDESCR=>DESCRIBE_BY_OBJECT_REF( me ). className = meTypeDescr->get_relative_name( ). objName = name. translate objName to upper case. ixml = cl_ixml=>create( ). xmlDoc = ixml->create_document( ). streamFactory = ixml->CREATE_STREAM_FACTORY( ). 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 CONVERTIXMLDOCTOSTRING . data _ixml type ref to if_ixml. data _streamFactory type ref to IF_IXML_STREAM_FACTORY. data _outputStream type ref to IF_IXML_OSTREAM. data _renderer type ref to IF_IXML_RENDERER. data _tempString type string. data _printXMLDoc type ref to cl_xml_document. data _rc type sysubrc. _ixml = cl_ixml=>create( ). _streamFactory = _ixml->CREATE_STREAM_FACTORY( ). _outputStream = _streamFactory->CREATE_OSTREAM_CSTRING( _tempString ). _renderer = _ixml->CREATE_RENDERER( DOCUMENT = ixmlDocument OSTREAM = _outputStream ). _renderer->SET_NORMALIZING( ). _rc = _renderer->render( ). create object _printXMLDoc. _rc = _printXMLDoc->parse_string( _tempString ). while _tempString(1) 'find_from_name( 'publicSection' ) * IF sourcenode IS NOT INITIAL. * source = sourcenode->get_value( ). * ch_type_source = buildtablefromstring( source ). * ENDIF. **insert code for pivateSection * sourcenode = xmldoc->find_from_name( 'privateSection' ). * IF sourcenode IS NOT INITIAL. * source = sourcenode->get_value( ). * ch_type_source_temp = buildtablefromstring( source ). * append lines of ch_type_source_temp to ch_type_source. * ENDIF. **insert code for ProtectedSection * sourcenode = xmldoc->find_from_name( 'protectedSection' ). * IF sourcenode IS NOT INITIAL. * source = sourcenode->get_value( ).* ch_type_source_temp = buildtablefromstring( source ). * append lines of ch_type_source_temp to ch_type_source. * ENDIF. name = objname. CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE' EXPORTING CORRNR = e_corrnr DEVCLASS = e_devclass VERSION = e_version GENFLAG = e_genflag AUTHORITY_CHECK = e_authority_check OVERWRITE = e_overwrite * SUPPRESS_METHOD_GENERATION = e_suppress_meth_gen * SUPPRESS_REFACTORING_SUPPORT = e_suppress_refac_gen METHOD_SOURCES = e_method_sources LOCALS_DEF = e_locals_def LOCALS_IMP = e_locals_imp LOCALS_MAC = e_locals_mac * SUPPRESS_INDEX_UPDATE = e_suppress_ind_update IMPORTING KORRNR = i_korrnr * TABLES * CLASS_DESCRIPTIONS = tb_classDescription * COMPONENT_DESCRIPTIONS = tb_component_descr * SUBCOMPONENT_DESCRIPTIONS = tb_subcomponent_descr CHANGING CLASS = ch_class INHERITANCE = ch_inheritance REDEFINITIONS = ch_redefinitions IMPLEMENTINGS = ch_implementings IMPL_DETAILS = ch_impl_details ATTRIBUTES = ch_attributes METHODS = ch_methods EVENTS = ch_events TYPES = ch_types * TYPE_SOURCE = ch_type_source "??? PARAMETERS = ch_parameters EXCEPS = ch_exceps ALIASES = ch_aliases TYPEPUSAGES = ch_typeusages CLSDEFERRDS = ch_clsdeferreds INTDEFERRDS = ch_intdeferrds FRIENDSHIPS = ch_friendships EXCEPTIONS EXISTING = 1 IS_INTERFACE = 2 DB_ERROR = 3 COMPONENT_ERROR = 4 NO_ACCESS = 5 OTHER = 6 OTHERS = 7. case sy-subrc. when '0'. ** i guess if we made it this far, we will assume success ** successful install when '1'. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing.when others. raise exception type zcx_saplink exporting textid = zcx_saplink=>system_error. endcase. *ewH:insert pub, prot, and priv sections manually to keep any direct * attribute/type definitions aobjname = classkey-clsname. **public sourcenode = xmldoc->find_from_name( 'publicSection' ). IF sourcenode IS NOT INITIAL. includename = cl_oo_classname_service=>get_pubsec_name( _classname ). source = sourcenode->get_value( ). sourcetable = buildtablefromstring( source ). INSERT REPORT includename FROM sourcetable EXTENSION TYPE srext_ext_class_public STATE 'I'. ENDIF. **protected sourcenode = xmldoc->find_from_name( 'protectedSection' ). IF sourcenode IS NOT INITIAL. includename = cl_oo_classname_service=>get_prosec_name( _classname ). source = sourcenode->get_value( ). sourcetable = buildtablefromstring( source ). INSERT REPORT includename FROM sourcetable EXTENSION TYPE srext_ext_class_protected STATE 'I'. ENDIF. **private sourcenode = xmldoc->find_from_name( 'privateSection' ). IF sourcenode IS NOT INITIAL. includename = cl_oo_classname_service=>get_prisec_name( _classname ). source = sourcenode->get_value( ). sourcetable = buildtablefromstring( source ). INSERT REPORT includename FROM sourcetable EXTENSION TYPE srext_ext_class_private STATE 'I'. ENDIF. * insert inactive sections into worklist CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = 'CPUB' obj_name = aobjname EXCEPTIONS wrong_object_name = 1. IF sy-subrc 0. ENDIF. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = 'CPRO' obj_name = aobjname EXCEPTIONS wrong_object_name = 1. IF sy-subrc 0. ENDIF. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = 'CPRI'obj_name = aobjname EXCEPTIONS wrong_object_name = 1. IF sy-subrc 0. ENDIF. endmethod. method DELETEOBJECT . */---------------------------------------------------------------------\ *| 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 | *\---------------------------------------------------------------------/ data clsKey type SEOCLSKEY. clsKey-clsname = objname. CALL FUNCTION 'SEO_CLASS_DELETE_W_DEPS' EXPORTING clskey = clsKey EXCEPTIONS NOT_EXISTING = 1 IS_INTERFACE = 2 NOT_DELETED = 3 DB_ERROR = 4 OTHERS = 5 . if sy-subrc 0. case sy-subrc. when 1. raise exception type zcx_saplink exporting textid = zcx_saplink=>not_found. when 2. raise exception type zcx_saplink exporting textid = zcx_saplink=>error_message msg = 'interfaces not supported'. when 3. raise exception type zcx_saplink exporting textid = zcx_saplink=>error_message msg = 'class not deleted'. when others. raise exception type zcx_saplink exporting textid = zcx_saplink=>system_error. endcase.endif. endmethod. method FINDIMPLEMENTINGCLASS . */---------------------------------------------------------------------\ *| 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 | *\---------------------------------------------------------------------/ data data data data data methodKey type SEOCMPKEY. methodProperties type VSEOMETHOD. classDescr type ref to cl_abap_classdescr. superClass type ref to cl_abap_typeDescr. superClassName type string.if startClass is initial. methodKey-CLSNAME = objName. else. methodKey-clsName = startClass. endif. methodKey-CMPNAME = methodName. call function 'SEO_METHOD_GET' exporting MTDKEY = methodKey importing method = methodProperties exceptions NOT_EXISTING = 1. if sy-subrc = 0. className = methodProperties-clsname. else. classDescr ?= cl_abap_classDescr=>describe_by_name( methodKey-clsName ). call method classDescr->GET_SUPER_CLASS_TYPE receiving P_DESCR_REF = superClass exceptions SUPER_CLASS_NOT_FOUND = 1. superClassName = superClass->GET_RELATIVE_NAME( ). className = FINDIMPLEMENTINGCLASS( methodName = methodName startClass = superCLassName ). endif. endmethod. method GETOBJECTTYPE . */---------------------------------------------------------------------\ *| 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 | *\---------------------------------------------------------------------/ objecttype = 'CLAS'. "Class endmethod. ENDCLASS. type-pools: seor, abap. data retFileTable type FILETABLE. data retRc type sysubrc. data retUserAction type i. data tempXMLString type string. data ixmlNugget type ref to if_ixml_document. data pluginExists type flag. data objectExists type flag. data flag type flag. data statusMsg type string. DATA y2all type flag. selection-screen begin of Line. SELECTION-SCREEN COMMENT 1(20) fileCom FOR FIELD NUGGFIL. parameters NUGGFIL(300) type c modif id did obligatory. selection-screen end of Line. selection-screen begin of Line. SELECTION-SCREEN COMMENT 1(20) checkCom FOR FIELD NUGGFIL. parameters overwrt type c as checkbox default 'X'. selection-screen end of Line.start-of-selection. clear tempXMLString. perform uploadXMLFromLM using NUGGFIL tempXMLString. perform CONVERTSTRINGTOIXMLDOC using tempXMLString changing ixmlNugget. perform installNugget using ixmlNugget overwrt. */--------------------------------------------------------------------\ *| Selection screen events | initialization. fileCom = 'Installation Nugget'. checkCom = 'Overwrite Originals'.at selection-screen on value-request for NUGGFIL. call method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG exporting MULTISELECTION = abap_false FILE_FILTER = '*.nugg' DEFAULT_EXTENSION = 'nugg' changing FILE_TABLE = retFileTable rc = retRc user_Action = retUserAction. read table retFileTable into NUGGFIL index 1. refresh retFileTable. *\--------------------------------------------------------------------/ */--------------------------------------------------------------------\ *| Forms from the SAPLink Installer | *| | form uploadXMLFromLM using p_filename xmlString type string . data tempTable type table_of_strings. data l_fileName type string. l_fileName = p_filename. call method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD exporting FILENAME = l_fileName changing data_tab = tempTable. perform createString using tempTable changing xmlString. endform. *\--------------------------------------------------------------------/ form createString using tempTable type table_of_strings changing bigString type string. data sTemp type string. loop at tempTable into sTemp. concatenate bigString sTemp CL_ABAP_CHAR_UTILITIES=>NEWLINE into bigString. endloop. endform. */----------------------------------------------------------------------*/--------------------------------------------------------------------\ *| Forms from the SAPLink Root Class | form CONVERTSTRINGTOIXMLDOC using xmlString type string changing ixmlDocument type ref to if_ixml_document. data ixml type ref to if_ixml. data streamFactory type ref to IF_IXML_STREAM_FACTORY.data iStream type ref to if_ixml_istream. data ixmlParser type ref to if_ixml_parser. data xmlDoc type ref to if_ixml_document. ixml = cl_ixml=>create( ). xmlDoc = ixml->create_document( ). streamFactory = ixml->CREATE_STREAM_FACTORY( ). iStream = streamFactory->CREATE_ISTREAM_STRING( xmlString ). iXMLParser = iXML->create_parser( stream_factory = streamFactory istream = iStream document = xmlDoc ). iXMLParser->parse( ). ixmlDocument = xmlDoc. endform. *| *| FORM GETOBJECTInfoFROMIXMLDOC using ixmlDocument type ref to if_ixml_document changing objTypeName type string objName type string. data rootNode type ref to IF_IXML_NODE. data rootAttr type ref to IF_IXML_NAMED_NODE_MAP. data AttrNode type ref to IF_IXML_NODE. data nodeName type string. rootNode ?= ixmlDocument->GET_ROOT_ELEMENT( ). * get object type objTypeName = rootNode->GET_NAME( ). translate objTypeName to upper case. * get object name rootAttr = rootNode->GET_ATTRIBUTES( ). AttrNode = rootAttr->GET_ITEM( 0 ). objName = AttrNode->GET_VALUE( ). ENDFORM. */--------------------------------------------------------------------\ *| Nugget Class | form installNugget using xmlDoc type ref to if_ixml_document overwrite type c. types: begin of t_objectTable, classname type string, object type ko100-object, text type ko100-text, end of t_objectTable. data data data data data data data data data iterator type ref to IF_IXML_NODE_ITERATOR. ixml type ref to if_ixml. Namefilter type ref to IF_IXML_NODE_FILTER. parentFilter type ref to IF_IXML_NODE_FILTER. currentNode type ref to if_ixml_node. newNode type ref to if_ixml_node. rval type i. ixmlDocument type ref to if_ixml_document. _objName type string. | |data data data data data data data data data dataobjType type string. objectTable type table of t_objectTable. objectLine type t_objectTable. exists type flag. sTemp type string. nameCollision type flag. l_targetObject type ref to zsaplink. l_installObject type string. l_excClass type ref to ZCX_SAPLINK. tempcname type string.ixml = cl_ixml=>create( ). nameFilter = xmlDoc->create_filter_name( name = 'nugget' ). parentFilter = xmlDoc->create_filter_parent( nameFilter ). iterator = xmlDoc->create_iterator_filtered( parentFilter ). currentNode ?= iterator->get_next( ). while currentNode is not initial. clear exists. ixmlDocument = ixml->create_document( ). newNode = currentNode->clone( ). rval = ixmlDocument->append_child( newNode ). call method zsaplink=>GETOBJECTInfoFROMIXMLDOC exporting ixmlDocument = ixmlDocument importing objtypename = objType objname = _objName. * call method zsaplink=>getplugins( changing objectTable = objectTable ) *. * * read table objectTable into objectLine with key object = objType. * * if sy-subrc = 0. translate objType to upper case. case objtype. when 'CLAS'. tempcname = 'ZSAPLINK_CLASS'. when 'PROG'. tempcname = 'ZSAPLINK_PROGRAM'. when others. endcase. create object l_targetObject type (tempcname) exporting name = _objName. objectExists = l_targetObject->checkexists( ). if objectExists = 'X' and overWrt = ''. write :/ objType, _objName, ' exists on this system , if you wish to install this Nugget ' & 'please set the Overwrite Originals checkbox.' . elseif objectExists = 'X' and overWrt = 'X'. if l_targetObject is not initial.*if y2all 'X'. concatenate objType _objName into sTemp separated by space. perform confirmOverwrite using sTemp changing flag. if flag = '1'. "yes elseif flag = '2'. "yes to all y2all = 'X'. elseif flag = 'A'. "cancel write / 'Import cancelled by user'. Flag = 'X'. exit. endif. endif. try. l_installObject = l_targetObject->createObjectfromiXMLDoc( ixmlDocument = ixmlDocument overwrite = overWrt ). catch ZCX_SAPLINK into l_excClass. statusMsg = l_excClass->get_text( ). Flag = 'X'. endtry. if l_installObject is not initial. concatenate 'Installed: ' objType l_installObject into statusMsg separated by space. endif. else. statusMsg = 'an undetermined error occured'. Flag = 'X'. endif. else. try. l_installObject = l_targetObject->createObjectfromiXMLDoc( ixmlDocument = ixmlDocument overwrite = overWrt ).catch ZCX_SAPLINK into l_excClass. statusMsg = l_excClass->get_text( ). Flag = 'X'. endtry. if l_installObject is not initial. concatenate 'Installed: ' objType l_installObject into statusMsg separated by space. endif. endif. currentNode ?= iterator->get_next( ). write: / Statusmsg. endwhile. endform. */----------------------confirmOverwrite------------------------------\ form confirmOverwrite using l_objInfo type string changing l_answer type flag. data l_message type string. data l_title type string. clear l_answer. l_title = 'Overwrite confirm. Proceed with CAUTION!'.concatenate 'You have selected to overwrite originals.' l_objinfo 'will be overwritten. Are you sure?' into l_message separated by space. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING TITLEBAR = l_title text_question = l_message TEXT_BUTTON_1 = 'Yes' TEXT_BUTTON_2 = 'Yes to all' DEFAULT_BUTTON = '1' DISPLAY_CANCEL_BUTTON = 'X' IMPORTING ANSWER = l_answer . endform. *\--------------------------------------------------------------------/