SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Basic Principles of the SAP Connector



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Connect to External system, Unix и Perl
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Oct 24, 2007 10:52 pm    Post subject: Basic Principles of the SAP Connector Reply with quote

Basic Principles of the SAP Connector

Core Engine of the SAP provider is the SAP RFC processor, which executes a XML coded function call on the back end via the SAP Java connector (JCO). The results of the RFC call is transformed to a XML coded payload.

Necessary information to connect to the back end (e.g. Server address, user data, etc) are defined in a Datasource, which can be configured via properties of the SAP connector. All these structures are embedded into Mule via the corresponding interfaces.

Implementation notes

The Java class BAPIConnector implements the core module of the SAP provider and extends AbstractServiceEnabledConnector.It encapsulates the SAP DataSource. The RFC call is implemented in the class BAPIMessageReceiver which inherits the Mule standard class PollingMessageReceiver.Its method poll() triggers periodically parses the XML script via SAX and fills up necessary JCO structures in the class RFCContentHandler. In its method endDocument() finally, the RFC is executed based on JCO.

The processing of the results - please note, that exception handling still is rudimentary - is done via RFCResultAsXMLImpl. Its structure is identical to the SE37 notation.

For the BAPI RFC_READ_TABLE additional classes were implemented to enable the access to SAP tables (nearly) without writing any Java code.

The class TableTransformer allows the transformation of the XML stream of RFC_READ_TABLE into either a simple value object via reflection or into a collection of HashMaps, where each HashMap represents a single line of the SAP table.

Currently no exception handling is implemented.

The SAP Connector

The following properties are defined on the com.comino.mule.providers.sapr3.BAPIConnector class.

PropertyDescriptionRequired
PollingPolling frequency in msYes
Property Map
NameLoginProvides connection data for the back end connection
PropertyDescriptionRequired
ClientSAP client numberYes
UserRFC UserYes
PasswordRFC User passwordYes
LanguageLog on Language of the established back end connectionYes
SystemSAP System numberYes
RouteSAP server and router stringYes


Here is an example configuration:
Code:
<connector>
    <properties>
       <property>
       <map>
          <property>
          <property>
          <property>
          <property>
          <property>
          <property>
       </map>
    </properties>
</connector>


The SAP Endpoint
The URI of the SAP Endpoint is defined like:
Code:
bapi://<rfc_function>/<rfc_config_file>?\[parameters\]


Endpoint Example
Code:
<inbound>
    <endpoint>
</inbound>


While <frc_function> describes the RFC enabled function module in SAP, the file <rfc_config> provides all necessary parameters of the functions module according to SE37.

The example account.xml describes all parameters for the function module:
Code:

<xml>
<rfc>
    <import>
        <field>1000</field>
        <field>${account}</field>
        <field>${CURRENTYEAR}</field>
        <field>00</field>
    </import>
</rfc>


XML Syntax (similar to SE37)
ElementDescriptionAttributes
rfcStarts decribing a certain RFC module@id: SAP Function module name (required)
importContainer for import elements-
exportContainer for export elements (used for return values only)-
tablesContainer for tables-
structureContainer for fields@name: Name of the structure (optional)
tableContainer for rows@name: Name of the table (required)
RowContainer for structures or fields@id: Row number of the table row (optional)
FieldData field@name: SAP name of the field (required)


Static parameters can be replaced by system variables, e.g. for common parameters like period/year, etc. Additionally parameters can be passed to the RFC via the endpoint definition.

VariableDescription
CURRENTYEARCurrent year, derived from system time
CURRENTMONTHCurrent month, derived from system time
CURRENTDAYCurrent day, derived from system time
TODAYCurrent date, format is YYYYMMDD


The SAP TableTransformer

com.comino.mule.transformers.sapr3.TableTransformer

Transformer Properties_

PropertyDescriptionRequired
Plain java value class. The setter/getter of this class must match the data-element name of the SAP table. Only matching columns are transformed.No


If no property is specified, the transformer returns a collection of HashMaps, where a HashMap represents a single entry of the SAP table. Column values can be accessed via the data-element name of the SAP table.

If a Java class is defined as value object, the transformer returns a collection of filled value objects.

Code:

package com.comino.tests;

public class Plant {

    private String Werks = null;

    private String Name1 = null;

    ...

    public String getName1() {

        return Name1;
    }

    // ... setter / getter
}


Mule configuration of the transformer
Code:
<transformers>
   <transformer>
      <properties>
          <property>
      </properties>
  </transformer>
</transformers>


Configuration of the RFC call
Code:

<rfc>
    <import>
        <field>T001W</field>
        <field>10</field>
            <tables>
                <table name="DATA">
                    <row>
                        <field>
                    </row>
            </table>
        </tables>
    </import>
</rfc>

The CollectionBridge Component
The purpose of the com.comino.mule.components.CollectionBridgeComponent component is to split a collection into single mule events for further processing.

Complete Example
Code:
<model>
    <mule>
        <inbound>
            <endpoint address="bapi://rfc_read_table?t001w.xml""transformers="T001W" connector="COMINO_SAP"/>
        </inbound>
        <outbound>
            <router>
                <endpoint>
                <properties>
                    <map>
                        <property>
                    </map>
                </properties>
            </endpoint>
        </router>
    </outbound>
</mule>
</model>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Connect to External system, Unix и Perl All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.