create new tag
, view all tags

Sap Connect Plugin

Get and include information from an SAP system


With this plugin, information can be drawn from an SAP system (usually a development system) and merged dynamically into existing TWiki topics. The main type of information retrieved this way is documentation of ABAP repository objects (DDIC and code).

Necessary for this plugin to work is the existence of a request handler ZCL_TWIKI_CONNECT on SAP site, which can be called anonymously. This topic contains an SAP transport order with the necessary objects for importing class ZCL_TWIKI_CONNECT and its dependencies.

Syntax rules

Object ID's

Documentation objects are adressed with a special ID parameter. It contains the two-letter shorthand for docu types and, separated with dots, the name of the concrete object:


The ID parameter is case insensitive.

The two-letter docu TYPE conforms to the docu types as defined in table TDCLT :

Type stands for
RE Report or Function Module
FU Function Module or Function Module Parameter
CL Class
CO Method
DE Data Element
TX General Docu Text (maintained with transaction SE61 )

NAME denotes the name of the program / function module / data element / ... For function groups, take the name of their main program: SAPLZUTIL for function group ZUTIL.

NAME2 is an optional subobject name, to be used for

  • method names with Type CO, or
  • parameter names, when adressing the documentation of a particular interface parameter of a function module.


  • FU.Z_TEST.IV_PARAM1 Interface parameter IV_PARAM1 of function module Z_TEST
  • RE.SAPLZUTIL Function group ZUTIL

Include SAP Documentation

For including SAP documentation into a TWiki topic, use the variable %INCLSAPDOCU{}% . For example, the documentation of function module Z_CONVERT_ITF can be embedded into the current context with the following instruction:


Include ABAP code

For including ABAP code into a TWiki topic, the varriable %INCLSAPCODE{}% may be used.

With the following statement, the code of function module Z_CONVERT_ITF will be embedded into the page:


HELP The instruction %INCLSAPCODE% makes no sense for ID's which are not associated with ABAP code (for example TX). Using %INCLSAPCODE% with such an ID will lead to an error message.

Generate a link on the SAP documentation

If you don't want to include the full documentation in the topic but would rather only offer a hyperlink to it, you can use the variable %URLSAPDOCU{}% .

Generate a link for ABAP code display

The same as with ABAP docu display, but use variable %URLSAPCODE{}% instead.

Optional Parameters

Surpress Header line

Adding noheader="true" in the argument of %INCLSAPDOCU% , the docu will be generated without the header line. Use this feature if you want to write your own header text for the documentation. When working with general texts (ID TX ), this feature may be used to include texts into different TWiki topics.


%INCLSAPDOCU{"cl.zcl_xml_helper" noheader="true"}

This will include the documetation of class ZCL_XML_HELPER . However, the header ---+Class ZCL_XML_HELPER which is usually generated automatically, wil be surpressed here.

Increasing Indentation Level

For increasing the indentation level, you may use the parameter level . The field level may assumw values from 1 to 4 , the default is 1. The value of level gives the number of + characters used for the header line ("Class ZCL_XML_HELPER"). The formats U1, U2, U3 successively get further + characters Example:

%INCLSAPDOCU{"cl.zcl_xml_helper" level="2"}

The documentation will begin with the header ---++ Klasse ZCL_XML_HELPER .

Destination System

With the parameter dest , you address the SAP system from which the instructions %INCLSAPDOCU% und %INCLSAPCODE% draw their informations. The possible destinations are listed in TWiki variable %SAPCONNECTPLUGIN_SYSTEMS% in TWikiPreferences, the first entry denoting the default system.

Example: %INCLSAPDOCU{"cl.zcl_xml_helper" dest="D11"}%

The documentation of class zcl_xml_helper will be requested from the D11 system.

Allowed Destinations And Path in the SAP System

All allowed destinations are listed in the TWiki variable %SAPCONNECTPLUGIN_SYSTEMS% in TWikiPreferences definiert. The first entry denotes the default system. Each entry consists of a pair ":" which is used for building the URL. The System ID's are the symbolic names of the SAP systems which may be used in the destination parameter of the INCLSAP* tags.

The ICF path containing the request handler on the SAP site is customized with variable %SAPCONNECTPLUGIN_PATH%


   * Set SAPCONNECTPLUGIN_SYSTEMS = D12:migzmc04.migros.ch:1091,D11:migzmb30.migros.ch:1090,D13:migzm390.migros.ch:8000
   * Set SAPCONNECTPLUGIN_PATH = /sap/bc/twiki 

Resolving Subobjects

Using the parameter expand="true", you instruct the tag to include not only the documentation of the specified object but also to include all existing documentations of its subobjects. For example, all parameters of a function module or all methods of a class will contribute to the documentation, too. The parameter expand has no effect for tags other than %INCLSAPDOCU% , and even there only the types FU and CL will lead to a subobject resolution.

Example: %INCLSAPDOCU{"cl.zcl_xml_helper" expand="true"}%

The documentation of class zcl_xml_helper will be supplemented by all existing documentations of all its methods.

Additional TWiki Content

Using the special variable INCLSAPADDI , you may retrieve arbitrary other information from the SAP system. The INCLSAPADDI splits its default argument at the first dot into two parts. The first path will be appended to the HTTP request path, while the second part will be passed as ID parameter with this request.

For your own additions, create an ABAP class implementing the interface ZIF_TWIKI_ADDITION . In our implementation on the ABAP site, the path extension of the request will be used to create an instance of the corresponding class dynamically, using ZCL_FACTORY, our version of an object factory.

API function

The plugin contains the sub get_data_from_sap which may be used as an API for calls from other plugins, or even from scripts.

It accepts a hash with named input parameters dest, type, id and args . The syntax can be read off from the following test calls (part of the test suite in SapConnectPlugin/t/SapConnectPlugin.t ):

# Test API function 
is(    get_data_from_sap( type => 'transports', dest => 'D12' ),
       'get_data_from_sap() URL with no id is built properly' );
is(    get_data_from_sap( type => 'transport', id => 'D12K123456' ),
       'get_data_from_sap() URL with id is built properly' );
is(    get_data_from_sap( type => 'transports', args => { list_scope => 'light' } ),
       'get_data_from_sap() URL with extra parameters is built properly' );


There is a set of automated tests under the Tests::More harness. It is contained in module SapConnectPlugin.t in subfolder t of the plugin.

In order to have these work as unit tests in the proper sense, the subs performing HTTP requests are replaced by echo functions at load:

  *TWiki::Plugins::SapConnectPlugin::get_request = sub { return shift };             
  *TWiki::Plugins::SapConnectPlugin::get_topic_url_for_link = sub { 
      return URI->new( 'http://sapdev.mits.ch/twiki/bin/view/TWiki/Sap' . ucfirst lc shift ); 

Object List for the Plugin on SAP side

The attached twiki_sap.zip contains the data of transport order D12K961445 . To import it into your SAP system, place the data file and the cofile of the order into the R/3 transport directory, append the order to your import queue, and import it.

This is the list of objects that are contained in order D12K961445 : There are no dependencies from SAP components outside of the basis ( components SAP_ABA and SAP_BASIS ).

Class ZCL_ITF_PARSER A SAPscript parser
Class ZCL_ITF_TO_TWIKI Builds TML markup code from SAPscript
Class ZCL_TWIKI_CONNECT The HTTP request handler for the SapConnectPlugin
Interface ZIF_TWIKI_ADDITION Interface for further addons using TWiki <-> SAP
Interface ZIF_WRITER Interface needed for implementing translators based on the SAPscript parser
Type Pool ZITF Contains constants for special SAPscript char sequences

Plugin Settings

  • Short description for Plugin lists
    • Set SHORTDESCRIPTION = Get and include information from an SAP system

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Info

Plugin Author: TWiki:Main.RuedigerPlantiko
Copyright: © 2013 Migros-Genossenschafts-Bund (MGB)
License: GPL (GNU General Public License)
Plugin Version: 2013-03-03
Change History:  
2013-03-03: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: On the SAP system, a handler for requests from TWiki is necessary.
Perl Version: 5.005
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/SapConnectPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/SapConnectPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/SapConnectPluginAppraisal

Related Topics: TWikiPlugins, AdminDocumentationCategory, AdminToolsCategory

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip SapConnectPlugin.zip r1 manage 5.1 K 2013-03-03 - 13:38 RuedigerPlantiko Code of the TWiki plugin, plus tests
Compressed Zip archivezip twiki_sap.zip r2 r1 manage 57.8 K 2013-03-17 - 11:53 RuedigerPlantiko SAP Transport Order with ABAP objects for handling the TWiki requests
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2013-08-13 - RuedigerPlantiko
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.