Professional Documents
Culture Documents
Zsaplink Installer
Zsaplink Installer
methods CONSTRUCTOR
importing
!TEXTID like TEXTID optional
!PREVIOUS like PREVIOUS optional
!MSG type STRING default '44F7518323DB08BC02000000A7E42BB6'
!OBJECT type STRING optional .
protected section.
private section.
ENDCLASS.
CLASS ZSAPLINK DEFINITION
CREATE PUBLIC
ABSTRACT
.
public section.
types:
BEGIN OF gts_version_info,
* Change this if import or export is incompatible to older major versions or if
enhancements are so important to force the new version of the plugin
* Please comment changes in major version in class documentation
zsaplink_plugin_major_version TYPE i,
* Change this if bugfixes are being done but the basic structure and im- and
exportbehaviour don't change. Reset to 0 when incrementing major version
* Please comment changes in minor version in class documentation
zsaplink_plugin_minor_version TYPE i,
* Change this if cosmetic changes are being done or if internal handling
changed but no change to import- or exportbehaviour
* ( i.e. speeding up the plugin will fall into this ). Reset to 0 when
incrementeing major or minor version
zsaplink_plugin_build_version TYPE i,
*
zsaplink_plugin_info1 TYPE string, " Plugin info - part 1 - See
demoimplementation how this may be used
zsaplink_plugin_info2 TYPE string, " Plugin info - part 2
zsaplink_plugin_info3 TYPE string, " Plugin info - part 3
zsaplink_plugin_info4 TYPE string, " Plugin info - part 4
zsaplink_plugin_info5 TYPE string, " Plugin info - part 5
END OF gts_version_info .
class-methods GETOBJECTINFOFROMIXMLDOC
importing
!IXMLDOCUMENT type ref to IF_IXML_DOCUMENT
exporting
!OBJTYPENAME type STRING
!OBJNAME type STRING
raising
ZCX_SAPLINK .
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 .
class-methods GET_VERSION_INFO_STATIC
importing
!IV_CLASSNAME type CLIKE
returning
value(RS_VERSION_INFO) type GTS_VERSION_INFO .
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 CREATESTRINGFROMOBJECT
returning
value(STRING) type STRING
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 .
methods VALUEHELP
importing
!I_OBJTYPE type STRING
returning
value(E_OBJNAME) type STRING .
class-methods CHECKOBJECT
importing
!I_IXMLDOCUMENT type ref to IF_IXML_DOCUMENT
exporting
!E_OBJTYPE type STRING
!E_OBJNAME type STRING
!E_PLUGINEXISTS type FLAG
!E_OBJECTEXISTS type FLAG
!E_TARGETOBJECT type ref to ZSAPLINK .
methods GET_VERSION_INFO
returning
value(RS_VERSION_INFO) type GTS_VERSION_INFO .
protected section.
methods DELETEOBJECT
abstract
raising
ZCX_SAPLINK .
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
importing
value(NODE) type ref to IF_IXML_ELEMENT
!DEVCLASS type DEVCLASS default '$TMP'
exporting
!CONCEPT type SOTR_TEXT-CONCEPT
raising
ZCX_SAPLINK .
methods CREATENODEFROMOTR
importing
!OTRGUID type SOTR_CONC
returning
value(NODE) type ref to IF_IXML_ELEMENT .
private section.
types:
BEGIN OF t_objecttable,
classname TYPE string,
object TYPE ko100-object,
text TYPE ko100-text,
END OF t_objecttable .
methods CREATE_ALIAS_METHOD
changing
!XT_ALIASES_METHOD type SEOO_ALIASES_R .
methods CREATE_CLSDEFERRD
changing
!XT_CLSDEFERRDS type SEOT_CLSDEFERRDS_R .
methods CREATE_INTDEFERRD
changing
!XT_INTDEFERRDS type SEOT_INTDEFERRDS_R .
methods CREATE_OTR
importing
value(NODE) type ref to IF_IXML_ELEMENT
!DEVCLASS type DEVCLASS default '$TMP'
exporting
!CONCEPT type SOTR_TEXT-CONCEPT
raising
ZCX_SAPLINK .
methods CREATE_TYPEPUSAGE
changing
!XT_TYPEPUSAGES type SEOT_TYPEPUSAGES_R .
methods GET_ALIAS_METHOD
importing
!IT_METHODS type ABAP_METHDESCR_TAB
changing
!XO_ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_CLSDEFERRD
changing
!XO_ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_INTDEFERRD
changing
!XO_ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_OTR
importing
!OTRGUID type SOTR_CONC
returning
value(NODE) type ref to IF_IXML_ELEMENT .
methods GET_TYPEPUSAGE
changing
!XO_ROOTNODE type ref to IF_IXML_ELEMENT .
private section.
ENDCLASS.
CLASS ZSAPLINK_CLASS DEFINITION
INHERITING FROM ZSAPLINK_OO
CREATE PUBLIC
.
public section.
type-pools ABAP .
data MV_STEAMROLLER type ABAP_BOOL value ABAP_FALSE. "#EC NOTEXT
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .
methods GET_VERSION_INFO
redefinition .
protected section.
methods CREATE_DOCUMENTATION .
methods CREATE_METHOD_DOCUMENTATION
importing
!NODE type ref to IF_IXML_ELEMENT .
methods CREATE_SECTIONS .
methods CREATE_TEXTPOOL .
methods FINDIMPLEMENTINGCLASS
importing
!METHODNAME type STRING
!STARTCLASS type STRING optional
returning
value(CLASSNAME) type STRING .
methods GET_DOCUMENTATION
changing
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_METHOD_DOCUMENTATION
importing
!METHOD_KEY type SEOCPDKEY
changing
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_SECTIONS
changing
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods GET_TEXTPOOL
changing
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .
private section.
ENDCLASS.
CLASS ZSAPLINK_PROGRAM DEFINITION
INHERITING FROM ZSAPLINK
FINAL
CREATE PUBLIC
.
public section.
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .
methods CREATESTRINGFROMOBJECT
redefinition .
protected section.
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .
private section.
methods GET_SOURCE
returning
value(PROGSOURCE) type RSWSOURCET .
methods UPDATE_WB_TREE .
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_DOCUMENTATION
importing
!DOCNODE 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 GET_DOCUMENTATION
returning
value(DOCNODE) type ref to IF_IXML_ELEMENT .
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 ZCX_SAPLINK IMPLEMENTATION.
method CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
TEXTID = TEXTID
PREVIOUS = PREVIOUS
.
IF textid IS INITIAL.
me->textid = ZCX_SAPLINK .
ENDIF.
me->MSG = MSG .
me->OBJECT = OBJECT .
endmethod.
ENDCLASS.
CLASS ZSAPLINK IMPLEMENTATION.
method BUILDSOURCESTRING.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data sTemp type string.
data pageLine type O2PAGELINE.
IF sy-subrc = 0.
e_pluginexists = 'X'.
CREATE OBJECT e_targetobject
TYPE
(l_objline-classname)
EXPORTING
name = e_objname.
e_objectexists = e_targetobject->checkexists( ).
ENDIF.
ENDMETHOD.
method CONSTRUCTOR.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
objName = name.
translate objName to upper case.
ixml = cl_ixml=>create( ).
xmlDoc = ixml->create_document( ).
streamFactory = ixml->CREATE_STREAM_FACTORY( ).
endmethod.
method CONVERTIXMLDOCTOSTRING.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data _ixml type ref to if_ixml.
data _encoding type ref to if_ixml_encoding.
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 _tempStringx type xstring.
data _printXMLDoc type ref to cl_xml_document.
data _rc type sysubrc.
_ixml = cl_ixml=>create( ).
_encoding = _ixml->create_encoding(
byte_order = if_ixml_encoding=>co_none
character_set = 'utf-8' ).
_streamFactory = _ixml->CREATE_STREAM_FACTORY( ).
_outputStream = _streamFactory->create_ostream_xstring( _tempStringx ).
_outputstream->set_encoding( encoding = _encoding ).
_renderer = _ixml->CREATE_RENDERER(
DOCUMENT = ixmlDocument
OSTREAM = _outputStream
).
_renderer->SET_NORMALIZING( ).
_rc = _renderer->render( ).
create object _printXMLDoc.
_rc = _printXMLDoc->parse_string( _tempString ).
xmlString = _tempString.
endmethod.
method CONVERTSTRINGTOIXMLDOC.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
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.
" Make sure to convert Windows Line Break to Unix as
" this linebreak is used to get a correct import
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf
IN xmlString WITH cl_abap_char_utilities=>newline.
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.
endmethod.
method CREATENODEFROMOTR.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA rootnode TYPE REF TO if_ixml_element.
DATA txtnode TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
node = rootnode.
endmethod.
method CREATEOTRFROMNODE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA txtnode TYPE REF TO if_ixml_element.
DATA filter TYPE REF TO if_ixml_node_filter.
DATA iterator TYPE REF TO if_ixml_node_iterator.
* ewH:issue 33--> in 6.40 and above, you cannot pass a default concept
* (otr) guid, so we will always create new
* CALL FUNCTION 'SOTR_GET_CONCEPT'
* EXPORTING
* concept = sotrHeader-concept
** IMPORTING
** HEADER =
** TABLES
** ENTRIES =
* EXCEPTIONS
* NO_ENTRY_FOUND = 1
* OTHERS = 2
* .
* IF sy-subrc <> 1.
** delete OTR if exists already
* CALL FUNCTION 'SOTR_DELETE_CONCEPT'
* EXPORTING
* concept = sotrHeader-concept
* EXCEPTIONS
* NO_AUTHORIZATION = 1
* NO_ENTRY_FOUND = 2. "who cares
** CONCEPT_USED = 3
** NO_MASTER_LANGUAGE = 4
** NO_SOURCE_SYSTEM = 5
** NO_TADIR_ENTRY = 6
** ERROR_IN_CORRECTION = 7
** USER_CANCELLED = 8
** OTHERS = 9
** .
* if sy-subrc = 1.
* raise exception type zcx_saplink
* exporting textid = zcx_saplink=>not_authorized.
* endif.
* ENDIF.
* create OTR
sotrpaket-paket = devclass.
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
EXPORTING
paket = sotrpaket
crea_lan = sotrheader-crea_lan
alias_name = sotrheader-alias_name
* CATEGORY =
object = objecttype
entries = sotrtexttable
* FLAG_CORRECTION_ENTRY =
* IN_UPDATE_TASK =
* CONCEPT_DEFAULT = sotrHeader-concept "ewH:33
IMPORTING
concept = concept "ewH:33
EXCEPTIONS
package_missing = 1
crea_lan_missing = 2
object_missing = 3
paket_does_not_exist = 4
alias_already_exist = 5
object_type_not_found = 6
langu_missing = 7
identical_context_not_allowed = 8
text_too_long = 9
error_in_update = 10
no_master_langu = 11
error_in_concept_id = 12
alias_not_allowed = 13
tadir_entry_creation_failed = 14
internal_error = 15
error_in_correction = 16
user_cancelled = 17
no_entry_found = 18
OTHERS = 19
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmethod.
method CREATESTRINGFROMOBJECT.
endmethod.
method CREATEXMLSTRING.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
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.
streamFactory = ixml->CREATE_STREAM_FACTORY( ).
outputStream = streamFactory->CREATE_OSTREAM_CSTRING( tempString ).
renderer = ixml->CREATE_RENDERER(
DOCUMENT = xmlDoc OSTREAM = outputStream ).
rc = renderer->render( ).
create object printXMLDoc.
rc = printXMLDoc->parse_string( tempString ).
xml = tempString.
endmethod.
METHOD getobjectinfofromixmldoc.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
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( ).
* Check whether got a valid ixmldocument
IF rootnode IS NOT BOUND.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = zcx_saplink=>incorrect_file_format.
ENDIF.
REFRESH objecttable.
tabletypeline-object = objtype.
APPEND tabletypeline TO tabletypesin.
clear structure.
attributeList = node->GET_ATTRIBUTES( ).
nodeIterator = attributeList->create_iterator( ).
attributeNode = nodeIterator->get_next( ).
while attributeNode is not initial.
name = attributeNode->get_name( ).
if name = 'VERSION' and preserveVersion is initial. "ewh:issue 45
* if name = 'VERSION'.
value = '0'.
else.
value = attributeNode->get_value( ).
endif.
assign component name of structure structure to <value>.
if sy-subrc = 0.
<value> = value.
endif.
attributeNode = nodeIterator->get_next( ).
endwhile.
* .-"-.
* .'=^=^='.
* /=^=^=^=^=\
*:^=SAPLINK=^;
*|^ EASTER ^|
*:^=^EGG^=^=^:
* \=^=^=^=^=/
* `.=^=^=.'
* `~~~`
* Don't like the way we did something?
* Help us fix it! Tell us what you think!
* http://saplink.org
endmethod.
METHOD GET_VERSION_INFO.
*--------------------------------------------------------------------*
* Please use the following 6 lines of code when versioning a
* SAPLINK-Plugin. See documentation of Type GTS_VERSION_INFO
* what should be put here
*--------------------------------------------------------------------*
rs_version_info-zsaplink_plugin_major_version = 0. " Default for all child
classes, that have not been updated to return a version info.
rs_version_info-zsaplink_plugin_minor_version = 0. " Default for all child
classes, that have not been updated to return a version info.
rs_version_info-zsaplink_plugin_build_version = 0. " Default for all child
classes, that have not been updated to return a version info.
TRY.
CREATE OBJECT lo_zsaplink TYPE (iv_classname)
EXPORTING
name = 'Not needed for versio info'.
rs_version_info = lo_zsaplink->get_version_info( ).
CATCH cx_root. " Don't pass version info for unknown or abstract classes
ENDTRY.
ENDMETHOD.
method SETATTRIBUTESFROMSTRUCTURE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data int type i.
int = int.
data structDescr type ref to cl_abap_structDescr.
data aComponent type abap_compdescr.
field-symbols <fieldValue> type any.
data rc type sysubrc.
data sName type string.
data sValue type string.
endmethod.
method VALUEHELP.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA l_object_type type euobj-id.
data objname(40) type c.
l_object_type = i_objType.
e_objname = objname.
endmethod.
ENDCLASS.
CLASS ZSAPLINK_OO IMPLEMENTATION.
method CREATE_ALIAS_METHOD.
DATA: filter TYPE REF TO if_ixml_node_filter,
iterator TYPE REF TO if_ixml_node_iterator,
node TYPE REF TO if_ixml_element.
endmethod.
method CREATE_CLSDEFERRD.
DATA: filter TYPE REF TO if_ixml_node_filter,
iterator TYPE REF TO if_ixml_node_iterator,
node TYPE REF TO if_ixml_element.
DATA: ls_clsdeferrd LIKE LINE OF xt_clsdeferrds.
endmethod.
method CREATE_INTDEFERRD.
DATA: filter TYPE REF TO if_ixml_node_filter,
iterator TYPE REF TO if_ixml_node_iterator,
node TYPE REF TO if_ixml_element.
endmethod.
method CREATE_OTR.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA txtnode TYPE REF TO if_ixml_element.
DATA filter TYPE REF TO if_ixml_node_filter.
DATA iterator TYPE REF TO if_ixml_node_iterator.
* ewH:issue 33--> in 6.40 and above, you cannot pass a default concept
* (otr) guid, so we will always create new
* CALL FUNCTION 'SOTR_GET_CONCEPT'
* EXPORTING
* concept = sotrHeader-concept
** IMPORTING
** HEADER =
** TABLES
** ENTRIES =
* EXCEPTIONS
* NO_ENTRY_FOUND = 1
* OTHERS = 2
* .
* IF sy-subrc <> 1.
** delete OTR if exists already
* CALL FUNCTION 'SOTR_DELETE_CONCEPT'
* EXPORTING
* concept = sotrHeader-concept
* EXCEPTIONS
* NO_AUTHORIZATION = 1
* NO_ENTRY_FOUND = 2. "who cares
** CONCEPT_USED = 3
** NO_MASTER_LANGUAGE = 4
** NO_SOURCE_SYSTEM = 5
** NO_TADIR_ENTRY = 6
** ERROR_IN_CORRECTION = 7
** USER_CANCELLED = 8
** OTHERS = 9
** .
* if sy-subrc = 1.
* raise exception type zcx_saplink
* exporting textid = zcx_saplink=>not_authorized.
* endif.
* ENDIF.
* create OTR
sotrpaket-paket = devclass.
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
EXPORTING
paket = sotrpaket
crea_lan = sotrheader-crea_lan
alias_name = sotrheader-alias_name
* CATEGORY =
object = objecttype
entries = sotrtexttable
* FLAG_CORRECTION_ENTRY =
* IN_UPDATE_TASK =
* CONCEPT_DEFAULT = sotrHeader-concept "ewH:33
IMPORTING
concept = concept "ewH:33
EXCEPTIONS
package_missing = 1
crea_lan_missing = 2
object_missing = 3
paket_does_not_exist = 4
alias_already_exist = 5
object_type_not_found = 6
langu_missing = 7
identical_context_not_allowed = 8
text_too_long = 9
error_in_update = 10
no_master_langu = 11
error_in_concept_id = 12
alias_not_allowed = 13
tadir_entry_creation_failed = 14
internal_error = 15
error_in_correction = 16
user_cancelled = 17
no_entry_found = 18
OTHERS = 19
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmethod.
method CREATE_TYPEPUSAGE.
DATA: filter TYPE REF TO if_ixml_node_filter,
iterator TYPE REF TO if_ixml_node_iterator,
node TYPE REF TO if_ixml_element,
source TYPE string.
endmethod.
method GET_ALIAS_METHOD.
DATA lo_alias TYPE REF TO if_ixml_element.
DATA ls_alias TYPE seoaliases.
DATA: l_rc TYPE sy-subrc,
ls_method LIKE LINE OF it_methods,
ls_clsmethkey TYPE seocmpkey.
endmethod.
method GET_CLSDEFERRD.
DATA: lt_clsdeferrds TYPE seot_clsdeferrds_r,
lo_clsdeferrds TYPE REF TO if_ixml_element,
ls_clsdeferrd TYPE seot_typepusage_r.
ls_classkey-clsname = objname.
ls_classkey-clsname = objname.
endmethod.
method GET_OTR.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA rootnode TYPE REF TO if_ixml_element.
DATA txtnode TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
node = rootnode.
endmethod.
method GET_TYPEPUSAGE.
DATA: lt_typepusages TYPE seot_typepusages_r,
lo_typepusages TYPE REF TO if_ixml_element,
ls_typepusage TYPE seot_typepusage_r.
ls_classkey-clsname = objname.
endmethod.
ENDCLASS.
CLASS ZSAPLINK_CLASS IMPLEMENTATION.
method CHECKEXISTS.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data classkey type SEOCLSKEY.
data not_active TYPE SEOX_BOOLEAN.
classKey-clsName = objname.
if sy-subrc <> 2.
exists = 'X'.
endif.
endmethod.
METHOD createixmldocfromobject.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA localimplementation TYPE REF TO if_ixml_element.
DATA localtypes TYPE REF TO if_ixml_element.
DATA localmacros TYPE REF TO if_ixml_element.
DATA rootnode TYPE REF TO if_ixml_element.
DATA reportlist TYPE STANDARD TABLE OF string.
DATA includename TYPE program.
DATA _classname TYPE seoclsname.
DATA reportstring TYPE string.
DATA rc TYPE sysubrc.
DATA classdescr TYPE REF TO cl_abap_classdescr.
DATA typedescr TYPE REF TO cl_abap_typedescr.
DATA methoddescr TYPE abap_methdescr.
DATA methodnode TYPE REF TO if_ixml_element.
DATA parameternode TYPE REF TO if_ixml_element.
DATA sourcenode TYPE REF TO if_ixml_element.
DATA exceptionnode TYPE REF TO if_ixml_element.
DATA exceptionlist TYPE seos_exceptions_r.
DATA anexception TYPE vseoexcep.
DATA inheritancenode TYPE REF TO if_ixml_element.
DATA redefnode TYPE REF TO if_ixml_element.
_classname = objname.
classkey-clsname = objname.
* setObjectType( ).
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>not_found
object = objname.
WHEN 2.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'class deleted'.
WHEN 3.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'interfaces not supported'.
WHEN 4.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'class is modeled only'.
ENDCASE.
ENDIF.
TRY.
CALL METHOD cl_abap_classdescr=>describe_by_name
EXPORTING
p_name = objname
RECEIVING
p_descr_ref = typedescr
EXCEPTIONS
type_not_found = 1.
IF sy-subrc = 0.
classdescr ?= typedescr.
ELSE.
ENDIF.
CATCH cx_root.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>system_error.
ENDTRY.
IF sy-subrc = 0.
superclassname = superclass->get_relative_name( ).
IF NOT superclassname CS 'OBJECT'.
superclasskey-clsname = objname.
superclasskey-refclsname = superclassname.
CALL FUNCTION 'SEO_INHERITANC_GET'
EXPORTING
inhkey = superclasskey
IMPORTING
inheritance = inheritanceprops
redefinitions = redefines.
setattributesfromstructure( node = rootnode structure =
inheritanceprops ).
ENDIF.
ENDIF.
lt_implementings_copy = it_implementings.
LOOP AT it_implementings INTO wa_implementings.
CLEAR: ls_intfkey.
ls_intfkey-clsname = wa_implementings-refclsname.
CALL FUNCTION 'SEO_INTERFACE_TYPEINFO_GET'
EXPORTING
intkey = ls_intfkey
IMPORTING
comprisings = lt_comprisings.
LOOP AT lt_comprisings ASSIGNING <ls_comprisings>.
DELETE lt_implementings_copy WHERE refclsname = <ls_comprisings>-
refclsname.
ENDLOOP.
ENDLOOP.
* parameters
LOOP AT eventparams INTO wa_params.
parameternode = xmldoc->create_element( 'parameter' ).
setattributesfromstructure( node = parameternode
structure = wa_params ).
rc = event_node->append_child( parameternode ).
ENDLOOP.
rc = rootnode->append_child( event_node ).
ENDLOOP.
*/***rrq - End of Added Logic for EVENTS -------------------*/
* removed by Rene.
get_sections( CHANGING rootnode = rootnode ) .
*|--------------------------------------------------------------------|
includename = cl_oo_classname_service=>get_ccimp_name( _classname ).
READ REPORT includename INTO reportlist.
localimplementation = xmldoc->create_element( 'localImplementation' ).
reportstring = buildsourcestring( sourcetable = reportlist ).
rc = localimplementation->if_ixml_node~set_value( reportstring ).
*|--------------------------------------------------------------------|
includename = cl_oo_classname_service=>get_ccdef_name( _classname ).
READ REPORT includename INTO reportlist.
localtypes = xmldoc->create_element( 'localTypes' ).
reportstring = buildsourcestring( sourcetable = reportlist ).
rc = localtypes->if_ixml_node~set_value( reportstring ).
*|--------------------------------------------------------------------|
includename = cl_oo_classname_service=>get_ccmac_name( _classname ).
READ REPORT includename INTO reportlist.
localmacros = xmldoc->create_element( 'localMacros' ).
reportstring = buildsourcestring( sourcetable = reportlist ).
rc = localmacros->if_ixml_node~set_value( reportstring ).
*|--------------------------------------------------------------------|
*/***EVP - Added Logic for Local Test Classes ----------------------*/
DATA localtestclasses TYPE REF TO if_ixml_element.
DATA localtestclassesexist TYPE i.
includename =
cl_oo_classname_service=>get_local_testclasses_include( _classname ).
READ REPORT includename INTO reportlist.
" If sy-subrc = 0 the local test classes do exist
localtestclassesexist = sy-subrc.
IF localtestclassesexist = 0.
localtestclasses = xmldoc->create_element( 'localTestClasses' ).
reportstring = buildsourcestring( sourcetable = reportlist ).
rc = localtestclasses->if_ixml_node~set_value( reportstring ).
ENDIF.
*/***EVP - End of Added Logic for Local Test Classes ---------------*/
*| |
*\--------------------------------------------------------------------/
rc = rootnode->append_child( localimplementation ).
rc = rootnode->append_child( localtypes ).
rc = rootnode->append_child( localmacros ).
*/***EVP - Added Logic for Local Test Classes -------------------*/
IF localtestclassesexist = 0.
rc = rootnode->append_child( localtestclasses ).
ENDIF.
*/***EVP - End of Added Logic for Local Test Classes ------------*/
**// Rich: Start
get_textpool( CHANGING rootnode = rootnode ).
get_documentation( CHANGING rootnode = rootnode ).
**// Rich: End
get_typepusage( CHANGING xo_rootnode = rootnode ).
get_clsdeferrd( CHANGING xo_rootnode = rootnode ).
get_intdeferrd( CHANGING xo_rootnode = rootnode ).
*// ewH: begin of logic for interface methods & inheritance redesign-->
* inheritances & redefinitions: old source removed-recover w/subversion
CALL FUNCTION 'SEO_INHERITANC_READ'
EXPORTING
clskey = classkey
IMPORTING
inheritance = inheritance
redefinitions = redefinitions
EXCEPTIONS
class_not_existing = 1
OTHERS = 2.
IF methoddescr-is_redefined = 'X'.
methodnode = xmldoc->create_element( 'method' ).
MOVE-CORRESPONDING clsmethkey TO methodproperties.
*// ewh: begin of forward compatibility hack, can be removed for next
*// major release-->
READ TABLE redefinitions INTO redefinition
WITH KEY mtdname = methoddescr-name.
IF sy-subrc = 0.
methodproperties-clsname = redefinition-refclsname.
ENDIF.
*//<--ewH: end of forward compatibility hack
setattributesfromstructure( node = methodnode structure =
methodproperties ).
ELSE.
CALL FUNCTION 'SEO_METHOD_GET'
EXPORTING
mtdkey = clsmethkey
IMPORTING
method = methodproperties
EXCEPTIONS
not_existing = 1.
IF sy-subrc = 0.
methodnode = xmldoc->create_element( 'method' ).
setattributesfromstructure( node = methodnode structure =
methodproperties ).
* parameters
LOOP AT methoddescr-parameters INTO paramdescr.
CLEAR paramproperties.
parameternode = xmldoc->create_element( 'parameter' ).
paramkey-cmpname = clsmethkey-cmpname.
paramkey-sconame = paramdescr-name.
paramkey-clsname = objname.
CALL FUNCTION 'SEO_PARAMETER_GET'
EXPORTING
parkey = paramkey
version = '1'
IMPORTING
parameter = paramproperties.
setattributesfromstructure( node = parameternode
structure = paramproperties ).
rc = methodnode->append_child( parameternode ).
ENDLOOP.
* exceptions
CALL FUNCTION 'SEO_METHOD_SIGNATURE_GET'
EXPORTING
mtdkey = clsmethkey
version = '1'
IMPORTING
exceps = exceptionlist.
LOOP AT exceptionlist INTO anexception.
exceptionnode = xmldoc->create_element( 'exception' ).
setattributesfromstructure( node = exceptionnode
structure = anexception ).
rc = methodnode->append_child( exceptionnode ).
ENDLOOP.
ENDIF. "method found
ENDIF. "is_redefined?
* source
CALL METHOD cl_oo_classname_service=>get_method_include
EXPORTING
mtdkey = methodkey
RECEIVING
result = includename
EXCEPTIONS
method_not_existing = 1.
IF sy-subrc = 0.
READ REPORT includename INTO reportlist.
reportstring = buildsourcestring( sourcetable = reportlist ).
sourcenode = xmldoc->create_element( 'source' ).
rc = sourcenode->if_ixml_node~set_value( reportstring ).
rc = methodnode->append_child( sourcenode ).
ENDIF.
** StartInsert Rich - Handle method documenation
get_method_documentation( EXPORTING method_key = methodkey
CHANGING rootnode = methodnode ).
** EndInsert Rich - Handle method documenation
rc = rootnode->append_child( methodnode ).
ENDIF. "is_interface?
ENDLOOP.
* create alias info for load.
get_alias_method( EXPORTING it_methods = classdescr->methods
CHANGING xo_rootnode = rootnode ).
* append root node to xmldoc
rc = xmldoc->append_child( rootnode ).
ixmldocument = xmldoc.
*// <--ewH: end of logic for interface methods & inheritance redesign
ENDMETHOD.
method CREATEOBJECTFROMIXMLDOC.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA rootnode TYPE REF TO if_ixml_element.
DATA classkey TYPE seoclskey.
DATA filter TYPE REF TO if_ixml_node_filter.
DATA iterator TYPE REF TO if_ixml_node_iterator.
DATA node TYPE REF TO if_ixml_element.
DATA otrnode TYPE REF TO if_ixml_element.
DATA filter2 TYPE REF TO if_ixml_node_filter.
DATA iterator2 TYPE REF TO if_ixml_node_iterator.
DATA superclass TYPE vseoextend-clsname.
DATA superclasskey TYPE vseoextend.
DATA methodsourcenode TYPE REF TO if_ixml_node.
DATA sourcenode TYPE REF TO if_ixml_node.
DATA source TYPE string.
DATA sourcetable TYPE TABLE OF string.
DATA methodkey TYPE seocpdkey.
DATA node2 TYPE REF TO if_ixml_element.
DATA _objtype TYPE string.
DATA aobjname TYPE e071-obj_name.
DATA inheritancenode TYPE REF TO if_ixml_element.
DATA redefnode TYPE REF TO if_ixml_element.
DATA includename TYPE program.
DATA mtdkey TYPE seocpdkey.
e_devclass = devclass.
_objtype = getobjecttype( ).
e_overwrite = overwrite.
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
node2 ?= iterator2->get_next( ).
ENDWHILE.
node ?= iterator->get_next( ).
ENDWHILE.
*//<--rrq: End of Added Logic for events
node ?= iterator->get_next( ).
CONTINUE.
ENDIF.
*// <--ewH: break in backward compatibility hack - 2Bcontinued below
node2 ?= iterator2->get_next( ).
ENDWHILE.
filter2 = node->create_filter_name( 'exception' ).
iterator2 = node->create_iterator_filtered( filter2 ).
node2 ?= iterator2->get_next( ).
WHILE node2 IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node = node2
CHANGING
structure = wa_exceps.
APPEND wa_exceps TO ch_exceps.
node2 ?= iterator2->get_next( ).
ENDWHILE.
APPEND wa_methods TO ch_methods.
node ?= iterator->get_next( ).
ENDWHILE.
*// <--ewH: end redesign method/inheritances
*// ewh: continuation of backward compatibility hack-->
* IF ( ch_redefinitions IS NOT INITIAL OR superclass-clsname
* IS NOT INITIAL ) and ch_inheritance is initial.
* CALL FUNCTION 'SEO_INHERITANC_CREATE_F_DATA'
* EXPORTING
* save = ' '
* CHANGING
* inheritance = superclasskey
* redefinitions = ch_redefinitions.
* ENDIF.
*// <--ewH: end of backward compatibility hack
node ?= iterator->get_next( ).
ENDWHILE.
*// <--ewH: end create interface methods
* local implementation
DATA _classname TYPE seoclsname.
_classname = objname.
sourcenode = xmldoc->find_from_name( 'localImplementation' ).
IF sourcenode IS NOT INITIAL.
source = sourcenode->get_value( ).
e_locals_imp = buildtablefromstring( source ).
ENDIF.
* local types
sourcenode = xmldoc->find_from_name( 'localTypes' ).
IF sourcenode IS NOT INITIAL.
source = sourcenode->get_value( ).
e_locals_def = buildtablefromstring( source ).
ENDIF.
* local macros
sourcenode = xmldoc->find_from_name( 'localMacros' ).
IF sourcenode IS NOT INITIAL.
source = sourcenode->get_value( ).
e_locals_mac = buildtablefromstring( source ).
ENDIF.
* We don't need the sections for now. Code moved by Rene
create_sections( ).
name = objname.
*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.
*/***EVP - Added Logic for Local Test Classes -------------------*/
**local test classes
sourcenode = xmldoc->find_from_name( 'localTestClasses' ).
IF sourcenode IS NOT INITIAL.
DATA clskey TYPE seoclskey.
source = sourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
clskey-clsname = _classname.
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
EXPORTING
clskey = clskey
force = overwrite
locals_testclasses = sourcetable
EXCEPTIONS
not_existing = 1
model_only = 2
locals_not_generated = 3
locals_not_initialised = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
*/***EVP - End Of Added Logic for Local Test Classes -------------------*/
create_documentation( ).
**// Rich: End
endmethod.
method CREATE_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA txtline_node TYPE REF TO if_ixml_element.
DATA txtline_filter TYPE REF TO if_ixml_node_filter.
DATA txtline_iterator TYPE REF TO if_ixml_node_iterator.
REFRESH lt_lines.
language = lang_node->get_attribute( name = c_xml_key_spras ).
obj_langu = language.
lang_node ?= lang_iterator->get_next( ).
ENDWHILE.
endmethod.
method CREATE_METHOD_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA txtline_node TYPE REF TO if_ixml_element.
DATA txtline_filter TYPE REF TO if_ixml_node_filter.
DATA txtline_iterator TYPE REF TO if_ixml_node_iterator.
* If no class method name, then there was no class method documenation, just
return.
if classmeth_name is initial.
return.
endif.
refresh lt_lines.
language = lang_node->get_attribute( name = 'SPRAS' ).
obj_langu = language.
lang_node ?= lang_iterator->get_next( ).
ENDWHILE.
endmethod.
method CREATE_SECTIONS.
*ewH-not sure how this type_source param works. type sources can come
* from private or protected sections, but there is no way to pass
* these separately into the class create FM. After debugging into
* FM->clif_save_all->generate_classpool it treats the source table
* as one, so I am not sure how to get it to differentiate between
* private and protected sections. If only one section has types
* defined, the FM call works, otherwise all hell breaks loose. To
* solve the problem for now, we will just do an insert report for
* the sections after the class creation, since that's all the FM
* does in the end anyway. Wow, this is a really long comment, but
* I dont want to have to try to remember what the hell was going
* on here later...sorry. :)
*insert code for publicSection
* sourcenode = xmldoc->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.
endmethod.
method CREATE_TEXTPOOL.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data textPoolTable type standard table of textPool.
data textPoolRow type textPool.
data langIterator type ref to if_ixml_node_iterator.
data filter type ref to if_ixml_node_filter.
data textFilter type ref to if_ixml_node_filter.
data textIterator type ref to if_ixml_node_iterator.
data textpoolnode type ref to if_ixml_element.
data langNode type ref to if_ixml_element.
data aTextNode type ref to if_ixml_element.
data _objName type TROBJ_NAME.
data obj_name type SEOCLSNAME.
data lang type spras.
data langNodeExists type flag.
* data logonLanguageExists type flag. " del #255 - seemingly not
used
data _state(1) type c.
data classpoolname type program.
DATA lv_original_language TYPE sylangu. " ins #255
*--------------------------------------------------------------------*
* Ticket #255 - Error importing texts when logon language different
* then original language of class
*--------------------------------------------------------------------*
textpoolnode = xmldoc->find_from_name( 'CLAS' ). " ins #255
lv_original_language = textpoolnode->get_attribute( 'LANGU' )." ins #255
SET LANGUAGE lv_original_language. " ins #255
" Gregor Wolf: With this all languages from the Nugget/Slinkee are imported
obj_name = objName.
classpoolname = cl_oo_classname_service=>GET_CLASSPOOL_NAME( obj_Name ).
_objName = classpoolname.
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. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data methodKey type SEOCMPKEY.
data methodProperties type VSEOMETHOD.
data classDescr type ref to cl_abap_classdescr.
data superClass type ref to cl_abap_typeDescr.
data superClassName type string.
if startClass is initial.
methodKey-CLSNAME = objName.
else.
methodKey-clsName = startClass.
endif.
methodKey-CMPNAME = methodName.
endmethod.
method GET_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA languagenode TYPE REF TO if_ixml_element.
DATA docnode TYPE REF TO if_ixml_element.
DATA txtlines_node TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
DATA _objtype TYPE string.
_objname = objname.
rc = rootnode->append_child( docnode ).
endmethod.
method GET_METHOD_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA languagenode TYPE REF TO if_ixml_element.
DATA docnode TYPE REF TO if_ixml_element.
DATA txtlines_node TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
DATA _objtype TYPE string.
_objname = method_key.
rc = rootnode->append_child( docnode ).
endmethod.
method GET_SECTIONS.
DATA publicsection TYPE REF TO if_ixml_element.
DATA protectedsection TYPE REF TO if_ixml_element.
DATA privatesection TYPE REF TO if_ixml_element.
DATA includename TYPE program.
DATA reportstring TYPE string.
**/--------------------------------------------------------------------\
**| |
* includename = cl_oo_classname_service=>get_pubsec_name( _classname ).
* READ REPORT includename INTO reportlist.
* publicsection = xmldoc->create_element( 'publicSection' ).
*
* reportstring = buildsourcestring( sourcetable = reportlist ).
* rc = publicsection->if_ixml_node~set_value( reportstring ).
* CLEAR reportstring.
**|--------------------------------------------------------------------|
* includename = cl_oo_classname_service=>get_prosec_name( _classname ).
* READ REPORT includename INTO reportlist.
* protectedsection = xmldoc->create_element( 'protectedSection' ).
* reportstring = buildsourcestring( sourcetable = reportlist ).
* rc = protectedsection->if_ixml_node~set_value( reportstring ).
* CLEAR reportstring.
**|--------------------------------------------------------------------|
* includename = cl_oo_classname_service=>get_prisec_name( _classname ).
* READ REPORT includename INTO reportlist.
* privatesection = xmldoc->create_element( 'privateSection' ).
* reportstring = buildsourcestring( sourcetable = reportlist ).
* rc = privatesection->if_ixml_node~set_value( reportstring ).
* rc = rootnode->append_child( publicsection ).
* rc = rootnode->append_child( protectedsection ).
* rc = rootnode->append_child( privatesection ).
endmethod.
method GET_TEXTPOOL.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA atext TYPE REF TO if_ixml_element.
DATA textpooltable TYPE STANDARD TABLE OF textpool.
DATA textpoolrow TYPE textpool.
DATA languagelist TYPE instlang.
DATA alanguage TYPE spras.
DATA _objname TYPE seoclsname.
DATA rc TYPE i.
DATA stemp TYPE string.
DATA languagenode TYPE REF TO if_ixml_element.
DATA textnode TYPE REF TO if_ixml_element.
DATA classpoolname TYPE program.
DATA firstloop TYPE flag.
_objname = objname.
firstloop = abap_true.
rc = rootnode->append_child( textnode ).
endmethod.
METHOD get_version_info.
ENDMETHOD.
ENDCLASS.
CLASS ZSAPLINK_PROGRAM IMPLEMENTATION.
method CHECKEXISTS.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
select single name from trdir into objName where NAME = objName.
if sy-subrc = 0.
exists = 'X'.
endif.
endmethod.
method CREATEIXMLDOCFROMOBJECT.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data rootNode type ref to if_ixml_element.
data sourceNode type ref to if_ixml_element.
data textPoolNode type ref to if_ixml_element.
data docNode type ref to if_ixml_element.
data dynproNode type ref to if_ixml_element.
data statusNode type ref to if_ixml_element.
data rc type sysubrc.
data progAttribs type trdir.
data progSource type RSWSOURCET.
data sourceString type string.
data _objType type string.
_objType = getObjectType( ).
rootNode = xmlDoc->create_element( _objType ).
sourceNode = xmlDoc->create_element( 'source' ).
select single * from trdir into progAttribs where NAME = objName.
if sy-subrc = 0.
setAttributesFromStructure( node = rootNode structure = progAttribs ).
progSource = me->get_source( ).
sourceString = buildSourceString( sourceTable = progSource ).
rc = sourceNode->IF_IXML_NODE~SET_VALUE( sourceString ).
textPoolNode = get_textPool( ).
rc = rootNOde->append_child( textPoolNode ).
docNode = get_documentation( ).
rc = rootNOde->append_child( docNode ).
dynproNode = get_dynpro( ).
rc = rootNode->append_child( dynproNode ).
statusNode = get_pfstatus( ).
rc = rootNode->append_child( statusNode ).
rc = rootNode->append_child( sourceNode ).
rc = xmldoc->append_child( rootNode ).
ixmlDocument = xmlDoc.
else.
clear ixmlDocument.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_found
object = objname.
endif.
endmethod.
method CREATEOBJECTFROMIXMLDOC.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data rootnode type ref to if_ixml_element.
data progattribs type trdir.
data sourcenode type ref to if_ixml_element.
data textnode type ref to if_ixml_element.
data docnode type ref to if_ixml_element.
data dynpnode type ref to if_ixml_element.
data statnode type ref to if_ixml_element.
data source type string.
data sourcetable type table_of_strings.
data _objname(30) type c.
data aobjname type trobj_name.
data _objtype type string.
data checkexists type flag.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
call method getstructurefromattributes
exporting
node = rootnode
changing
structure = progattribs.
objname = progattribs-name.
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.
enqueue_abap( ).
transport_copy( author = progattribs-cnam devclass = devclass ).
sourcenode = rootnode->find_from_name( 'source' ).
source = sourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
create_source( source = sourcetable attribs = progattribs ).
textnode = rootnode->find_from_name( 'textPool' ).
create_textpool( textnode ).
docnode = rootnode->find_from_name( 'programDocumentation' ).
create_documentation( docnode ).
dynpnode = rootnode->find_from_name( 'dynpros' ).
create_dynpro( dynpnode ).
statnode = rootnode->find_from_name( 'pfstatus' ).
create_pfstatus( statnode ).
dequeue_abap( ).
update_wb_tree( ).
*endif.
* successful install
name = objname.
endmethod.
method CREATESTRINGFROMOBJECT.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data progSource type RSWSOURCET.
progsource = me->get_source( ).
string = buildsourcestring( sourcetable = progsource ).
endmethod.
method CREATE_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
DATA txtline_node TYPE REF TO if_ixml_element.
DATA txtline_filter TYPE REF TO if_ixml_node_filter.
DATA txtline_iterator TYPE REF TO if_ixml_node_iterator.
refresh lt_lines.
language = lang_node->get_attribute( name = 'SPRAS' ).
obj_langu = language.
lang_node ?= lang_iterator->get_next( ).
ENDWHILE.
endmethod.
method CREATE_DYNPRO.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
types: begin of tdyn_head_temp.
include type d020s.
types: dtext type d020t-dtxt.
types: end of tdyn_head_temp.
_objname = objname.
dynpros_node = dynp_node.
check dynpros_node is not initial.
xdyn_head = xdyn_head_temp.
xdyn_text = xdyn_head_temp-dtext.
dynpro_node ?= dynpro_iterator->get_next( ).
endwhile.
endmethod.
method CREATE_PFSTATUS.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data: ista type table of rsmpe_stat,
ifun type table of rsmpe_funt,
imen type table of rsmpe_men,
imtx type table of rsmpe_mnlt,
iact type table of rsmpe_act,
ibut type table of rsmpe_but,
ipfk type table of rsmpe_pfk,
iset type table of rsmpe_staf,
idoc type table of rsmpe_atrt,
itit type table of rsmpe_titt,
ibiv type table of rsmpe_buts.
_objname = objname.
stat_node = pfstat_node.
check stat_node is not initial.
* read pfstatus_sta node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_sta' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node = node
changing
structure = xsta.
append xsta to ista.
node ?= iterator->get_next( ).
endwhile.
xtrkey-obj_type = 'PROG'.
xtrkey-obj_name = _program.
xtrkey-sub_type = 'CUAD'.
xtrkey-sub_name = _program.
if sy-subrc <> 0.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
endif.
endmethod.
method CREATE_SOURCE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
_objName = objName.
call function 'RS_INSERT_INTO_WORKING_AREA'
exporting
OBJECT = 'REPS'
OBJ_NAME = _objName
exceptions
WRONG_OBJECT_NAME = 1.
INSERT REPORT _objName FROM source STATE 'I'
program type attribs-subc. "added to handle includes, etc.
MOVE 'I' TO progline-STATE.
move-corresponding attribs to progline.
progline-idate = sy-datum.
progline-itime = sy-uzeit.
progline-CDAT = sy-datum.
progline-UDAT = sy-datum.
progline-SDATE = sy-datum.
modify progdir from progline.
* Are you kidding me?!? No idea why you need to do this!!
CONCATENATE 'REPORT' _objName '.' INTO reportLine SEPARATED BY SPACE.
append reportline to miniReport.
INSERT REPORT _objName FROM miniReport STATE 'A'
program type attribs-subc. "added to handle includes, etc.
MOVE 'A' TO progline-STATE.
modify progdir from progline.
endmethod.
method CREATE_TEXTPOOL.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data textPoolTable type standard table of textPool.
data textPoolRow type textPool.
data langIterator type ref to if_ixml_node_iterator.
data filter type ref to if_ixml_node_filter.
data textFilter type ref to if_ixml_node_filter.
data textIterator type ref to if_ixml_node_iterator.
data langNode type ref to if_ixml_element.
data aTextNode type ref to if_ixml_element.
data _objName type TROBJ_NAME.
data lang type spras.
data langNodeExists type flag.
data logonLanguageExists type flag.
data _state(1) type c.
_objName = objName.
CHECK textPoolNode IS NOT INITIAL.
refresh textPoolTable.
textIterator = langNode->create_iterator( ).
aTextNode ?= textIterator->get_next( ).
*For some reason the 1st one is blank... not sure why.
aTextNode ?= textIterator->get_next( ).
while aTextNode is not initial.
call method GETSTRUCTUREFROMATTRIBUTES
exporting
node = aTextNode
changing
structure = textPoolRow.
append textPoolRow to textPoolTable.
aTextNode ?= textIterator->get_next( ).
endwhile.
if textPoolTable is not initial.
lang = langNode->get_attribute( 'SPRAS' ).
if lang = sy-langu.
logonLanguageExists = 'X'.
_state = 'I'.
else.
* seems that if a textpool is inserted as inactive for language
* other than the logon language, it is lost upon activation
* not sure inserting as active is best solution,but seems to work
_state = 'A'.
endif.
insert textpool _objName
from textPooltable
language lang
state _state.
endif.
langNode ?= langIterator->get_next( ).
endwhile.
endmethod.
method DELETEOBJECT.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data program type sy-repid.
program = objName.
endmethod.
method DEQUEUE_ABAP.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
call function 'RS_ACCESS_PERMISSION'
exporting
global_lock = 'X'
mode = 'FREE'
object = objName
object_class = 'ABAP'
exceptions
canceled_in_corr = 1
enqueued_by_user = 3
enqueue_system_failure = 4
locked_by_author = 5
illegal_parameter_values = 6
no_modify_permission = 7
no_show_permission = 8
permission_failure = 9.
if sy-subrc <> 0.
case sy-subrc.
when 7 or 8 or 9.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_authorized.
when 5.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>error_message
msg = 'object locked'.
when others.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>system_error.
endcase.
endif.
endmethod.
method ENQUEUE_ABAP.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
call function 'RS_ACCESS_PERMISSION'
exporting
* authority_check = authority_check
global_lock = 'X'
mode = 'INSERT'
* master_language = trdir-rload
object = objName
object_class = 'ABAP'
* importing
* transport_key = trkey_global
* new_master_language = trdir-rload
* devclass = devclass_local
exceptions
canceled_in_corr = 1
enqueued_by_user = 3
enqueue_system_failure = 4
locked_by_author = 5
illegal_parameter_values = 6
no_modify_permission = 7
no_show_permission = 8
permission_failure = 9.
if sy-subrc <> 0.
case sy-subrc.
when 7 or 8 or 9.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_authorized.
when 5.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>error_message
msg = 'object locked'.
when others.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>system_error.
endcase.
endif.
endmethod.
method GETOBJECTTYPE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
objectType = 'PROG'. "ABAP Program
endmethod.
method GET_DOCUMENTATION.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data languageNode type ref to if_ixml_element.
DATA txtlines_node TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
DATA _objtype TYPE string.
_objname = objname.
endmethod.
method GET_DYNPRO.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
types: begin of tdynp,
prog type d020s-prog,
dnum type d020s-dnum,
end of tdynp.
_objname = objname.
check sy-subrc = 0.
endloop.
endmethod.
method GET_PFSTATUS.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data: ista type table of rsmpe_stat,
ifun type table of rsmpe_funt,
imen type table of rsmpe_men,
imtx type table of rsmpe_mnlt,
iact type table of rsmpe_act,
ibut type table of rsmpe_but,
ipfk type table of rsmpe_pfk,
iset type table of rsmpe_staf,
idoc type table of rsmpe_atrt,
itit type table of rsmpe_titt,
ibiv type table of rsmpe_buts.
_objname = objname.
_program = objname.
check sy-subrc = 0.
endif.
endif.
endmethod.
method GET_SOURCE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
_objName = me->objName.
read report _objName into progSource.
endmethod.
method GET_TEXTPOOL.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
data aText type ref to if_ixml_element.
data textPoolTable type standard table of TEXTPOOL.
data textPoolRow type textPool.
data languageList type instLang.
data aLanguage type SPRAS.
data _objName(30) type c.
data rc type i.
data sTemp type string.
data languageNode type ref to if_ixml_element.
data firstLoop type flag.
_objName = objName.
firstLoop = abap_true.
endmethod.
method TRANSPORT_COPY.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| Copyright 2014 SAPlink project members |
*| |
*| Licensed under the Apache License, Version 2.0 (the "License"); |
*| you may not use this file except in compliance with the License. |
*| You may obtain a copy of the License at |
*| |
*| http://www.apache.org/licenses/LICENSE-2.0 |
*| |
*| Unless required by applicable law or agreed to in writing, software |
*| distributed under the License is distributed on an "AS IS" BASIS, |
*| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
*| implied. |
*| See the License for the specific language governing permissions and |
*| limitations under the License. |
*\---------------------------------------------------------------------/
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
AUTHOR = author
GLOBAL_LOCK = 'X'
OBJECT = objName
OBJECT_CLASS = 'ABAP'
DEVCLASS = devClass
* KORRNUM = CORRNUMBER_LOCAL
MASTER_LANGUAGE = sy-langu
* PROGRAM = PROGRAM_LOCAL
MODE = 'INSERT'
* IMPORTING
* AUTHOR = UNAME
* KORRNUM = CORRNUMBER_LOCAL
* DEVCLASS = DEVCLASS_LOCAL
EXCEPTIONS
CANCELLED = 1
PERMISSION_FAILURE = 2
UNKNOWN_OBJECTCLASS = 3.
if sy-subrc <> 0.
case sy-subrc.
when 2.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_authorized.
when others.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>system_error.
endcase.
endif.
endmethod.
method UPDATE_WB_TREE.
pname-program = me->objname.
CALL FUNCTION 'WB_TREE_ACTUALIZE'
EXPORTING
tree_name = pname.
trdir-name = me->objname.
endmethod.
ENDCLASS.
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'.
*\--------------------------------------------------------------------/
*/--------------------------------------------------------------------\
*| Forms from the SAPLink Installer |
*| |
form uploadXMLFromLM using p_filename xmlString type string .
DATA retfiletable TYPE filetable.
DATA retrc TYPE sysubrc.
DATA retuseraction TYPE i.
DATA temptable TYPE table_of_strings.
DATA temptable_bin TYPE TABLE OF x255.
DATA filelength TYPE i.
DATA l_filename TYPE string.
l_filename = p_filename.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN' " File Type Binary
IMPORTING
filelength = filelength
CHANGING
data_tab = temptable_bin
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
PERFORM writemessage USING 'E' 'File Open Error'.
WHEN OTHERS.
PERFORM writemessage USING 'E' 'Unknown Error occured'.
ENDCASE.
ENDIF.
endform.
*/----------------------------------------------------------------------
*/--------------------------------------------------------------------\
*| Forms from the SAPLink Root Class |
form CONVERTSTRINGTOIXMLDOC
using
i_xmlString type string
changing
ixmlDocument type ref to if_ixml_document.
xmlString = i_xmlString.
" Make sure to convert Windows Line Break to Unix as
" this linebreak is used to get a correct import
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf
IN xmlString WITH cl_abap_char_utilities=>newline.
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( ).
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.
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 ).
objectExists = l_targetObject->checkexists( ).
else.
try.
l_installObject = l_targetObject->createObjectfromiXMLDoc(
ixmlDocument = ixmlDocument
overwrite = overWrt ).
*/----------------------confirmOverwrite------------------------------\
form confirmOverwrite using l_objInfo type string
changing l_answer type flag.
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.
WRITE p_msg.
ENDFORM. "WriteMessage