class ZSAPLINK_FUNCTIONGROUP definition
public
inheriting from ZSAPLINK
final
create public .
*"* public components of class ZSAPLINK_FUNCTIONGROUP
*"* do not include other source files here!!!
public section.
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .*"* protected components of class ZSAPLINK_FUNCTIONGROUP
*"* do not include other source files here!!!
protected section.
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .*"* private components of class ZSAPLINK_FUNCTIONGROUP
*"* do not include other source files here!!!
private section.
methods ACTUALIZE_OBJECT_TREE
importing
!REPID type SY-REPID .
methods CREATE_TEXTPOOL
importing
!TEXTPOOLNODE type ref to IF_IXML_ELEMENT .
methods CREATE_FUNCTION_MODULES
importing
!FM_NODE type ref to IF_IXML_ELEMENT
!FCT_GROUP type TLIBG-AREA .
methods DEQUEUE_ABAP
raising
ZCX_SAPLINK .
methods CREATE_INCLUDES
importing
!INCL_NODE type ref to IF_IXML_ELEMENT
!DEVCLASS type DEVCLASS default '$TMP' .
methods GET_TEXTPOOL
returning
value(TEXTNODE) type ref to IF_IXML_ELEMENT .
methods GET_INCLUDES
importing
!MAIN_PROG type SY-REPID
!FCT_GROUP type TLIBT-AREA
returning
value(INCL_NODE) type ref to IF_IXML_ELEMENT .
methods CREATE_SOURCE
importing
!SOURCE type TABLE_OF_STRINGS
!ATTRIBS type TRDIR .
methods ENQUEUE_ABAP
raising
ZCX_SAPLINK .
methods GET_FUNCTION_MODULES
importing
!FCT_GROUP type TLIBG-AREA
returning
value(FM_NODE) type ref to IF_IXML_ELEMENT .
methods TRANSPORT_COPY
importing
!AUTHOR type SYUNAME
!DEVCLASS type DEVCLASS
raising
ZCX_SAPLINK .
methods GET_DYNPRO
returning
value(DYNP_NODE) type ref to IF_IXML_ELEMENT .
methods CREATE_DYNPRO
importing
!DYNP_NODE type ref to IF_IXML_ELEMENT .
methods GET_PFSTATUS
returning
value(PFSTAT_NODE) type ref to IF_IXML_ELEMENT .
methods CREATE_PFSTATUS
importing
!PFSTAT_NODE type ref to IF_IXML_ELEMENT .*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature*"* use this source file for any macro definitions you need
*"* in the implementation part of the classmethod ACTUALIZE_OBJECT_TREE .
data: tree_string type string.
concatenate 'PG_' repid into tree_string.
call function 'WB_TREE_ACTUALIZE'
exporting
tree_name = tree_string.
endmethod.method CHECKEXISTS .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
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. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
* Plugin created by:
* Rich Heilman
* rich.heilman.jr@gmail.com
data rootnode type ref to if_ixml_element.
data mainprognode type ref to if_ixml_element.
data includesnode type ref to if_ixml_element.
data functgroupnode type ref to if_ixml_element.
data functionmodulesnode type ref to if_ixml_element.
data textpoolnode type ref to if_ixml_element.
data dynpronode type ref to if_ixml_element.
data statusnode type ref to if_ixml_element.
data sourcenode type ref to if_ixml_element.
data rc type sysubrc.
data progattribs type trdir.
data progsource type rswsourcet.
data _objname(30) type c.
data sourcestring type string.
data _objtype type string.
data functiongroupname type tlibg-area.
data mainfgprogname type sy-repid.
data xtlibt type tlibt.
_objtype = getobjecttype( ).
rootnode = xmldoc->create_element( _objtype ).
* Set up main program name
mainfgprogname = 'SAPL'.
mainfgprogname+4 = objname.
* Set function group name
functiongroupname = objname.
* Get main program attributes
select single * from trdir
into progattribs
where name = mainfgprogname.
if sy-subrc = 0.
* Get Function group attributes
clear xtlibt.
select single * from tlibt
into xtlibt
where spras = sy-langu
and area = functiongroupname.
setattributesfromstructure( node = rootnode
structure = xtlibt ).
_objname = objname.
objname = mainfgprogname. " Main program is object
* Write main program for function group.
mainprognode = xmldoc->create_element( 'mainprogram' ).
setattributesfromstructure( node = mainprognode
structure = progattribs ).
sourcenode = xmldoc->create_element( 'source' ).
read report mainfgprogname into progsource.
sourcestring = buildsourcestring( sourcetable = progsource ).
rc = sourcenode->if_ixml_node~set_value( sourcestring ).
textpoolnode = get_textpool( ).
rc = mainprognode->append_child( textpoolnode ).
dynpronode = get_dynpro( ).
rc = mainprognode->append_child( dynpronode ).
statusnode = get_pfstatus( ).
rc = mainprognode->append_child( statusnode ).
rc = mainprognode->append_child( sourcenode ).
rc = rootnode->append_child( mainprognode ).
* Get the includes
includesnode = get_includes( main_prog = mainfgprogname
fct_group = functiongroupname ).
rc = rootnode->append_child( includesnode ).
* Get function modules data.
functionmodulesnode = get_function_modules( functiongroupname ).
rc = rootnode->append_child( functionmodulesnode ).
rc = xmldoc->append_child( rootnode ).
ixmldocument = xmldoc.
objname = _objname.
else.
clear ixmldocument.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>not_found.
endif.
endmethod.method CREATEOBJECTFROMIXMLDOC .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
* Plugin created by:
* Rich Heilman
* rich.heilman.jr@gmail.com
data rootnode type ref to if_ixml_element.
data sourcenode type ref to if_ixml_element.
data textnode type ref to if_ixml_element.
data dynpnode type ref to if_ixml_element.
data statnode type ref to if_ixml_element.
data mainprog_node type ref to if_ixml_element.
data functionmodule_node type ref to if_ixml_element.
data functionmodules_node type ref to if_ixml_element.
data includes_node type ref to if_ixml_element.
data progattribs type trdir.
data source type string.
data sourcetable type table_of_strings.
data _objname(30) type c.
data _objtype type string.
data checkexists type flag.
data xtlibt type tlibt.
data xstext type tftit-stext.
data functiongroupname type tlibg-area.
data mainfgprogname type trdir-name.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
_objname = objname.
getstructurefromattributes(
exporting
node = rootnode
changing
structure = xtlibt ).
mainfgprogname = 'SAPL'.
mainfgprogname+4 = xtlibt-area.
functiongroupname = xtlibt-area.
objname = mainfgprogname. " Main program name is the object
checkexists = checkexists( ).
if checkexists is not initial.
if overwrite is initial.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>existing.
else.
* delete object for new install
objname = functiongroupname. " Function group name is the object
deleteobject( ).
endif.
endif.
objname = functiongroupname. " Function Group name is the object
* Insert the function group
xstext = xtlibt-areat.
call function 'RS_FUNCTION_POOL_INSERT'
exporting
function_pool = xtlibt-area
short_text = xstext
devclass = devclass
exceptions
name_already_exists = 1
name_not_correct = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
undefined_error = 11
others = 12.
* Create the function modules
functionmodules_node = rootnode->find_from_name( 'functionmodules' ).
create_function_modules( fm_node = functionmodules_node
fct_group = functiongroupname ).
* Create Includes
includes_node = rootnode->find_from_name( 'includeprograms' ).
create_includes( devclass = devclass
incl_node = includes_node ).
* Update main program..... with include statements, dynpros, gui status
mainprog_node = rootnode->find_from_name( 'mainprogram' ).
getstructurefromattributes(
exporting
node = mainprog_node
changing
structure = progattribs ).
objname = progattribs-name. " Main Program Name is now the object
* Update the main program
enqueue_abap( ).
transport_copy( author = progattribs-cnam
devclass = devclass ).
* Source
sourcenode = mainprog_node->find_from_name( 'source' ).
source = sourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
create_source( source = sourcetable
attribs = progattribs ).
* text pool
textnode = mainprog_node->find_from_name( 'textPool' ).
create_textpool( textnode ).
* Dynpros
dynpnode = mainprog_node->find_from_name( 'dynpros' ).
create_dynpro( dynpnode ).
* Gui status, titles
statnode = mainprog_node->find_from_name( 'pfstatus' ).
create_pfstatus( statnode ).
dequeue_abap( ).
* Rebuild tree structure for SE80
actualize_object_tree( mainfgprogname ).
* successful install
objname = functiongroupname.
name = objname.
endmethod.method CREATE_DYNPRO .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tdyn_head_temp.
include type d020s.
types: dtext type d020t-dtxt.
types: end of tdyn_head_temp.
data: idyn_fldl type table of d021s,
idyn_flow type table of d022s,
idyn_mcod type table of d023s.
data: xdyn_head type d020s,
xdyn_fldl type d021s,
xdyn_flow type d022s,
xdyn_mcod type d023s.
data: xdyn_text_string type string.
data: xdyn_text type d020t-dtxt .
data: xdyn_head_temp type tdyn_head_temp.
data _objname type trobj_name.
data dynpros_node type ref to if_ixml_element.
data dynpros_filter type ref to if_ixml_node_filter.
data dynpros_iterator type ref to if_ixml_node_iterator.
data dynpro_node type ref to if_ixml_element.
data dynpro_filter type ref to if_ixml_node_filter.
data dynpro_iterator type ref to if_ixml_node_iterator.
data dynfldl_node type ref to if_ixml_element.
data dynfldl_filter type ref to if_ixml_node_filter.
data dynfldl_iterator type ref to if_ixml_node_iterator.
data dynmcod_node type ref to if_ixml_element.
data dynmcod_filter type ref to if_ixml_node_filter.
data dynmcod_iterator type ref to if_ixml_node_iterator.
data dynflow_node type ref to if_ixml_element.
data xdynpro_flow_source type string.
data idynpro_flow_source type table_of_strings.
_objname = objname.
dynpros_node = dynp_node.
check dynpros_node is not initial.
free: dynpro_filter, dynpro_iterator, dynpro_node.
dynpro_filter = dynpros_node->create_filter_name( 'dynpro' ).
dynpro_iterator =
dynpros_node->create_iterator_filtered( dynpro_filter ).
dynpro_node ?= dynpro_iterator->get_next( ).
while dynpro_node is not initial.
clear: xdyn_head, xdyn_fldl, xdyn_flow, xdyn_mcod.
refresh: idyn_fldl, idyn_flow, idyn_mcod.
* Get the header data for the screen.
call method getstructurefromattributes
exporting
node = dynpro_node
changing
structure = xdyn_head_temp.
xdyn_head = xdyn_head_temp.
xdyn_text = xdyn_head_temp-dtext.
* Retrieve field list
free: dynfldl_filter, dynfldl_iterator, dynfldl_node.
dynfldl_filter = dynpro_node->create_filter_name( 'dynprofield' ).
dynfldl_iterator =
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.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
endif.
dynpro_node ?= dynpro_iterator->get_next( ).
endwhile.
endmethod.method CREATE_FUNCTION_MODULES .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tfunct_head,
name type rs38l-name,
global type rs38l-global,
remote type rs38l-remote,
utask type rs38l-utask,
stext type tftit-stext,
area type rs38l-area,
end of tfunct_head.
data functionmodules_node type ref to if_ixml_element.
data source type string.
data sourcetable type table_of_strings.
data functiongroupname type tlibg-area.
data mainfgprogname type trdir-name.
data xfunct_head type tfunct_head.
data iimport type table of rsimp.
data ichange type table of rscha.
data iexport type table of rsexp.
data itables type table of rstbl.
data iexcepl type table of rsexc.
data idocume type table of rsfdo.
data isource type table of rssource.
data isource_new type rsfb_source.
data ximport type rsimp.
data xchange type rscha.
data xexport type rsexp.
data xtables type rstbl.
data xexcepl type rsexc.
data xdocume type rsfdo.
data xsource type rssource.
data xsource_new like line of isource_new.
data node type ref to if_ixml_element.
data filter type ref to if_ixml_node_filter.
data iterator type ref to if_ixml_node_iterator.
data im_node type ref to if_ixml_element.
data im_filter type ref to if_ixml_node_filter.
data im_iterator type ref to if_ixml_node_iterator.
data ex_node type ref to if_ixml_element.
data ex_filter type ref to if_ixml_node_filter.
data ex_iterator type ref to if_ixml_node_iterator.
data ch_node type ref to if_ixml_element.
data ch_filter type ref to if_ixml_node_filter.
data ch_iterator type ref to if_ixml_node_iterator.
data ta_node type ref to if_ixml_element.
data ta_filter type ref to if_ixml_node_filter.
data ta_iterator type ref to if_ixml_node_iterator.
data el_node type ref to if_ixml_element.
data el_filter type ref to if_ixml_node_filter.
data el_iterator type ref to if_ixml_node_iterator.
data dm_node type ref to if_ixml_element.
data dm_filter type ref to if_ixml_node_filter.
data dm_iterator type ref to if_ixml_node_iterator.
data sc_node type ref to if_ixml_element.
data sc_filter type ref to if_ixml_node_filter.
data sc_iterator type ref to if_ixml_node_iterator.
data scn_node type ref to if_ixml_element.
data scn_filter type ref to if_ixml_node_filter.
data scn_iterator type ref to if_ixml_node_iterator.
functionmodules_node = fm_node.
functiongroupname = fct_group.
if functionmodules_node is not initial.
free: filter, iterator, node.
filter =
functionmodules_node->create_filter_name( 'functionmodule' ).
iterator = functionmodules_node->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
while node is not initial.
call method getstructurefromattributes
exporting
node = node
changing
structure = xfunct_head.
refresh: iimport, ichange, iexport,
itables, iexcepl, idocume, isource, isource_new.
* Get importing
free: im_filter, im_iterator, im_node.
im_filter = node->create_filter_name( 'importing' ).
im_iterator = node->create_iterator_filtered( im_filter ).
im_node ?= im_iterator->get_next( ).
while im_node is not initial.
call method getstructurefromattributes
exporting
node = im_node
changing
structure = ximport.
append ximport to iimport.
im_node ?= im_iterator->get_next( ).
endwhile.
* Get exporting
free: ex_filter, ex_iterator, ex_node.
ex_filter = node->create_filter_name( 'exporting' ).
ex_iterator = node->create_iterator_filtered( ex_filter ).
ex_node ?= ex_iterator->get_next( ).
while ex_node is not initial.
call method getstructurefromattributes
exporting
node = ex_node
changing
structure = xexport.
append xexport to iexport.
ex_node ?= ex_iterator->get_next( ).
endwhile.
* Get changing
free: ch_filter, ch_iterator, ch_node.
ch_filter = node->create_filter_name( 'changing' ).
ch_iterator = node->create_iterator_filtered( ch_filter ).
ch_node ?= ch_iterator->get_next( ).
while ch_node is not initial.
call method getstructurefromattributes
exporting
node = ch_node
changing
structure = xchange.
append xchange to ichange.
ch_node ?= ch_iterator->get_next( ).
endwhile.
* Get tables
free: ta_filter, ta_iterator, ta_node.
ta_filter = node->create_filter_name( 'tables' ).
ta_iterator = node->create_iterator_filtered( ta_filter ).
ta_node ?= ta_iterator->get_next( ).
while ta_node is not initial.
call method getstructurefromattributes
exporting
node = ta_node
changing
structure = xtables.
append xtables to itables.
ta_node ?= ta_iterator->get_next( ).
endwhile.
* Get exception list
free: el_filter, el_iterator, el_node.
el_filter = node->create_filter_name( 'exceptions' ).
el_iterator = node->create_iterator_filtered( el_filter ).
el_node ?= el_iterator->get_next( ).
while el_node is not initial.
call method getstructurefromattributes
exporting
node = el_node
changing
structure = xexcepl.
append xexcepl to iexcepl.
el_node ?= el_iterator->get_next( ).
endwhile.
* Get documentation
free: dm_filter, dm_iterator, dm_node.
dm_filter = node->create_filter_name( 'documentation' ).
dm_iterator = node->create_iterator_filtered( dm_filter ).
dm_node ?= dm_iterator->get_next( ).
while dm_node is not initial.
call method getstructurefromattributes
exporting
node = dm_node
changing
structure = xdocume.
append xdocume to idocume.
dm_node ?= dm_iterator->get_next( ).
endwhile.
* Get fm source
free: sc_filter, sc_iterator, sc_node.
sc_filter = node->create_filter_name( 'fm_source' ).
sc_iterator = node->create_iterator_filtered( sc_filter ).
sc_node ?= sc_iterator->get_next( ).
while sc_node is not initial.
source = sc_node->get_value( ).
sourcetable = buildtablefromstring( source ).
loop at sourcetable into xsource.
append xsource to isource.
endloop.
sc_node ?= sc_iterator->get_next( ).
endwhile.
* Get fm source new
free: scn_filter, scn_iterator, scn_node.
scn_filter = node->create_filter_name( 'fm_source_new' ).
scn_iterator = node->create_iterator_filtered( scn_filter ).
scn_node ?= scn_iterator->get_next( ).
while scn_node is not initial.
source = scn_node->get_value( ).
sourcetable = buildtablefromstring( source ).
loop at sourcetable into xsource_new.
append xsource_new to isource_new.
endloop.
scn_node ?= scn_iterator->get_next( ).
endwhile.
* INsert the function module
call function 'RS_FUNCTIONMODULE_INSERT'
exporting
funcname = xfunct_head-name
function_pool = functiongroupname
interface_global = xfunct_head-global
remote_call = xfunct_head-remote
short_text = xfunct_head-stext
save_active = ' ' "<-- Need to set inactive
new_source = isource_new
tables
import_parameter = iimport
export_parameter = iexport
tables_parameter = itables
changing_parameter = ichange
exception_list = iexcepl
parameter_docu = idocume
source = isource
exceptions
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
others = 11.
node ?= iterator->get_next( ).
endwhile.
endif.
endmethod.method CREATE_INCLUDES .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tinclude,
name(40),
end of tinclude.
data iinclude type table of tinclude.
data xinclude type tinclude.
data inc_node type ref to if_ixml_element.
data inc_filter type ref to if_ixml_node_filter.
data inc_iterator type ref to if_ixml_node_iterator.
data progattribs type trdir.
data includes_node type ref to if_ixml_element.
data includesourcenode type ref to if_ixml_element.
data source type string.
data sourcetable type table_of_strings.
includes_node = incl_node.
check includes_node is not initial.
free: inc_filter, inc_iterator, inc_node.
inc_filter = includes_node->create_filter_name( 'include' ).
inc_iterator = includes_node->create_iterator_filtered( inc_filter ).
inc_node ?= inc_iterator->get_next( ).
while inc_node is not initial.
getstructurefromattributes(
exporting
node = inc_node
changing
structure = progattribs ).
includesourcenode = inc_node->find_from_name( 'include_source' ).
source = includesourcenode->get_value( ).
sourcetable = buildtablefromstring( source ).
objname = progattribs-name. " Include Program Name is the object
enqueue_abap( ).
transport_copy( author = progattribs-cnam
devclass = devclass ).
create_source( source = sourcetable
attribs = progattribs ).
dequeue_abap( ).
inc_node ?= inc_iterator->get_next( ).
endwhile.
endmethod.method CREATE_PFSTATUS .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data: ista type table of rsmpe_stat,
ifun type table of rsmpe_funt,
imen type table of rsmpe_men,
imtx type table of rsmpe_mnlt,
iact type table of rsmpe_act,
ibut type table of rsmpe_but,
ipfk type table of rsmpe_pfk,
iset type table of rsmpe_staf,
idoc type table of rsmpe_atrt,
itit type table of rsmpe_titt,
ibiv type table of rsmpe_buts.
data: xsta type rsmpe_stat,
xfun type rsmpe_funt,
xmen type rsmpe_men,
xmtx type rsmpe_mnlt,
xact type rsmpe_act,
xbut type rsmpe_but,
xpfk type rsmpe_pfk,
xset type rsmpe_staf,
xdoc type rsmpe_atrt,
xtit type rsmpe_titt,
xbiv type rsmpe_buts.
data xtrkey type trkey.
data xadm type rsmpe_adm.
data _program type trdir-name.
data _objname type trobj_name.
data stat_node type ref to if_ixml_element.
data node type ref to if_ixml_element.
data filter type ref to if_ixml_node_filter.
data iterator type ref to if_ixml_node_iterator.
_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 = 'PROG'.
xtrkey-obj_name = _program.
xtrkey-sub_type = 'CUAD'.
xtrkey-sub_name = _program.
call function 'RS_CUA_INTERNAL_WRITE'
exporting
program = _program
language = sy-langu
tr_key = xtrkey
adm = xadm
state = 'I'
tables
sta = ista
fun = ifun
men = imen
mtx = imtx
act = iact
but = ibut
pfk = ipfk
set = iset
doc = idoc
tit = itit
biv = ibiv
exceptions
not_found = 1
others = 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. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data _objName type TROBJ_NAME.
data progLine type PROGDIR.
data titleInfo type trdirti.
data reportLine type string.
data miniReport type table_of_strings.
_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.
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. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data 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.
filter = textPoolNode->create_filter_name( 'language' ).
langIterator = textPoolNode->create_iterator_filtered( filter ).
langNode ?= langIterator->get_next( ).
while langNode is not initial.
langNodeExists = 'X'.
CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA'
EXPORTING
OBJECT = 'REPT'
OBJ_NAME = _objName
EXCEPTIONS
OTHERS = 0.
refresh textPoolTable.
textIterator = langNode->create_iterator( ).
aTextNode ?= textIterator->get_next( ).
*For some reason the 1st one is blank... not sure why.
aTextNode ?= textIterator->get_next( ).
while aTextNode is not initial.
call method GETSTRUCTUREFROMATTRIBUTES
exporting
node = aTextNode
changing
structure = textPoolRow.
append textPoolRow to textPoolTable.
aTextNode ?= textIterator->get_next( ).
endwhile.
if textPoolTable is not initial.
lang = langNode->get_attribute( 'SPRAS' ).
if lang = sy-langu.
logonLanguageExists = 'X'.
_state = 'I'.
else.
* seems that if a textpool is inserted as inactive for language
* other than the logon language, it is lost upon activation
* not sure inserting as active is best solution,but seems to work
_state = 'A'.
endif.
endif.
insert textpool _objName from textPooltable language lang
state _state.
langNode ?= langIterator->get_next( ).
endwhile.
endmethod.method DELETEOBJECT .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data area type RS38L-AREA.
area = objName.
call function 'RS_FUNCTION_POOL_DELETE'
EXPORTING
AREA = area
* CORRNUM = ' '
* TEXT = ' '
* UNAME = ' '
* WITH_KORR = 'X'
* WB_FB_MANAGER =
SUPPRESS_POPUPS = 'X'
* SKIP_PROGRESS_IND = ' '
* IMPORTING
* E_CORRNUM =
* EXCEPTIONS
* CANCELED_IN_CORR = 1
* ENQUEUE_SYSTEM_FAILURE = 2
* FUNCTION_EXIST = 3
* NOT_EXECUTED = 4
* NO_MODIFY_PERMISSION = 5
* NO_SHOW_PERMISSION = 6
* PERMISSION_FAILURE = 7
* POOL_NOT_EXIST = 8
* CANCELLED = 9
* OTHERS = 10
.
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 DEQUEUE_ABAP .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
call function 'RS_ACCESS_PERMISSION'
exporting
global_lock = 'X'
mode = 'FREE'
object = objName
object_class = 'ABAP'
exceptions
canceled_in_corr = 1
enqueued_by_user = 3
enqueue_system_failure = 4
locked_by_author = 5
illegal_parameter_values = 6
no_modify_permission = 7
no_show_permission = 8
permission_failure = 9.
if sy-subrc <> 0.
case sy-subrc.
when 7 or 8 or 9.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_authorized.
when 5.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>error_message
msg = 'object locked'.
when others.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>system_error.
endcase.
endif.
endmethod.method ENQUEUE_ABAP .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
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. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
objectType = 'FUGR'. " Function Group
endmethod.method GET_DYNPRO .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tdynp,
prog type d020s-prog,
dnum type d020s-dnum,
end of tdynp.
data: idyn_fldl type table of d021s,
idyn_flow type table of d022s,
idyn_mcod type table of d023s.
data: xdyn_head type d020s,
xdyn_fldl type d021s,
xdyn_flow type d022s,
xdyn_mcod type d023s.
data idynp type table of tdynp.
data xdynp type tdynp.
data xdyn_text type d020t-dtxt.
data xdyn_text_string type string.
data _objname type trobj_name.
data rc type sy-subrc .
data iflowsource type rswsourcet.
data xflowsource like line of iflowsource.
data flowsourcestring type string.
data dynnr_node type ref to if_ixml_element.
data dynpromatchnode type ref to if_ixml_element.
data dynprofieldsnode type ref to if_ixml_element.
data dynproflownode type ref to if_ixml_element.
_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.
call function 'RPY_DYNPRO_READ_NATIVE'
exporting
progname = xdynp-prog
dynnr = xdynp-dnum
* SUPPRESS_EXIST_CHECKS = ' '
* SUPPRESS_CORR_CHECKS = ' '
importing
HEADER = xdyn_head
dynprotext = xdyn_text
tables
fieldlist = idyn_fldl
flowlogic = idyn_flow
params = idyn_mcod
* FIELDTEXTS =
exceptions
cancelled = 1
not_found = 2
permission_error = 3
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_FUNCTION_MODULES .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tfunct_head,
name type rs38l-name,
global type rs38l-global,
remote type rs38l-remote,
utask type rs38l-utask,
stext type tftit-stext,
area type rs38l-area,
end of tfunct_head.
data xfunct_head type tfunct_head.
data iimport type table of rsimp.
data ichange type table of rscha.
data iexport type table of rsexp.
data itables type table of rstbl.
data iexcepl type table of rsexc.
data idocume type table of rsfdo.
data isource type table of rssource.
data isource_new type rsfb_source .
data ximport type rsimp.
data xchange type rscha.
data xexport type rsexp.
data xtables type rstbl.
data xexcepl type rsexc.
data xdocume type rsfdo.
data xsource type rssource.
data xsource_new like line of isource_new.
data functionmodulesnode type ref to if_ixml_element.
data functionmodulenode type ref to if_ixml_element.
data importsnode type ref to if_ixml_element.
data changesnode type ref to if_ixml_element.
data exportsnode type ref to if_ixml_element.
data tablesnode type ref to if_ixml_element.
data exceplnode type ref to if_ixml_element.
data documsnode type ref to if_ixml_element.
data fmsrcenode type ref to if_ixml_element.
data fmsrcenewnode type ref to if_ixml_element.
data functiongroupname type tlibg-area.
data ifunct type table of rs38l_incl.
data xfunct type rs38l_incl.
data rc type sysubrc.
data progattribs type trdir.
data progsource type rswsourcet.
data _objname(30) type c.
data sourcestring type string.
data lines type i.
functiongroupname = fct_group.
* Now get the function pool contents
call function 'RS_FUNCTION_POOL_CONTENTS'
exporting
function_pool = functiongroupname
tables
functab = ifunct
exceptions
function_pool_not_found = 1
others = 2.
* Now write out function modules data.
functionmodulesnode = xmldoc->create_element( 'functionmodules' ).
loop at ifunct into xfunct.
functionmodulenode = xmldoc->create_element( 'functionmodule' ).
xfunct_head-name = xfunct-funcname.
refresh: iimport, ichange, iexport,
itables, iexcepl, idocume, isource, isource_new.
* Read the function module data
call function 'RPY_FUNCTIONMODULE_READ_NEW'
exporting
functionname = xfunct_head-name
importing
global_flag = xfunct_head-global
remote_call = xfunct_head-remote
update_task = xfunct_head-utask
short_text = xfunct_head-stext
tables
import_parameter = iimport
changing_parameter = ichange
export_parameter = iexport
tables_parameter = itables
exception_list = iexcepl
documentation = idocume
source = isource
changing
new_source = isource_new
exceptions
error_message = 1
function_not_found = 2
invalid_name = 3
others = 4.
* Set the header attributes
setattributesfromstructure(
node = functionmodulenode
structure = xfunct_head ).
* Imports
if not iimport[] is initial.
loop at iimport into ximport.
importsnode = xmldoc->create_element( 'importing' ).
setattributesfromstructure(
node = importsnode structure = ximport ).
rc = functionmodulenode->append_child( importsnode ).
endloop.
endif.
* Exports
if not iexport[] is initial.
loop at iexport into xexport.
exportsnode = xmldoc->create_element( 'exporting' ).
setattributesfromstructure(
node = exportsnode structure = xexport ).
rc = functionmodulenode->append_child( exportsnode ).
endloop.
endif.
* Changing
if not ichange[] is initial.
loop at ichange into xchange.
changesnode = xmldoc->create_element( 'changing' ).
setattributesfromstructure(
node = changesnode structure = xchange ).
rc = functionmodulenode->append_child( changesnode ).
endloop.
endif.
* Tables
if not itables[] is initial.
loop at itables into xtables.
tablesnode = xmldoc->create_element( 'tables' ).
setattributesfromstructure(
node = tablesnode structure = xtables ).
rc = functionmodulenode->append_child( tablesnode ).
endloop.
endif.
* Exception list
if not iexcepl[] is initial.
loop at iexcepl into xexcepl.
exceplnode = xmldoc->create_element( 'exceptions' ).
setattributesfromstructure(
node = exceplnode structure = xexcepl ).
rc = functionmodulenode->append_child( exceplnode ).
endloop.
endif.
* Documentation
if not idocume[] is initial.
loop at idocume into xdocume .
documsnode = xmldoc->create_element( 'documentation' ).
setattributesfromstructure(
node = documsnode structure = xdocume ).
rc = functionmodulenode->append_child( documsnode ).
endloop.
endif.
* Source code for function module
*Bug 28 fix
if not isource[] is initial.
* Get rid of the FUNCTION and ENDFUNCTION statements.
* And the signature comments
* All of this will be inserted automatically, when imported.
loop at isource into xsource.
check xsource is not initial.
if xsource+0(2) = '*"'.
delete isource index sy-tabix.
continue.
endif.
translate xsource to upper case.
shift xsource left deleting leading space.
search xsource for 'FUNCTION'.
check sy-subrc = 0.
if xsource+0(8) = 'FUNCTION'.
delete isource index sy-tabix.
continue.
endif.
if xsource+0(11) = 'ENDFUNCTION'.
delete isource index sy-tabix.
continue.
endif.
endloop.
* loop at isource into xsource.
* if xsource+0(2) = '*"'.
* delete isource index sy-tabix.
* continue.
* endif.
* search xsource for 'FUNCTION'.
* "Got it and not a comment?
* if sy-subrc = 0 and xsource+0(1) <> '*'.
* delete isource index sy-tabix.
* function_deleted = 'X'.
* continue.
* endif.
* search xsource for 'ENDFUNCTION'.
* if sy-subrc = 0.
* delete isource index sy-tabix.
* endfunction_deleted = 'X'.
* continue.
* endif.
* endloop.
fmsrcenode = xmldoc->create_element( 'fm_source' ).
refresh progsource.
loop at isource into xsource.
append xsource to progsource.
endloop.
sourcestring = buildsourcestring( sourcetable = progsource ).
rc = fmsrcenode->if_ixml_node~set_value( sourcestring ).
rc = functionmodulenode->append_child( fmsrcenode ).
endif.
* Source code for function module
if not isource_new[] is initial.
* Get rid of the FUNCTION and ENDFUNCTION statements.
* And the signature comments
* All of this will be inserted automatically, when imported.
loop at isource_new into xsource_new.
check xsource_new is not initial.
if xsource_new+0(2) = '*"'.
delete isource_new index sy-tabix.
continue.
endif.
translate xsource_new to upper case.
shift xsource_new left deleting leading space.
search xsource_new for 'FUNCTION'.
check sy-subrc = 0.
if xsource_new+0(8) = 'FUNCTION'.
delete isource_new index sy-tabix.
continue.
endif.
if xsource_new+0(11) = 'ENDFUNCTION'.
delete isource_new index sy-tabix.
continue.
endif.
endloop.
* loop at isource_new into xsource_new.
* check xsource_new is not initial.
* if xsource_new+0(2) = '*"'.
* delete isource_new index sy-tabix.
* continue.
* endif.
* search xsource_new for 'FUNCTION'.
* "Got it and not a comment?
* if sy-subrc = 0 and xsource_new+0(1) <> '*'.
* delete isource_new index sy-tabix.
* function_deleted = 'X'.
* continue.
* endif.
* search xsource_new for 'ENDFUNCTION'.
* if sy-subrc = 0.
* delete isource_new index sy-tabix.
* endfunction_deleted = 'X'.
* continue.
* endif.
* endloop.
fmsrcenewnode = xmldoc->create_element( 'fm_source_new' ).
refresh progsource.
loop at isource_new into xsource_new.
append xsource_new to progsource.
endloop.
sourcestring = buildsourcestring( sourcetable = progsource ).
rc = fmsrcenewnode->if_ixml_node~set_value( sourcestring ).
rc = functionmodulenode->append_child( fmsrcenewnode ).
endif.
*<-- end bug fix 28
rc = functionmodulesnode->append_child( functionmodulenode ).
endloop.
fm_node = functionmodulesnode.
endmethod.method GET_INCLUDES .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
types: begin of tinclude,
name(40),
end of tinclude.
data iinclude type table of tinclude.
data xinclude type tinclude.
data ifunct type table of rs38l_incl.
data xfunct type rs38l_incl.
data functiongroupname type tlibg-area.
data mainfgprogname type sy-repid.
data includenode type ref to if_ixml_element.
data includesnode type ref to if_ixml_element.
data includesourcenode type ref to if_ixml_element.
data progattribs type trdir.
data rc type sysubrc.
data progsource type rswsourcet.
data _objname(30) type c.
data sourcestring type string.
functiongroupname = fct_group.
mainfgprogname = main_prog.
call function 'RS_FUNCTION_POOL_CONTENTS'
exporting
function_pool = functiongroupname
tables
functab = ifunct
exceptions
function_pool_not_found = 1
others = 2.
* Get all includes
call function 'RS_GET_ALL_INCLUDES'
exporting
program = mainfgprogname
tables
includetab = iinclude
exceptions
not_existent = 1
no_program = 2
others = 3.
* Get rid of any includes that are for the function modules
loop at iinclude into xinclude.
read table ifunct
into xfunct
with key include = xinclude-name.
if sy-subrc = 0.
delete iinclude where name = xinclude-name.
endif.
endloop.
* Write out include programs.....
includesnode = xmldoc->create_element( 'includeprograms' ).
loop at iinclude into xinclude.
includenode = xmldoc->create_element( 'include' ).
select single * from trdir
into progattribs
where name = xinclude-name.
setattributesfromstructure(
node = includenode
structure = progattribs ).
includesourcenode = xmldoc->create_element( 'include_source' ).
read report xinclude-name into progsource.
sourcestring = buildsourcestring( sourcetable = progsource ).
rc = includesourcenode->if_ixml_node~set_value( sourcestring ).
rc = includenode->append_child( includesourcenode ).
rc = includesnode->append_child( includenode ).
endloop.
incl_node = includesnode.
endmethod.method GET_PFSTATUS .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data: ista type table of rsmpe_stat,
ifun type table of rsmpe_funt,
imen type table of rsmpe_men,
imtx type table of rsmpe_mnlt,
iact type table of rsmpe_act,
ibut type table of rsmpe_but,
ipfk type table of rsmpe_pfk,
iset type table of rsmpe_staf,
idoc type table of rsmpe_atrt,
itit type table of rsmpe_titt,
ibiv type table of rsmpe_buts.
data: xsta type rsmpe_stat,
xfun type rsmpe_funt,
xmen type rsmpe_men,
xmtx type rsmpe_mnlt,
xact type rsmpe_act,
xbut type rsmpe_but,
xpfk type rsmpe_pfk,
xset type rsmpe_staf,
xdoc type rsmpe_atrt,
xtit type rsmpe_titt,
xbiv type rsmpe_buts.
data sta_node type ref to if_ixml_element.
data fun_node type ref to if_ixml_element.
data men_node type ref to if_ixml_element.
data mtx_node type ref to if_ixml_element.
data act_node type ref to if_ixml_element.
data but_node type ref to if_ixml_element.
data pfk_node type ref to if_ixml_element.
data set_node type ref to if_ixml_element.
data doc_node type ref to if_ixml_element.
data tit_node type ref to if_ixml_element.
data biv_node type ref to if_ixml_element.
data _objname type trobj_name.
data _program type trdir-name.
data rc type sy-subrc.
_objname = objname.
_program = objname.
call function 'RS_CUA_INTERNAL_FETCH'
exporting
program = _program
language = sy-langu
tables
sta = ista
fun = ifun
men = imen
mtx = imtx
act = iact
but = ibut
pfk = ipfk
set = iset
doc = idoc
tit = itit
biv = ibiv
exceptions
not_found = 1
unknown_version = 2
others = 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.
loop at iact into xact.
act_node = xmldoc->create_element( 'pfstatus_act' ).
setattributesfromstructure(
node = act_node
structure = xact ).
rc = pfstat_node->append_child( act_node ).
endloop.
loop at ibut into xbut.
but_node = xmldoc->create_element( 'pfstatus_but' ).
setattributesfromstructure(
node = but_node
structure = xbut ).
rc = pfstat_node->append_child( but_node ).
endloop.
loop at ipfk into xpfk.
pfk_node = xmldoc->create_element( 'pfstatus_pfk' ).
setattributesfromstructure(
node = pfk_node
structure = xpfk ).
rc = pfstat_node->append_child( pfk_node ).
endloop.
loop at iset into xset.
set_node = xmldoc->create_element( 'pfstatus_set' ).
setattributesfromstructure(
node = set_node
structure = xset ).
rc = pfstat_node->append_child( set_node ).
endloop.
loop at idoc into xdoc.
doc_node = xmldoc->create_element( 'pfstatus_doc' ).
setattributesfromstructure(
node = doc_node
structure = xdoc ).
rc = pfstat_node->append_child( doc_node ).
endloop.
loop at ibiv into xbiv.
biv_node = xmldoc->create_element( 'pfstatus_biv' ).
setattributesfromstructure(
node = biv_node
structure = xbiv ).
rc = pfstat_node->append_child( biv_node ).
endloop.
endif.
* It itit is filled, assume one or more titles
if itit[] is not initial.
loop at itit into xtit.
tit_node = xmldoc->create_element( 'pfstatus_tit' ).
setattributesfromstructure(
node = tit_node
structure = xtit ).
rc = pfstat_node->append_child( tit_node ).
endloop.
endif.
endmethod.method GET_TEXTPOOL .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
data aText type ref to if_ixml_element.
data textPoolTable type standard table of TEXTPOOL.
data textPoolRow type textPool.
data languageList type instLang.
data aLanguage type SPRAS.
data _objName(30) type c.
data rc type i.
data sTemp type string.
data languageNode type ref to if_ixml_element.
_objName = objName.
textNode = xmlDoc->create_element( 'textPool' ).
CALL FUNCTION 'RS_TEXTLOG_GET_PARAMETERS'
changing
INSTALLED_LANGUAGES = languageList.
loop at languageList into aLanguage.
read textpool _objName into textPoolTable language aLanguage.
if sy-subrc = 0.
languageNode = xmlDoc->create_Element( 'language' ).
sTemp = aLanguage.
rc = languageNode->set_attribute( name = 'SPRAS' value = sTemp ).
loop at textPoolTable into textPoolRow.
aText = xmlDoc->create_element( 'textElement' ).
setAttributesFromStructure( node = aText structure =
textPoolRow ).
rc = languageNode->append_child( aText ).
endloop.
rc = textNode->append_child( languageNode ).
endif.
endloop.
endmethod.method TRANSPORT_COPY .
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
AUTHOR = author
GLOBAL_LOCK = 'X'
OBJECT = objName
OBJECT_CLASS = 'ABAP'
DEVCLASS = devClass
* KORRNUM = CORRNUMBER_LOCAL
MASTER_LANGUAGE = sy-langu
* PROGRAM = PROGRAM_LOCAL
MODE = 'INSERT'
* IMPORTING
* AUTHOR = UNAME
* KORRNUM = CORRNUMBER_LOCAL
* DEVCLASS = DEVCLASS_LOCAL
EXCEPTIONS
CANCELLED = 1
PERMISSION_FAILURE = 2
UNKNOWN_OBJECTCLASS = 3.
if sy-subrc <> 0.
case sy-subrc.
when 2.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>not_authorized.
when others.
raise exception type zcx_saplink
exporting
textid = zcx_saplink=>system_error.
endcase.
endif.
endmethod.