Developing OTDs for Application Adapters

Creating SAP BAPI OTDs

The SAP BAPI wizard is used to create BAPI and RFC OTDs. BAPI and RFC OTDs can be used in Java Collaborations and eInsight Business Processes, and Netbeans EJBs to communicate with SAP.

SAP BAPI Encoding

SAP BAPI/RFC OTDs are encoding independent of the SAP system. This means that OTDs created on a Unicode SAP instance can seamlessly interact with non-Unicode SAP instances, and vice versa. In addition, the marshal and unmarshal encoding methods on the IDOC_INBOUND_ASYNCHRONOUS OTD only apply to the data, and not to the SAP instance. The default for all processed byte data is UTF-8, regardless of connection type (Unicode or non-Unicode).

When attempting to unmarshal data flows using an encoding other than UTF-8, such as UTF-16, then you must also call the setUnmarshalEncoding method to specify this encoding. This enables the Adapter to properly unmarshal the byte array.

You also need to set the correct Character Set in the Environment parameters for an inbound Adapter when receiving data from SAP. This way, the Adapter knows whether it is receiving Unicode or non-Unicode data from the SAP instance. The setMarshalEncoding method is only for marshaling the OTD data into a byte array and is not related to the SAP system character set.

Like the outbound data flows mentioned above, attempting to marshal data flows using an encoding other than UTF-8, such as UTF-16, requires setting the setMarshalEncoding method to match this encoding. This enables the data received from SAP to be correctly converted to a byte array of the desired encoding.

Date and Time Stamp Requirements

Date and time stamp fields in the OTD are now typed as java.lang.String fields. This means that the OTD expects values assigned to date fields as YYYYMMDD, where February 14, 2006 becomes 20060214.

The data format time fields is HHMMSS, where 11:59:59 PM becomes 235959, or 12:00:00 AM becomes 000000.

Installing SAP JCo

The SAP Java Connector file, sapjco.jar, is a middleware component that enables the development of SAP-compatible components and applications in Java. This component is required by the SAP BAPI OTD Wizard to create BAPI and RFC OTDs during design time, and to support inbound and outbound SAP server communication during runtime.

Since we are installing the SAP Java Connector as standalone component, certain installation files are required. Download the installation files from SAPNet at http://service.sap.com/connectors/. Once logged in, this link redirects you to SAP Service Marketplace. Click the following links to access the SAP Java Connector (SAP JCo) tools and services page:


SAP NetWeaver > SAP NetWeaver in Detail > Application Platform > Connectivity > Connectors > SAP Java Connector > Tools & Services

The following section details the basic guidelines for installation.

ProcedureTo Install SAP JCo on Windows 32

  1. Create a directory.

    For example


     C:\SAPJCo

    and extract the JCo ZIP file into this directory.

  2. Copy the files librfc32.dll and sapjcorfc.dll from your SAP JCo main directory to


     C:\WINNT\SYSTEM32

    Make sure that the version that is already there is not a more recent version than the one that is delivered with the SAP JCo.

  3. Copy the file sapjco.jar from your SAP JCo main directory to


     <JavaCAPS6>\netbeans\lib\ext

    Where <JavaCAPS51> is the Sun Java Composite Application Platform Suite install directory.

  4. The sapjco.jar file is also required during runtime. For this, add the JAR file to


     <JavaCAPS6>\netbeans\is\lib
  5. Download the following DLL files:

    • msvcp71.dll

    • msvcr71.dll

    These are available, free of charge, from various sources on the Internet:

  6. Manually add the DLL files to the following location:


    c:\WINNT\system32

    Note –

    Restart both Netbeans IDE and the domain after installing the JAR file.


ProcedureTo Install SAP JCo on Unix

The instructions for the installation of SAP JCo on other operating systems are included in the corresponding download files.

  1. On UNIX operating systems, add the OS specific shared lib files to the library path.

  2. Check the SAP BAPI Adapter readme to confirm the supported operating systems.

  3. Copy the JCo JAR file to the following location before deploying and running command line code generation.


     \compile\lib\ext
  4. Copy the JCo JAR file to the c:\Sun\ApplicationServer\lib folder before deploying and running via the Sun Java™ System Application Server Enterprise Edition 8.1.

  5. Copy the JCo JAR file to the following location before deploying and running via the WebLogic Application Server, version 9.1.


     c:\bea\weblogic91\samples\domains\wl_server\lib

    Note –

    The SAP Java Connector file, JCo version 2.1.6 is not backwards compatible with previous versions, such as 2.1.3. Confirm backwards compatibility issues with SAP before attempting to switch between different JCo versions on different machines.



    Note –

    SAP BAPI Adapters can run on a 64-bit JVM, but only after the correct 64-bit JCo files (version 2.1.3 or later) have been applied.



    Note –

    The SAP application must be configured to communicate with the SAP BAPI Adapter as described in Configuring SAP in the SAP BAPI Adapter Intelligent Adapter User’s Guide.



    Note –

    We recommend only using the directory path when setting your library path, not the directory path and file name.



    Note –

    JCo 2.1.6 does not support mixed case, users may need to convert passwords to upper case for all design time and runtime SAP connection configurations.


Creating BAPI and RFC OTDs

You create BAPI and RFC OTDs with the SAP BAPI wizard in the Netbeans IDE.

ProcedureTo create BAPI OTDs

  1. In the Explorer tab of the Netbeans IDE, right click the Project, click New, and click Object Type Definition. The New Object Type Definition Wizard dialog box appears.

  2. Click SAP BAPI and click Next. The Select SAP Object page appears.

  3. To convert a BAPI object to OTD, select the BAPI option.

    To convert an RFC object to OTD, select the RFC option.

  4. Click Next. The System Parameters page appears.

  5. Enter the information for the SAP system for the SAP Adapter to connect to:

    For this option 

    Enter 

    System ID 

    System ID of the SAP system. 

    Application server 

    Host name of the SAP system. 

    System number 

    System number of the SAP system. 

    SAP Routing String 

    Router string of hostnames/IP addresses of all SAP routers between the Application Server and the SAP gateway host (optional). 

    Language 

    Language used for SAP access. 

    RFC Trace 

    NO to disable RFC tracing (default); YES to enable RFC tracing, which creates the trace files in: \netbeans\bin

  6. Click Next. The Login Parameters page appears.

  7. Enter the information to log into the SAP system:

    For this option 

    Enter 

    Client Number 

    Client number of the SAP system. 

    User name 

    User name. 

    Password 

    Login password. 

  8. Click Next. The Select BAPI/RFC page appears, showing the application components

    In the BAPI tree, you can navigate to a particular SAP application component and select a BAPI object.

  9. Expand the SAP application component folder, click a BAPI, and click Finish. The OTD Editor window appears, displaying the OTD.

    For information about the BAPI and RFC OTDs, refer to the section below.

    You can now built the Collaborations or Business Processes as described in Building and Deploying the prjBAPIOutbound Sample Project and Building and Deploying the prjIDocInbound Sample Project. The section below describes the BAPI methods (operations) that are available for you to use in the Java Collaborations or Business Process.

Relaunching BAPI and RFC OTDs

When an OTD is built for an SAP business object such as:

Application Components g Controlling g CostCenter.

This creates an OTD which has methods corresponding to all BAPIs in the Cost Center Business Object of SAP.

The CostCenter OTD has nodes for each of the BAPIs in the CostCenter business object. The OTD also has WSDL operations such as GetListExecute and GetListReceive. These WSDL operations are used when the OTD is used in a Business Process. The execute methods are used for client mode operations. The receive methods are used for server mode operations.

If required, you can also use the Relaunch option of the OTD to relaunch the CostCenter OTD wizard, see the figure below, and rebuild the BAPI OTD for the same BAPI/RFC.

Please note that selecting a BAPI/RFC other than the original one used to build the OTD will corrupt your OTD and its associated Collaborations and Business Processes.

On Relaunch, the OTD is rebuilt again with the changed meta data, and any Java Collaborations and Business Processes using this BAPI OTD are synchronized with the new changes.

If your Java Collaborations or Business Processes are using OTD nodes that are now absent in the relaunched BAPI/RFC OTD, you will be prompted to correct the business rules by validation errors.