Outbound Processing Tutorial

In this tutorial, executes DataSpider script using the execution of BAPI in SAP system as a trigger. RFC, IDoc can be executed in the same flow.
As the actual process, executes BAPI "STFC_CONNECTION", writes the data passed from SAP system to XML file, then return the executed time from DataSpider to SAP system.

Configuration in Tutorial

In this tutorial, the following configuration is assumed. Please change it according to the actual environment.

Item name Value
R/3 server DEVECC2
System Number 00
Client Number 300
Logical System M60CLNT300

Preparation in Advance

  1. Prepare RFC User
    Registers RFC user for DataSpider Servista to the client to connect. If already registered, it is not necessary to register again.
    In general, creates user with type of "Communications data" or "System".

    Prepare RFC User

SAP Business Connector Settings

To execute outbound processing, SAP Business Connector(hereafter, SAP BC) needs listener setting.
For more information about SAP BC settings, please refer to the manual of SAP BC.
  1. Check SAP BC startup
    Access to SAP BC by Web browser with the URL below.
    "http://<hostname>:<port>/"

    Item name Description
    hostname The host name or IP Address of the OS on which SAP BC operates
    port The port number that SAP BC is started.

    By default, the following is set.

    Item name Value
    Port number 5555
    User name Administrator
    Password manage

  2. Create SAP BC user
    Create user for DataSpider Servista in SAP BC. If already created, it is not necessary to create again.

    Press "Security"-"Users and Groups" of SAP BC to open ""Users and Groups" screen.

    User/Group Menu

    Press "Add and Remove Users" to open Create New User screen.

    Create User

    Enter the user name and password, press "Create Users" button.

    Crate User Succeeded

  3. Connection settings to SAP system
    Set connection to SAP system in SAP BC. If already set, it is not necessary to set again.

    Press "Adapters" - "SAP" to open SAP server setting screen.

    SAP Menu

    SAP server

    Press "Add SAP Server" and enter the information of the SAP system to connect. The settings are as follows.

    Item name Description
    Name Name on display
    User User name to log in to SAP system
    For tutorial, enter "RFC".
    Password Password of the user to log in to SAP system
    Client Client Number
    For tutorial, enter "300".
    Application Server The host name or IP Address of the OS on which SAP operates.
    For tutorial, enter "DEVECC2".
    System Number System Number
    For tutorial, enter "00".

    Add SAP Server

    Enter the required information and press "Save" button.

    Press the names of the added SAP system to open SAP system setting screen.

    SAP server list

    Press "Test Connection" button of the SAP system setting screen to test connection.

    Connection test

  4. Register Listener
    Register lister from SAP BC to SAP system.

    Press "Listeners" column of the added SAP system to open listener list.

    Select Listener

    Listener List

    Press "Add Listener" button to open the Create Listener screen. Enter the following value on the Create Listener screen.

    Item name Value
    Program ID STFC_CON
    Gateway Host The host name or IP Address of the OS on which SAP operates.
    For tutorial, enter "DEVECC2".
    Gateway Service The gateway service that operates on SAP system.
    For tutorial, enter "sapgw00".

    Create STFC_CON Listener

    Press "Save" button to create listener.

    Listeners have created "Started?"column is depressed to start the listener.

    Start STFC_CON Listener

    STFC_CON Listener Started Successfully

  5. Check Registered Program
    Login to SAP system and check whether the program is successfully registered to gateway service.

    On SAP GUI, executes transaction code "SMGW" and open the gateway monitor. Select "Jump" - "already logged on to the client" menu of the gateway monitor and check the following entry of the connection from the created listener exists.

    Item name Content
    LU name The host name or IP Address of the OS on which SAP BC operates
    TP name STFC_CON
    Syst. Type Registered Server

    Gateway Monitor

Configuration of RFC Connections

For outbound processing, sets RFC connection in SAP system.
  1. Configuration of RFC Connections
    Defines RFC connection that refers to the program of listener registered on SAP BC. Execute transaction code "SM59" in SAP GUI.

    Show RFC Destination

    Select "TCP/IP connections" and press [Register] button.

    Register new RFC connection

    Enter the following values on Register RFC Destination screen.

    [TAB]: Item name Value
    Basic Screen RFC Destination BC_STFC_CON
    Connection Type T (TCP/IP Connection)
    Description 1 SAPBC STFC_CONNECTION destination for outbound
    Technical Settings Activation Type Registered Server Program
    Program ID STFC_CON
    Gateway Host The host name or IP Address of the OS on which SAP operates.
    For tutorial, enter "DEVECC2".
    TCP service The gateway service that operates on SAP system.
    For tutorial, enter "sapgw00".

    STFC_CON RFC destination basic setting

    STFC_CON RFC destination technical setting

    RFC connection connection setting

    When using Unicode system, select [Unicode] from [Communication type with target system] from [MDMP/Unicode] tab.

    Unicode system Press "Save" button to register RFC destination.

  2. Connection test
    Press [Connection Test] to test connection.
    If the connection test is successful the following screen will appear.

    Connection test succeeds

    If the connection test fails, please check the following.
    • RFC destination setting in consistent with SAP BC listener setting
    • SAP BC is started

Get schema for input and output data

Gets the schema for input and output data of the script to start with outbound processing.
  1. Get XML template for Input Data
    Press "Adapters" - "SAP" to open SAP server setting screen.

    SAP Menu

    Press "Lookup" to open the module searching screen.

    Lookup Menu

    Enter the following information on the module searching screen and press "bXML" button.

    Item name Value
    Function Name STFC_CONNECTION

    The Lookup of STFC_CONNECTION

    The bXML of STFC_CONNECTION

    When getting XML template of RFC general module, enter the RFC general module name to execute to "Function Name" and press "RFC-XML" button.
    Please contact SAP corporation about how to get XML template of IDoc.

    The shown XML template is the schema of the input data of the script started by outbound processing. The shown XML template is saved as file under the following directory. Please create the directory if necessary.
    Item name Value
    Pass /data/sapbc/bapi_outbound/stfc_connection_input.xml

  2. Get XML template for Output Data
    Press "Invoke" button to test execution.

    The bXML test execution button of STFC_CONNECTION

    The bXML response of STFC_CONNECTION

    The shown XML template is the schema of the output data of the script started by outbound processing. The shown XML template is saved as file under the following directory.Please create the directory if necessary.

    Item name Value
    Pass /data/sapbc/bapi_outbound/stfc_connection_output.xml

Create script for Outbound

Receive outbound processing of SAP system with SAP BC trigger and start script. Save the request data passed from SAP system in the script to XML file, and return the current time to SAP system as response data.
  1. Completed Script Image

    Completed Script

  2. Create Project and Script
    Creates project and script of the follows.

    Item name Value
    Project Name SAP BC Adapter Tutorial
    Script Name Outbound BAPI

  3. Create an XML type script variable for input/out
    Creates XML type script variable as the following contents.

    Variable name Type Input/Output
    in_xml XML type Use variables as script input variable
    out_xml XML type Use variables as script output variable

  4. Create Write XML File
    Place "File" - "XML" - "Write XML file" of tool palette on Script Canvas.
    Set the following values in the property settings dialog of Write XML File.

    Category Item name Value
    Basic settings Name Write XML File
    Input data in_xml
    Required settings File /data/sapbc/bapi_outbound/stfc_connection_output.xml

  5. Create response data
    Place "convert" - "basic" - "mapping" of Tool Palette on Script placed Canvas. Sets the following values in the mapping.

    Category Item name Value
    Basic settings Name Create response data
    Input Data Flow in_xml
    Output Data Flow out_xml

    Open mapping "Create response data" and maps as follows.

    Item name Value
    Input Schema Read from file /data/sapbc/bapi_outbound/stfc_connection_input.xml
    Output Schema Read from file /data/sapbc/bapi_outbound/stfc_connection_output.xml

    Input Source Item Name Logic Icon Name Output Destination Item Name
    REQTEXT   ECHOTEXT
     
    • [Date] - [Basic] - [Current date/time]
    • [String] - [Date] - [Date/Time Formatting]
    RESPTEXT

    Mapping

    Sets the following values in Convert Date Format.

    Item name Value
    Format yyyy/MM/dd hh:mm:ss

  6. Process Flow Settings
    Connect each created operation with process flow in the following order.

    Order Name
    1 Write XML File
    2 Create response data

    Completed Script

    This completes the script setting.

  7. Register to Server
    To start the script from SAP BC trigger, the script need to be registered to the server. Select [File]-[Register project as service] on Designer and register it to the server.

Create SAP BC Trigger

Creates the SAP BC trigger to receive outbound from SAP system and execute the created script.
  1. Create Trigger
    Select [Create new SAP BC trigger] from Task of My Trigger, SAP BC Trigger setting screen is shown. Sets the following value on the SAP BC Trigger Setting Screen.
    Refer to "SAP BC Trigger Guide" for the details of properties .

    Item name Value
    Trigger name SAP BC Trigger for Outbound
    Execution path /tutorial

    Trigger Settings Basic

    Press [Next] to show the SAP BC trigger execution contents setting screen. Sets the following value on the SAP BC Execution Contents Setting Screen. For other property items, please change accordingly.
    About the settings of script argument variables and script output variables, please refer to "Trigger Variable Settings" .

    Item name Value
    Service For tutorial, select "root@SAP BC adapter tutorial".
    Script For tutorial, select "Outbound BAPI".
    Script arguments /in_xml ${trigger.standardInput}
    Script Output /out_xml ${trigger.standardOutput}

    Trigger Settings Execution Contents

    Click [Finish] to create SAP BC trigger. Press [Yes] in the "Trigger enabling confirmation" dialog to enable the trigger. When the trigger is enabled, it can receive the outbound processing from SAP system.

  2. Register Routing Rules
    To register routing rules, executes ABAP program "SRFCCONN" to call function "STFC_CONNECTION" to RFC destination "BC_STFC_CON". Execute transaction code "SA38" in SAP GUI.

    Execute ABAP Program

    Enter the following values to ABAP Program Execution screen, and execute.

    Item name Value
    Program SRFCCONN

    Execute SRFCCONN

    Enter the following values on RFC test screen, and execute.

    Item name Value
    RFCDEST BC_STFC_CON
    NRCALL 1

    BC_STFC_CON RFC Test

    As above, the routing rule of Sender being "M60CLNT300", Receiver being "BC_STFC_CON", MsgType being "STFC_CONNECTION" is registered to SAP BC.

  3. Routing Rules setting
    Press "Routing..." - "Routing Rules" to open "Routing Rule List".

    Routing Menu

    STFC_CON Routing

    Press the "Edit" button of the registered routing rule and open the editing screen of routing rules. Enter the following values and press "Save" button.

    Edit routing button

    Item name Value
    Transport XML
    Specify URL http://192.168.100.35:7700/dataspider/sapbc/tutorial
    Change according to the host name or IP address, port number of the OS on which the DataSpiderServer operates.
    XML dialect bXML

    Edit STFC_CON Routing

    RFCTo execute the RFC versatile module or Idoc, set "SAP-XML" in "XML dialect" and check "Use text/xml as content type".

    Edit STFC_CON Routing Completed

    Press "No" of "Enabled?" column to set to "Yes".

    Enable Routing

    Enable STFC_CON Routing Completed

  4. Execution test
    Again, executes ABAP program "SRFCCONN" to call function "STFC_CONNECTION" to RFC connection "BC_STFC_CON" Execute transaction code "SA38" in SAP GUI.

    Execute ABAP Program

    Enter the following values to ABAP Program Execution screen, and execute.

    Item name Value
    Program SRFCCONN

    Execute SRFCCONN

    Enter the following values on RFC test screen, and execute.

    Item name Value
    RFCDEST BC_STFC_CON
    NRCALL 1

    BC_STFC_CON RFC Test

    If the test is successful the following screen will appear.

    BC_STFC_CON RFC Test Result

    Or check the status of trigger "SAP BC Trigger for Outbound" in My Trigger, and the "Normally Ended" is shown in [Last execution result].

    If the script has been successfully executed from the trigger, the following data is output to /data/sapbc/bapi_outbound/stfc_connection_output.xml.

    <?xml version="1.0" encoding="Shift_JIS"?>
    <biztalk_1 xmlns="urn:biztalk-org:biztalk:biztalk_1">
      <header>
        <delivery>
          <message>
            <messageID>A9FE3725F70DEBBB000023DD</messageID>
            <sent>2010-06-04T01:53:53</sent>
          </message>
          <to>
            <address>urn:sap-com:logical-system:BC_STFC_CON</address>
          </to>
          <from>
            <address>urn:sap-com:logical-system:BSP000</address>
          </from>
        </delivery>
      </header>
      <body>
        <doc:STFC_CONNECTION xmlns:doc="urn:sap-com:document:sap:rfc:functions" xmlns="">
          <REQUTEXT>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 äöüß ÄÖÜ !§$%&/()=?{[]}+*~#-_.:,;</REQUTEXT>
        </doc:STFC_CONNECTION>
      </body>
    </biztalk_1>