Professional Documents
Culture Documents
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 components of class ZSAPLINK
*"* do not include other source files here!!!
private section.
types:
BEGIN OF t_objecttable,
classname TYPE string,
object TYPE ko100-object,
text TYPE ko100-text,
END OF t_objecttable .
data STREAMFACTORY type ref to IF_IXML_STREAM_FACTORY .
data XMLDATA type STRING .
data:
objecttable TYPE TABLE OF t_objecttable .
ENDCLASS.
CLASS ZSAPLINK_OO DEFINITION
INHERITING FROM ZSAPLINK
CREATE PUBLIC
ABSTRACT
.
public section.
type-pools ABAP
type-pools SEOP
type-pools SEOR
type-pools SEOS
type-pools SEOT
type-pools SEOX
.
.
.
.
.
.
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 components of class ZSAPLINK_CLASS
*"* do not include other source files here!!!
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 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 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
*\---------------------------------------------------------------------/
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.
method BUILDTABLEFROMSTRING.
*/---------------------------------------------------------------------\
*| 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.
|
*\---------------------------------------------------------------------/
split source at CL_ABAP_CHAR_UTILITIES=>NEWLINE
into table sourceTable.
endmethod.
METHOD checkobject.
DATA l_objtable LIKE objecttable.
DATA l_objline LIKE LINE OF objecttable.
CLEAR: e_objtype, e_objname, e_pluginexists, e_objectexists.
TRY.
CALL METHOD zsaplink=>getobjectinfofromixmldoc
EXPORTING
ixmldocument = i_ixmldocument
IMPORTING
objtypename = e_objtype
objname
= e_objname.
CATCH zcx_saplink.
ENDTRY.
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 ).
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = _tempstringx
im_encoding = 'UTF-8'
IMPORTING
ex_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.
DATA sotrheader TYPE sotr_head.
DATA sotrtextline TYPE sotr_text.
DATA sotrtexttable TYPE TABLE OF sotr_text.
DATA _ixml TYPE REF TO if_ixml.
DATA _xmldoc TYPE REF TO if_ixml_document.
CALL FUNCTION 'SOTR_GET_CONCEPT'
EXPORTING
concept
= otrguid
IMPORTING
header
= sotrheader
TABLES
entries
= sotrtexttable
EXCEPTIONS
no_entry_found = 1
OTHERS
= 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
sotrheader-paket = '$TMP'. "change devclass to $TMP for exports
*
*
*
*
"ewH:33
* 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.
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( ).
CATCH cx_root.
CONTINUE.
ENDTRY.
CLEAR tabletypeline.
REFRESH tabletypesin.
tabletypeline-object = objtype.
APPEND tabletypeline TO tabletypesin.
CALL FUNCTION 'TRINT_OBJECT_TABLE'
TABLES
tt_types_in = tabletypesin
tt_types_out = tabletypesout.
LOOP AT tabletypesout INTO tabletypeoutline.
objectline-classname = clsname.
MOVE-CORRESPONDING tabletypeoutline TO objectline.
APPEND objectline TO objecttable.
ENDLOOP.
ENDLOOP.
endmethod.
method GETSTRUCTUREFROMATTRIBUTES.
*/---------------------------------------------------------------------\
*| 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 attributeList type ref to IF_IXML_NAMED_NODE_MAP.
data nodeIterator type ref to IF_IXML_NODE_ITERATOR.
data attributeNode type ref to if_ixml_node.
data value type string.
data name type string.
field-symbols <value> type any.
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.
rs_version_info-zsaplink_plugin_info1
the first time a child class is being updated
rs_version_info-zsaplink_plugin_info2
the first time a child class is being updated
rs_version_info-zsaplink_plugin_info3
the first time a child class is being updated
rs_version_info-zsaplink_plugin_info4
the first time a child class is being updated
rs_version_info-zsaplink_plugin_info5
the first time a child class is being updated
ENDMETHOD.
METHOD get_version_info_static.
DATA: lo_zsaplink TYPE REF TO zsaplink.
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.
*
*
*
*
clear sValue.
when 'AS4DATE'.
clear sValue.
when 'AS4TIME'.
clear sValue.
" Meta Attributes for PROG
when 'CNAM'.
clear sValue.
when 'CDAT'.
clear sValue.
when 'UNAM'.
clear sValue.
when 'UDAT'.
clear sValue.
when 'VERN'.
clear sValue.
when 'SDATE'.
clear sValue.
when 'STIME'.
clear sValue.
when 'IDATE'.
clear sValue.
when 'ITIME'.
clear sValue.
" Meta Attributes for CLAS
when 'AUTHOR'.
clear sValue.
when 'CREATEDON'.
clear sValue.
when 'CHANGEDBY'.
clear sValue.
when 'CHANGEDON'.
clear sValue.
when 'CHANGETIME'.
clear sValue.
when 'CHGDANYON'.
clear sValue.
when 'R3RELEASE'.
clear sValue.
when 'UUID'.
clear sValue.
" SOTR
when 'CREA_NAME'.
clear sValue.
when 'CHAN_NAME'.
clear sValue.
when 'CREA_TSTUT'.
clear sValue.
when 'CHAN_TSTUT'.
clear sValue.
" MSAG
when 'LASTUSER'.
clear sValue.
when 'LDATE'.
clear sValue.
when 'LTIME'.
clear sValue.
when 'DGEN'.
clear sValue.
when 'TGEN'.
clear sValue.
when 'GENDATE'.
clear sValue.
when 'GENTIME'.
clear sValue.
" BSP
when 'IMPLCLASS'.
clear sValue.
when others.
sValue = <fieldValue>.
endcase.
if sValue is not initial.
rc = Node->set_attribute( name = sName value = sValue ).
endif.
else.
* WHAT?>!??
endif.
endloop.
endmethod.
method UPLOADXML.
*/---------------------------------------------------------------------\
*| 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 iStream type ref to if_ixml_istream.
data ixmlParser type ref to if_ixml_parser.
iStream = streamFactory->CREATE_ISTREAM_STRING( xmlData ).
iXMLParser = iXML->create_parser( stream_factory = streamFactory
istream
= iStream
document
= XMLdoc ).
iXMLParser->parse( ).
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
|
*|
|
DATA
DATA
DATA
DATA
"ewH:33
* 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.
DATA objecttable TYPE sotr_objects.
DATA objecttype TYPE LINE OF sotr_objects.
* Retrieve object type of OTR
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
EXPORTING
object_vector
= sotrheader-objid_vec
IMPORTING
OBJECTS
= objecttable
EXCEPTIONS
object_not_found = 1
OTHERS
= 2.
READ TABLE objecttable INTO objecttype INDEX 1.
* 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.
DATA: ls_typepusage LIKE LINE OF xt_typepusages.
*rrq comments Forward nodes are created in an old version of the
*create XML from object. In that node, the only attribute set
*is the "TypeGroup". All other attributes are hard coded on the
*create Object from XML . To fix this and make it transparent to
*users, "forwaredDeclaration" nodes will be supported, and a new
*node will be added.
*if it is an old version XML document, forwardDeclarations nodes
*if it is a new version XML document, typeUsages nodes
filter = xmldoc->create_filter_name( c_xml_key_typepusage ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node
= node
CHANGING
structure = ls_typepusage.
APPEND ls_typepusage TO xt_typepusages.
node ?= iterator->get_next( ).
ENDWHILE.
* only check forwardDeclaration if typeUsages does not exist
* later version this will be removed
IF xt_typepusages IS INITIAL.
filter = xmldoc->create_filter_name( c_xml_key_forwarddeclaration ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CLEAR ls_typepusage.
source = node->get_value( ).
ls_typepusage-clsname = objname.
ls_typepusage-version = '0'.
ls_typepusage-tputype = '0'.
ls_typepusage-explicit = 'X'.
ls_typepusage-implicit = ''.
ls_typepusage-typegroup = source.
APPEND ls_typepusage TO xt_typepusages.
node ?= iterator->get_next( ).
ENDWHILE.
ENDIF.
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,
TYPE seot_clsdeferrds_r,
TYPE REF TO if_ixml_element,
TYPE seot_typepusage_r.
TYPE sy-subrc,
TYPE seoclskey.
ls_classkey-clsname = objname.
CALL FUNCTION 'SEO_CLSDEFERRD_READ_ALL'
EXPORTING
cifkey
= ls_classkey
version
= seoc_version_active
IMPORTING
CLASSDEFERREDS
= lt_clsdeferrds
EXCEPTIONS
clif_not_existing = 1
OTHERS
= 2.
LOOP AT lt_clsdeferrds INTO ls_clsdeferrd.
lo_clsdeferrds = xmldoc->create_element( c_xml_key_clsdeferrd ).
setattributesfromstructure( node
= lo_clsdeferrds
structure = ls_clsdeferrd ).
l_rc = xo_rootnode->append_child( lo_clsdeferrds ).
ENDLOOP.
endmethod.
method GET_INTDEFERRD.
DATA: lt_intdeferrds
TYPE seot_intdeferrds_r,
lo_intdeferrds
TYPE REF TO if_ixml_element,
ls_intdeferrd
DATA: l_rc
ls_classkey
TYPE seot_intdeferrd_r.
TYPE sy-subrc,
TYPE seoclskey.
ls_classkey-clsname = objname.
CALL FUNCTION 'SEO_INTDEFERRD_READ_ALL'
EXPORTING
cifkey
= ls_classkey
version
= seoc_version_active
IMPORTING
interfacedeferreds = lt_intdeferrds
EXCEPTIONS
clif_not_existing = 1
OTHERS
= 2.
LOOP AT lt_intdeferrds INTO ls_intdeferrd.
lo_intdeferrds = xmldoc->create_element( c_xml_key_intdeferrd ).
setattributesfromstructure( node
= lo_intdeferrds
structure = ls_intdeferrd ).
l_rc = xo_rootnode->append_child( lo_intdeferrds ).
ENDLOOP.
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.
DATA sotrheader TYPE sotr_head.
DATA sotrtextline TYPE sotr_text.
DATA sotrtexttable TYPE TABLE OF sotr_text.
DATA _ixml TYPE REF TO if_ixml.
DATA _xmldoc TYPE REF TO if_ixml_document.
CALL FUNCTION 'SOTR_GET_CONCEPT'
EXPORTING
concept
= otrguid
IMPORTING
header
= sotrheader
TABLES
entries
= sotrtexttable
EXCEPTIONS
no_entry_found = 1
OTHERS
= 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
sotrheader-paket = '$TMP'. "change devclass to $TMP for exports
*
*
*
*
TYPE seot_typepusages_r,
TYPE REF TO if_ixml_element,
TYPE seot_typepusage_r.
TYPE sy-subrc,
TYPE string,
TYPE seoclskey.
ls_classkey-clsname = objname.
CALL FUNCTION 'SEO_TYPEPUSAGE_READ_ALL'
EXPORTING
cifkey
= ls_classkey
version
= seoc_version_active
IMPORTING
typepusages
= lt_typepusages
EXCEPTIONS
clif_not_existing = 1
OTHERS
= 2.
LOOP AT lt_typepusages INTO ls_typepusage.
lo_typepusages = xmldoc->create_element( c_xml_key_typepusage ).
setattributesfromstructure( node
= lo_typepusages
structure = ls_typepusage ).
l_rc = xo_rootnode->append_child( lo_typepusages ).
ENDLOOP.
*
*
*
*
*
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.
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
wa_type ).
rc = rootnode->append_child( types_node ).
ENDLOOP.
*/***TPJ - End of Added Logic for TYPES -------------------*/
*/***TPJ - Added Logic
DATA: clif_keys
friends
wa_friend
friends_node
ENDLOOP.
ENDLOOP.
LOOP AT lt_implementings_copy INTO wa_implementings.
implementingnode = xmldoc->create_element( 'implementing' ).
setattributesfromstructure( node = implementingnode structure =
wa_implementings ).
rc = rootnode->append_child( implementingnode ).
ENDLOOP.
*/***uku - End of discard included interfaces -------------------*/
*/***ewH - End of Added Logic for Interfaces -------------------*/
*/***rrq - Added Logic for EVENTS -------------------*/
DATA: events
TYPE seoo_events_r,
wa_event
LIKE LINE OF events,
event_node TYPE REF TO if_ixml_element,
eventkey
TYPE seocmpkey,
eventparams TYPE seos_parameters_r,
wa_params TYPE seos_parameter_r.
CALL FUNCTION 'SEO_EVENT_READ_ALL'
EXPORTING
cifkey
= classkey
version
= 1
IMPORTING
events
= events
EXCEPTIONS
clif_not_existing = 1
OTHERS
= 2.
IF sy-subrc <> 0.
ENDIF.
LOOP AT events INTO wa_event.
eventkey-clsname = wa_event-clsname.
eventkey-cmpname = wa_event-cmpname.
event_node = xmldoc->create_element( 'events' ).
setattributesfromstructure( node = event_node structure =
wa_event ).
CALL FUNCTION 'SEO_EVENT_SIGNATURE_GET'
EXPORTING
evtkey
= eventkey
IMPORTING
parameters = eventparams.
*
parameters
LOOP AT eventparams INTO wa_params.
*|--------------------------------------------------------------------|
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( _class
name ).
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 ).
* classDescriptor ?= cl_abap_typedescr=>describe_by_name( className ).
attribkey-clsname = objname.
LOOP AT classdescr->attributes INTO attribdescr
WHERE is_inherited = abap_false
AND is_interface = abap_false. "rrq:issue 46
attribnode = xmldoc->create_element( 'attribute' ).
attribkey-cmpname = attribdescr-name.
CALL FUNCTION 'SEO_ATTRIBUTE_GET'
EXPORTING
attkey
= attribkey
IMPORTING
attribute = attribproperties.
*// 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 inheritance IS NOT INITIAL.
inheritancenode = xmldoc->create_element( c_xml_key_inheritance ).
setattributesfromstructure( node = inheritancenode structure =
inheritance ).
LOOP AT redefinitions INTO redefinition.
redefnode = xmldoc->create_element( 'redefinition' ).
setattributesfromstructure( node = redefnode structure =
redefinition ).
rc = inheritancenode->append_child( redefnode ).
ENDLOOP.
rc = rootnode->append_child( inheritancenode ).
ENDIF.
* methods with out alias We handle this later
LOOP AT classdescr->methods INTO methoddescr WHERE alias_for IS INITIAL AND
NOT ( is_inherited = 'X' AND is_redefined IS INITIAL ).
methodkey-clsname = _classname.
methodkey-cpdname = methoddescr-name.
*//nbus: added logic for exception class
IF
methoddescr-name
= 'CONSTRUCTOR'
AND classproperties-category = seoc_category_exception
and me->mv_steamroller
<> abap_true.
" Constructor() will be generated automatically into the
" target system once the class is saved
CONTINUE.
ENDIF.
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.
*data excClass type ref to ZCX_SAPLINK.
*// --> begin of new data
DATA:
*exporting dataTypes
e_corrnr
e_devclass
e_version
e_genflag
e_authority_check
e_overwrite
*e_suppress_meth_gen
*e_suppress_refac_gen
e_method_sources
e_locals_def
e_locals_imp
e_locals_mac
*e_suppress_ind_update
*importing dataTypes
type rrq
TYPE trkorr,
TYPE devclass,
TYPE seoversion,
TYPE genflag,
TYPE seox_boolean,
TYPE seox_boolean,
type SEOX_BOOLEAN,
type SEOX_BOOLEAN,
TYPE seo_method_source_table,
TYPE rswsourcet,
TYPE rswsourcet,
TYPE rswsourcet,
type SEOX_BOOLEAN,
i_korrnr
TYPE trkorr,
*changing dataTypes
ch_class
TYPE vseoclass,
ch_inheritance
TYPE vseoextend,
ch_redefinitions
TYPE seor_redefinitions_r,
ch_implementings
TYPE seor_implementings_r,
ch_impl_details
TYPE seo_redefinitions,
ch_attributes
TYPE seoo_attributes_r,
ch_methods
TYPE seoo_methods_r,
ch_events
TYPE seoo_events_r,
ch_types
TYPE seoo_types_r,
ch_type_source
TYPE seop_source,
ch_type_source_temp
TYPE seop_source,
ch_parameters
TYPE seos_parameters_r,
ch_exceps
TYPE seos_exceptions_r,
ch_aliases
TYPE seoo_aliases_r,
ch_typepusages
TYPE seot_typepusages_r,
ch_clsdeferrds
TYPE seot_clsdeferrds_r,
ch_intdeferrds
TYPE seot_intdeferrds_r,
ch_friendships
TYPE seo_friends,
**table dataTypes
*tb_classDescription
type table of seoclasstx,
*tb_component_descr
type table of seocompotx,
*tb_subcomponent_descr
type table of seosubcotx,
* work areas for the tables
wa_attributes
TYPE seoo_attribute_r,
wa_types
TYPE seoo_type_r,
wa_friends
TYPE seofriends,
wa_implementings
TYPE seor_implementing_r,
wa_redefinitions
TYPE seoredef,
wa_methods
TYPE seoo_method_r,
wa_parameters
TYPE seos_parameter_r,
wa_exceps
TYPE seos_exception_r,
wa_method_sources
TYPE seo_method_source,
wa_events
TYPE seoo_event_r.
DATA: lines TYPE i,
l_msg TYPE string.
*//<-- end of new data types rrq
CALL FUNCTION 'SEO_BUFFER_INIT'.
e_devclass = devclass.
_objtype = getobjecttype( ).
e_overwrite = overwrite.
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
CALL METHOD getstructurefromattributes
EXPORTING
node
= rootnode
CHANGING
structure = ch_class.
objname = classkey-clsname = ch_class-clsname.
ch_class-version = '0'.
superclass = rootnode->get_attribute( name = 'REFCLSNAME' ).
IF superclass IS NOT INITIAL.
* set something for inheritence
superclasskey-clsname = classkey-clsname.
superclasskey-refclsname = superclass.
superclasskey-version = '0'.
superclasskey-state = '1'.
MOVE-CORRESPONDING superclasskey TO ch_inheritance.
ch_inheritance-author = 'BCUSER'.
ch_inheritance-createdon = sy-datum.
ENDIF.
*Add attributes to new class
DATA otrconcept TYPE sotr_text-concept.
filter = xmldoc->create_filter_name( 'attribute' ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
*
*
*
wa_redefinitions-refclsname = wa_methods-clsname.
wa_redefinitions-version = '0'.
wa_redefinitions-mtdabstrct = ''.
wa_redefinitions-mtdname = wa_methods-cmpname.
APPEND wa_redefinitions TO ch_redefinitions.
node ?= iterator->get_next( ).
CONTINUE.
ENDIF.
*// <--ewH: break in backward compatibility hack - 2Bcontinued below
filter2 = node->create_filter_name( 'parameter' ).
iterator2 = node->create_iterator_filtered( filter2 ).
node2 ?= iterator2->get_next( ).
WHILE node2 IS NOT INITIAL.
CLEAR wa_parameters.
CALL METHOD getstructurefromattributes
EXPORTING
node
= node2
CHANGING
structure = wa_parameters.
"//-> Mar: Added logic for parameter/interface implementation - 08/20/20
08
IF NOT wa_parameters-clsname IS INITIAL.
APPEND wa_parameters TO ch_parameters.
ENDIF.
"//<- Mar: Added logic for parameter/interface implementation - 08/20/20
08
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.
** StartInsert Rich - Handle method documenation
create_method_documentation( node = node ).
** EndInsert Rich - Handle method documenation
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
create_typepusage( CHANGING xt_typepusages = ch_typepusages ).
create_clsdeferrd( CHANGING xt_clsdeferrds = ch_clsdeferrds ).
create_intdeferrd( CHANGING xt_intdeferrds = ch_intdeferrds ).
*Insert source code into the methods
filter = xmldoc->create_filter_name( 'method' ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node
= node
CHANGING
structure = wa_methods.
methodkey-clsname = objname.
methodkey-cpdname = wa_methods-cmpname.
aobjname = methodkey.
methodsourcenode = node->find_from_name( 'source' ).
IF methodsourcenode IS NOT INITIAL.
CLEAR wa_method_sources.
source = methodsourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
READ TABLE ch_redefinitions INTO wa_redefinitions
WITH KEY mtdname = methodkey-cpdname.
IF sy-subrc = 0.
wa_method_sources-redefine = 'X'.
ENDIF.
wa_method_sources-cpdname = methodkey-cpdname.
wa_method_sources-source = sourcetable.
APPEND wa_method_sources TO e_method_sources.
ENDIF.
node ?= iterator->get_next( ).
ENDWHILE.
*
**// ewH: create interface methods-->
filter = xmldoc->create_filter_name( 'interfaceMethod' ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node
= node
CHANGING
structure = methodkey.
aobjname = methodkey.
methodsourcenode = node->find_from_name( 'source' ).
IF methodsourcenode IS NOT INITIAL.
CLEAR wa_method_sources.
source = methodsourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
wa_method_sources-cpdname = methodkey-cpdname.
READ TABLE ch_redefinitions INTO wa_redefinitions
WITH KEY mtdname = methodkey-cpdname.
IF sy-subrc = 0.
wa_method_sources-redefine = 'X'.
ENDIF.
wa_method_sources-redefine = wa_methods-redefin.
wa_method_sources-source = sourcetable.
APPEND wa_method_sources TO e_method_sources.
ENDIF.
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( ).
*Add Alias to new class
create_alias_method( CHANGING xt_aliases_method = ch_aliases ).
name = objname.
*
*
*
* 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_typepusages
clsdeferrds
= ch_clsdeferrds
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.
* Now let's add the methods
LOOP AT e_method_sources INTO wa_method_sources.
mtdkey-clsname = objname.
mtdkey-cpdname = wa_method_sources-cpdname.
*
*
*
*
*
*
*
*
*
**
**
corrnr
= e_corrnr
without_method_frame
= seox_true
WITH_SUPER_CALL
= SEOX_FALSE
SUPPRESS_INDEX_UPDATE
= SEOX_FALSE
EXTEND
= SEOX_FALSE
ENHANCEMENT
= ' '
SUPPRESS_MODIFICATION_SUPPORT
= SEOX_FALSE
EXCEPTIONS
not_existing
= 1
model_only
= 2
include_existing
= 3
method_imp_not_generated
= 4
method_imp_not_initialised
= 5
_internal_class_not_existing
= 6
_internal_method_overflow
= 7
cancelled
= 8
method_is_abstract_implemented
= 9
method_is_final_implemented
= 10
internal_error_insert_report
= 11
OTHERS
= 12
.
CASE sy-subrc.
WHEN '0'.
i guess if we made it this far, we will assume success
successful install
WHEN '3'.
l_msg = mtdkey.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>existing
msg
= l_msg.
WHEN OTHERS.
l_msg = mtdkey.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>system_error
msg
= l_msg.
ENDCASE.
ENDLOOP.
*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
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 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.
DATA docnode
DATA lang_node
DATA lang_filter
DATA lang_iterator
DATA
DATA
DATA
DATA
DATA
DATA
obj_name = class_name.
* If no class name, then there was no class documenation, just return.
IF class_name IS INITIAL.
RETURN.
ENDIF.
* Get languages from XML
FREE: lang_filter, lang_iterator, lang_node.
lang_filter = docnode->create_filter_name( c_xml_key_language ).
lang_iterator = docnode->create_iterator_filtered( lang_filter ).
lang_node ?= lang_iterator->get_next( ).
WHILE lang_node IS NOT INITIAL.
REFRESH lt_lines.
language = lang_node->get_attribute( name = c_xml_key_spras ).
obj_langu = language.
* Get TextLines from XML
FREE: txtline_filter, txtline_iterator, txtline_node.
txtline_filter = lang_node->create_filter_name( c_xml_key_textline ).
txtline_iterator = lang_node->create_iterator_filtered( txtline_filter ).
txtline_node ?= txtline_iterator->get_next( ).
WHILE txtline_node IS NOT INITIAL.
APPEND INITIAL LINE TO lt_lines ASSIGNING <ls_lines>.
me->getstructurefromattributes(
EXPORTING node
= txtline_node
CHANGING
structure = <ls_lines> ).
txtline_node ?= txtline_iterator->get_next( ).
ENDWHILE.
* Delete any documentation that may currently exist.
CALL FUNCTION 'DOCU_DEL'
EXPORTING
id
= 'CL'
langu
= obj_langu
object = obj_name
typ
= 'E'
EXCEPTIONS
ret_code = 1
OTHERS = 2.
* Now update with new documentation text
CALL FUNCTION 'DOCU_UPD'
EXPORTING
id
= 'CL'
langu
= obj_langu
object = obj_name
typ
= 'E'
TABLES
line
= lt_lines
EXCEPTIONS
ret_code = 1
OTHERS = 2.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg
= `Class Documentation object import failed`.
ENDIF.
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.
data: methdocnode
DATA lang_node
DATA lang_filter
DATA lang_iterator
data
data
data
data
data
data
*
uage
if lang = sy-langu.
IF lang = lv_original_language.
" ins #255 - replaced former coding
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
*
Stefan Schmcker: Looks like this does not trigger on logon- " ins #255
*
but on class original language
" ins #255
_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 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.
|
*|
|
*| 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.
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.
|
*|
|
*| 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 = 'CLAS'. "Class
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.
TYPES: BEGIN OF t_dokhl,
id
TYPE dokhl-id,
object
TYPE dokhl-object,
langu
TYPE dokhl-langu,
typ
TYPE dokhl-typ,
dokversion TYPE dokhl-dokversion,
END OF t_dokhl.
DATA lt_dokhl TYPE TABLE OF t_dokhl.
DATA ls_dokhl LIKE LINE OF lt_dokhl.
DATA lt_lines TYPE TABLE OF tline.
DATA ls_lines LIKE LINE OF lt_lines.
DATA lv_str TYPE string.
DATA _objname TYPE e071-obj_name.
_objname = objname.
* Check against database
SELECT id object langu typ dokversion
INTO CORRESPONDING FIELDS OF TABLE lt_dokhl
FROM dokhl
WHERE id = 'CL'
AND object = _objname.
* Use only most recent version.
SORT lt_dokhl BY id object langu typ ASCENDING dokversion DESCENDING.
DELETE ADJACENT DUPLICATES FROM lt_dokhl COMPARING id object typ langu.
* Make sure there is at least one record here.
CLEAR ls_dokhl.
READ TABLE lt_dokhl INTO ls_dokhl INDEX 1.
IF sy-subrc <> 0.
RETURN.
ENDIF.
docnode = xmldoc->create_element( c_xml_key_class_documentation ).
* Set docNode object attribute
lv_str = ls_dokhl-object.
rc = docnode->set_attribute( name = c_xml_key_object value = lv_str ).
LOOP AT lt_dokhl INTO ls_dokhl.
* Create language node, and set attribute
languagenode = xmldoc->create_element( c_xml_key_language ).
lv_str = ls_dokhl-langu.
rc = languagenode->set_attribute( name = c_xml_key_spras value = lv_str ).
* Read the documentation text
CALL FUNCTION 'DOCU_READ'
EXPORTING
id
= ls_dokhl-id
langu = ls_dokhl-langu
object = ls_dokhl-object
typ
= ls_dokhl-typ
version = ls_dokhl-dokversion
TABLES
line
= lt_lines.
* Write records to XML node
LOOP AT lt_lines INTO ls_lines.
txtlines_node = xmldoc->create_element( c_xml_key_textline ).
dokhl-id,
dokhl-object,
dokhl-langu,
dokhl-typ,
dokhl-dokversion,
*| 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.
*if
*
*
*
*
*
*
*
*
*
objName = progAttribs-NAME.
*
** check existing
*
select single name from trdir into objName where NAME = objName.
*
if sy-subrc = 0.
*
raise exception type zcx_saplink
*
exporting textid = zcx_saplink=>existing.
*
endif.
*
*
sourceNode = rootNode->find_from_name( 'source' ).
*
source = sourceNode->get_value( ).
*
sourceTable = BUILDTABLEFROMSTRING( source ).
*
insert report progAttribs-NAME from sourceTable.
*
*
commit work.
*
*
call function 'RS_INSERT_INTO_WORKING_AREA'
*
EXPORTING
*
object
= 'REPS'
*
obj_name
= aobjName
*
EXCEPTIONS
*
wrong_object_name = 1.
*
if sy-subrc <> 0.
*
*
endif.
*
*else.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
call method getstructurefromattributes
exporting
node
= rootnode
changing
structure = progattribs.
objname = progattribs-name.
*
*
*
*
*
*
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 |
langu
object
typ
EXCEPTIONS
ret_code
OTHERS
= obj_langu
= obj_name
= 'E'
= 1
= 2.
data dynpro_node
data dynpro_filter
data dynpro_iterator
data dynfldl_node
data dynfldl_filter
data dynfldl_iterator
data dynmcod_node
data dynmcod_filter
data dynmcod_iterator
data dynflow_node
= xdyn_head_temp.
= xdyn_head_temp-dtext.
dynpro_node->create_iterator_filtered( dynfldl_filter ).
dynfldl_node ?= dynfldl_iterator->get_next( ).
while dynfldl_node is not initial.
call method getstructurefromattributes
exporting
node
= dynfldl_node
changing
structure = xdyn_fldl.
append xdyn_fldl to idyn_fldl.
dynfldl_node ?= dynfldl_iterator->get_next( ).
endwhile.
* Retrieve matchcode data.
free: dynmcod_filter, dynmcod_iterator, dynmcod_node.
dynmcod_filter = dynpro_node->create_filter_name( 'dynprofield' ).
dynmcod_iterator =
dynpro_node->create_iterator_filtered( dynmcod_filter ).
dynmcod_node ?= dynmcod_iterator->get_next( ).
while dynmcod_node is not initial.
call method getstructurefromattributes
exporting
node
= dynmcod_node
changing
structure = xdyn_mcod.
append xdyn_mcod to idyn_mcod.
dynmcod_node ?= dynmcod_iterator->get_next( ).
endwhile.
* retieve flow logic source.
clear xdynpro_flow_source. refresh idynpro_flow_source.
clear xdyn_flow.
refresh idyn_flow.
free dynflow_node.
dynflow_node = dynpro_node->find_from_name( 'dynproflowsource' ).
xdynpro_flow_source = dynflow_node->get_value( ).
idynpro_flow_source = buildtablefromstring( xdynpro_flow_source ).
loop at idynpro_flow_source into xdyn_flow.
append xdyn_flow to idyn_flow.
endloop.
* Build dynpro from data
call function 'RPY_DYNPRO_INSERT_NATIVE'
exporting
*
suppress_corr_checks
= ' '
*
CORRNUM
= ' '
header
= xdyn_head
dynprotext
= xdyn_text
*
SUPPRESS_EXIST_CHECKS
= ' '
*
USE_CORRNUM_IMMEDIATEDLY
= ' '
*
SUPPRESS_COMMIT_WORK
= ' '
tables
fieldlist
= idyn_fldl
flowlogic
= idyn_flow
params
= idyn_mcod
exceptions
cancelled
= 1
already_exists
= 2
program_not_exists
= 3
not_executed
= 4
others
= 5.
if sy-subrc <> 0.
type
type
type
type
type
type
type
type
type
type
type
rsmpe_stat,
rsmpe_funt,
rsmpe_men,
rsmpe_mnlt,
rsmpe_act,
rsmpe_but,
rsmpe_pfk,
rsmpe_staf,
rsmpe_atrt,
rsmpe_titt,
rsmpe_buts.
data iterator
_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.
* read pfstatus_fun node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_fun' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xfun.
append xfun to ifun.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_men node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_men' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xmen.
append xmen to imen.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_mtx node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_mtx' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xmtx.
append xmtx to imtx.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_act node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_act' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xact.
append xact to iact.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_but node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_but' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xbut.
append xbut to ibut.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_pfk node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_pfk' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xpfk.
append xpfk to ipfk.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_set node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_set' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xset.
append xset to iset.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_doc node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_doc' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xdoc.
append xdoc to idoc.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_tit node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_tit' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xtit.
append xtit to itit.
node ?= iterator->get_next( ).
endwhile.
* read pfstatus_biv node
free: filter, iterator, node.
filter = stat_node->create_filter_name( 'pfstatus_biv' ).
iterator = stat_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node
= node
changing
structure = xbiv.
append xbiv to ibiv.
node ?= iterator->get_next( ).
endwhile.
* Update the gui status
_program = _objname.
xtrkey-obj_type
xtrkey-obj_name
xtrkey-sub_type
xtrkey-sub_name
=
=
=
=
'PROG'.
_program.
'CUAD'.
_program.
call function
exporting
program
language
tr_key
adm
state
tables
sta
fun
men
mtx
act
but
pfk
set
doc
tit
biv
exceptions
not_found
others
'RS_CUA_INTERNAL_WRITE'
=
=
=
=
=
_program
sy-langu
xtrkey
xadm
'I'
=
=
=
=
=
=
=
=
=
=
=
ista
ifun
imen
imtx
iact
ibut
ipfk
iset
idoc
itit
ibiv
= 1
= 2.
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.
|
*\---------------------------------------------------------------------/
data
data
data
data
data
_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.
filter = textPoolNode->create_filter_name( 'language' ).
langIterator = textPoolNode->create_iterator_filtered( filter ).
langNode ?= langIterator->get_next( ).
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
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
mode
object
object_class
exceptions
canceled_in_corr
enqueued_by_user
enqueue_system_failure
locked_by_author
illegal_parameter_values
no_modify_permission
no_show_permission
permission_failure
=
=
=
=
'X'
'FREE'
objName
'ABAP'
=
=
=
=
=
=
=
=
1
3
4
5
6
7
8
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
|
*|
|
dokhl-id,
dokhl-object,
dokhl-langu,
dokhl-typ,
dokhl-dokversion,
_objname = objname.
* Get all dynpros for program object
clear xdynp. refresh idynp.
select prog dnum into table idynp
from d020s
where prog = _objname
and type <> 'S'
" No Selection Screens
and type <> 'J'. " No selection subscreens
check sy-subrc = 0 .
dynp_node = xmldoc->create_element( 'dynpros' ).
loop at idynp into xdynp.
* Retrieve dynpro imformation
dynnr_node = xmldoc->create_element( 'dynpro' ).
clear:
xdyn_head, xdyn_fldl, xdyn_flow, xdyn_mcod.
refresh: idyn_fldl, idyn_flow, idyn_mcod.
*
*
others
= 4.
check sy-subrc = 0.
* Add heading information for screen.
setattributesfromstructure(
node = dynnr_node structure = xdyn_head ).
* Add the dynpro text also.
xdyn_text_string = xdyn_text.
rc = dynnr_node->set_attribute(
name = 'DTEXT' value = xdyn_text_string ).
rc = dynp_node->append_child( dynnr_node ).
* Add fields information for screen.
if not idyn_fldl[] is initial.
loop at idyn_fldl into xdyn_fldl.
dynprofieldsnode = xmldoc->create_element( 'dynprofield' ).
setattributesfromstructure(
node = dynprofieldsnode structure = xdyn_fldl ).
rc = dynnr_node->append_child( dynprofieldsnode ).
endloop.
endif.
* Add flow logic of screen
if not idyn_flow[] is initial.
clear xflowsource. refresh iflowsource.
loop at idyn_flow into xdyn_flow.
xflowsource = xdyn_flow.
append xflowsource to iflowsource.
endloop.
dynproflownode = xmldoc->create_element( 'dynproflowsource' ).
flowsourcestring = buildsourcestring( sourcetable = iflowsource ).
rc = dynproflownode->if_ixml_node~set_value( flowsourcestring ).
rc = dynnr_node->append_child( dynproflownode ).
endif.
* Add matchcode information for screen.
if not idyn_mcod[] is initial.
loop at idyn_mcod into xdyn_mcod.
check not xdyn_mcod-type is initial
and not xdyn_mcod-content is initial.
dynpromatchnode = xmldoc->create_element( 'dynpromatchcode' ).
setattributesfromstructure(
node = dynpromatchnode structure = xdyn_mcod ).
rc = dynnr_node->append_child( dynpromatchnode ).
endloop.
endif.
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.
|
type
type
type
type
type
type
type
type
type
type
type
sta_node
fun_node
men_node
mtx_node
act_node
but_node
pfk_node
set_node
doc_node
tit_node
biv_node
rsmpe_stat,
rsmpe_funt,
rsmpe_men,
rsmpe_mnlt,
rsmpe_act,
rsmpe_but,
rsmpe_pfk,
rsmpe_staf,
rsmpe_atrt,
rsmpe_titt,
rsmpe_buts.
type
type
type
type
type
type
type
type
type
type
type
ref
ref
ref
ref
ref
ref
ref
ref
ref
ref
ref
to
to
to
to
to
to
to
to
to
to
to
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
if_ixml_element.
fun
men
mtx
act
but
pfk
set
doc
tit
biv
exceptions
not_found
unknown_version
others
=
=
=
=
=
=
=
=
=
=
ifun
imen
imtx
iact
ibut
ipfk
iset
idoc
itit
ibiv
= 1
= 2
= 3.
check sy-subrc = 0.
* if there is a gui status or gui title present, then
* create pfstatus node.
if ista[] is not initial
or itit[] is not initial.
pfstat_node = xmldoc->create_element( 'pfstatus' ).
endif.
* if ista is filled, assume there are one or more
* gui statuses
if ista[] is not initial.
loop at ista into xsta.
sta_node = xmldoc->create_element( 'pfstatus_sta' ).
setattributesfromstructure(
node = sta_node
structure = xsta ).
rc = pfstat_node->append_child( sta_node ).
endloop.
loop at ifun into xfun.
fun_node = xmldoc->create_element( 'pfstatus_fun' ).
setattributesfromstructure(
node = fun_node
structure = xfun ).
rc = pfstat_node->append_child( fun_node ).
endloop.
loop at imen into xmen.
men_node = xmldoc->create_element( 'pfstatus_men' ).
setattributesfromstructure(
node = men_node
structure = xmen ).
rc = pfstat_node->append_child( men_node ).
endloop.
loop at imtx into xmtx.
mtx_node = xmldoc->create_element( 'pfstatus_mtx' ).
setattributesfromstructure(
node = mtx_node
structure = xmtx ).
rc = pfstat_node->append_child( mtx_node ).
endloop.
structure = xtit ).
rc = pfstat_node->append_child( tit_node ).
endloop.
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.
|
*\---------------------------------------------------------------------/
data _objName(30) type c.
_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.
*
*
*
*
*
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.
DATA: BEGIN OF pname,
root(3) VALUE 'PG_',
program(27),
END OF pname.
DATA: trdir TYPE trdir.
pname-program = me->objname.
CALL FUNCTION 'WB_TREE_ACTUALIZE'
EXPORTING
tree_name = pname.
trdir-name
= me->objname.
CALL FUNCTION
EXPORTING
object
program
operation
type
'RS_TREE_OBJECT_PLACEMENT'
=
=
=
=
trdir-name
trdir-name
'INSERT'
'CP'.
endmethod.
ENDCLASS.
type-pools: seor, abap, icon.
data retFileTable type FILETABLE.
data retRc type sysubrc.
data retUserAction type i.
data tempXMLString type string.
data ixmlNugget type ref to if_ixml_document.
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 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.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = filelength
IMPORTING
text_buffer = xmlstring
TABLES
binary_tab = temptable_bin.
IF sy-subrc <> 0.
" Just catch the sy-subrc when there was nothing replaced
sy-subrc = 0.
ENDIF.
* 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
i_xmlString type string
changing
ixmlDocument type ref to if_ixml_document.
data
data
data
data
data
data
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( ).
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.
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.
*\--------------------------------------------------------------------/
*/---------------------writeMessage-----------------------\
FORM writemessage USING value(p_type) TYPE sy-msgty
value(p_msg).
CASE p_type.
WHEN 'E' OR 'A' OR 'X'.
WRITE / icon_led_red AS ICON.
WHEN 'W'.
WRITE / icon_led_yellow AS ICON.
WHEN OTHERS.
WRITE / icon_led_green AS ICON.
ENDCASE.
WRITE p_msg.
ENDFORM.
"WriteMessage