Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

IBM WebSphere Developer Technical Journal: Accessing SAP Systems -- Part 3

Tips and Techniques for Migrating and Developing SAP Applications with WebSphere Studio

Sandy Minocha (minocha@ca.ibm.com), WebSphere JumpStart ISV Enablement, IBM Software Group, IBM Toronto Lab
Sandy Minocha works for the WebSphere Studio Jumpstart ISV Enablement team at the IBM Toronto Software Lab. The team engages with key WebSphere Studio tools partners, providing technical guidance and support as they integrate into the WebSphere Studio set of products. The team also performs technical validations of partner plug-ins for the Ready for WebSphere Studio partner program. Sandy has a BASc in Electrical Engineering degree from University of Waterloo and a MEng in Telecommunications degree from University of Toronto. He is also a PEng. You can contact Sandy at minocha@ca.ibm.com.
Ahmed Khalifa (akhalifa@ca.ibm.com), WebSphere Training and Technical Enablement, IBM Software Group, IBM Toronto Lab
Ahmed Khalifa works for the VisualAge and WebSphere Enablement team at the IBM Toronto software lab. His career started back in 1986, in the hot summer of Upper Egypt, when he wrote his first spreadsheet using Basic on a Commodore 64. In 1990, Ahmed received an engineering degree in architecture with a diploma in computer science, and then worked on CAD applications using C++ on DOS, Windows, and Macintosh. Ahmed joined IBM Egypt in 1993 and worked on the development of Arabic APIs for OS/2. Ahmed joined the IBM Toronto Lab team in 1997. He can be reached at akhalifa@ca.ibm.com.

Summary:  This article brings together information that will help you more efficiently develop Web applications to access SAP applications, and also help you migrate beans generated from VisualAge for Java's SAP Access Builder to WebSphere Studio.

Date:  16 Jul 2003
Level:  Introductory

Activity:  2675 views
Comments:  

Introduction

Part 1 of this article series discussed how IBM ® WebSphere® software products provide support for accessing SAP® systems. Part 2 examined the different types of SAP applications that can be built using these WebSphere products. In Part 3, we'll bring together important information, tips and techniques that will not only help you more efficiently develop Web applications to access SAP systems, but also help you migrate beans generated from VisualAge® for Java's SAP Access Builder to WebSphere Studio.

This article will cover how to:


Deploy applications to WebSphere Application Server, Advanced Edition

The target platform for J2EE applications developed with WebSphere Studio Application Developer, Integration Edition, Version 4.11 is typically WebSphere Application Server, Enterprise Edition, Version 4.x. However, a fixpak is available that makes it possible to deploy JCA applications to WebSphere Application Server, Advanced Edition (hereafter called Advanced Edition).

The high level steps for deploying JCA applications on a standalone Advanced Edition server include:

  1. Apply WebSphere Application Server Advanced Edition V4 FixPak 4 to your standalone Advanced Edition server.
  2. Ensure JCA support is installed in Advanced Edition. The option to install JCA is included in Advanced Edition Version 4.02 and later.
  3. Export the JCA application from WebSphere Studio Application Developer, Integration Edition, Version 4.11, using the Export EAR wizard.
  4. Using Advanced Edition's admin console, install WebSphere Adapter for mySAP.com, and set up an SAP connection factory.
  5. If desired, add security or make other deployment descriptor changes in the exported JCA application using the Application Assembly Tool.
  6. Using Advanced Edition's admin console, use the installation wizard to install the JCA application as you would any EAR.

The steps to accomplish the above are described in detail in the article Running WebSphere Studio Application Developer Integration Edition Version 4.1.1 JCA Applications on WebSphere Application Server, Advanced Edition.


Trace SAP connectivity

When tracing SAP connectivity, errors can be thought of as occurring during two distinct phases:

  • while connecting to an SAP system; these errors are considered SAP domain errors
  • after connecting, and while executing the desired BAPI/RFC; these errors are considered WebSphere domain errors.

The following sections explain how to trace errors from each of these layers.

Tracing SAP domain errors

Based on our experience, most errors will occur in this layer.

The first thing to do when faced with an exception while connecting to an SAP system is to check the trace file. This trace reports on errors which occur on the SAP side, including communications, user ID and password errors. Make sure that the methods returning from SAP return a completion code of 0. Any other value indicates an error, which is usually accompanied with messages explaining what type of error occurred and in which component (BAPI, etc.).

The ability to trace SAP connectivity data is available through a serialized class called JNISettings (unchanged from the VisualAge for Java SAP Access Builder), details of which can be found in Chapter 14 "Performing Specific Tasks" of the SAP.PDF file that ships with WebSphere Studio Application Developer, Integration Edition, Version 4.11 (hereafter called Application Developer). To set the JNISettingsclass from inside Application Developer to trace SAP domain errors:

  1. Locate the JNISettings class:
    1. From a Java or Enterprise Server perspective, open a project containing the definition of any SAP Service. (It doesn't matter which SAP service you select.)
    2. Expand the project.
    3. Locate the ijvsap35.jar file, and expand it.
    4. Locate the com.ibm.sap.bapi.jni package, and expand it.
    5. Locate the JniSettings.class, as shown in Figure 1.

    Figure 1. Locate JNISettings class
    Locate JNISettings class
  2. Set the properties of the class:
    1. Right click on JniSettings.class, then select Properties.
    2. In the Execution Arguments pane, enter the following parameters into the Program Arguments field: -tracefile X:\Saptrace.txt -rfctracemode 1 This command directs WebSphere Adapter for mySAP.com to set tracing mode to on and to direct the trace text to a file called X:\Saptrace.txt.
  3. Run the class:
    1. Select the class JNISettings.class and select the Run button Run on the tool bar.
    2. From the Select Launcher dialog, select Java Application and make sure you deselect the set as default launcher check box.
    3. Select Next, then Finish.
    4. An output similar to Figure 2 should appear on your console.

    Figure 2. Console messages when launching class
    Console message when launching class
    When this program is run, a file called JNISettings.ser is created in the directory where Application Developer is installed. WebSphere Adapter for mySAP.com will open this file at run time to decide the tracing policy to be used during execution. You can have different JNISettings.ser files for different phases of testing. When deploying your application, copy this file to the directory from which you will start your Java application, which is typically <WAS_HOME>\bin when running WebSphere Application Server.

Tracing WebSphere domain errors

To trace WebSphere Adapter for mySAP.com and WebSphere's implementation of JCA, follow these steps:

  1. Open the Server perspective.
  2. From the Server Configuration view, expand Server Configurations and double-click on was40 to open the server configuration editor.
  3. Select the Trace page.
  4. Ensure the Enable trace checkbox is checked.
  5. Modify the trace string to read: com.ibm.connector2.sap.*=all=enabled:com.ibm.ejs.j2c.*=all=enabled
  6. Select the J2C page.
  7. In the J2C Resource Adapters box, select SAP.
  8. In the J2C Connection Properties box, select SAPConnectionFactory.
  9. In the Resource Properties box, set the property TraceLevel to 3. The trace levels for SAP correspond to:
    • 1: no tracing, trace exceptions only
    • 2: trace method entry and exits
    • 3: output all debug entries.

The trace output is stored in <workspace>/.metadata/.plugins/com.ibm.etools.websphere.tools/logs/trace.log. Regardless of the trace string entered in the Trace page, WebSphere Adapter for mySAP.com's TraceLevel resource property must be set in order to turn on tracing. Otherwise, tracing will not be performed.


Set default values for the server connection

Default values for the server connection, like host name, client number, and others, can be set by customizing the ImportSAP.wsdl file. Normally, this connection info needs to be set everytime the user wants to create an SAP service. An SAP service is like a Web service except it represents an operation on an SAP R/3 system. In WebSphere Studio Application Developer, Integrated Edition, the New Service wizard is used to create SAP services. The initial page for this wizard asks you for connection information, which it uses to connect to a live SAP R/3 system in order to retrieve its metadata. The user than selects this metadata and the wizard generates an SAP service for it. Having the connection information added to this WSDL file for reference is a real time saver.

This ImportSAP.wsdl file exists in the <your workspace directory>\Installed Resource Adapters\<your SAP adapter name>\com\ibm\jca\importservice\sap directory. Edit the file using a text editor and change the line highlighted below in this section of code:

<service name="ImportService">
<port binding="tns:ImportSAPBinding" name="ImportSAPPort">
<sap:address systemNo="0" />
</port>

to look like this:

<service name="ImportService">
<port binding="tns:ImportSAPBinding" name="ImportSAPPort">
<sap:address hostName="com.sap.servername" systemNo="0" client="800" 
userName="username" password="password" />
</port>

You can add additional attributes in the same manner, as long as the variable name in the WSDL file matches the screen name of the field for which you want to create a default.


Reduce clutter in Java perspectives

When you create a new SAP service you'll notice a number of libraries added to your Java/Service project, which might be annoying when scrolling between different projects. To hide those libraries, click the down-arrow icon in the Packages view, and deselect Show Referenced Libraries, as Shown in Figure 3.


Figure 3. Hide referenced libraries
Hide referenced libraries

Access BAPI/RFC parameters using service proxy classes

When generating a session bean or a client stub style proxy bean, only the first BAPI/RFC output parameter is accessible from the generated proxies. Since most SAP applications return multiple output parameters, you want to make sure you get them all. To do this, WebSphere Adapter for mySAP.com generates an output container class with getter methods for all output parameters and tables of the respective BAPI/RFC. The output container is accessible from the session bean and from the client stub style proxy (return parameter of the session bean/proxy method to execute the BAPI/RFC). These output parameters can be retrieved from the proxy class directly if you are using command bean style proxies.


Retrieve SAPConnection using a ConnectionSpec object

The ConnectionSpec user ID and password properties, which are used to retrieve a managed connection from SAP R/3, are generally the user ID and password entered in the SAPConnectionFactory in the server configuration. However, it is possible to override these properties at run time by setting an attribute on the address extensibility element of your SAP service. By setting the overwriteLookup attribute to true, the SAPConnection returned will be based on the user ID and password set in the address extensibility element, as opposed to was set in the SAPConnectionFactory. For example:

<service name="BapiCompanyGetlistService"> 
   <port binding="tns:BapiCompanyGetlistSAP" name="BapiCompanyGetlistSAPPort"> 
      <sap:address checkAuthorization="true" client="800" codepage="" 
         destination="" gatewayHost="" gatewayService="" groupName="" 
         hostName="r3host.com" language="" loadBalancing="false" msgServer="" 
         password="r3password" rfcMode="3" systemName="0" systemNo="0" 
         traceLevel="0" userName="r3user" overwriteLookup="true"/> 
   </port> 
</service>
            


Migrate BAPI, RFC and business object proxy beans from VisualAge for Java

Follow the steps below to regenerate all RFC/BAPIs that had not already been generated with the RFC proxy for J2EE connector for SAP R/3 checkbox. (If your Java beans are already generated into a J2EE connector, begin at step 6.)

  1. In the Access Builder for SAP R/3 menu, select Options => Change Options.
  2. Check the RFC proxy for J2EE connector for SAP R/3 checkbox in the "VAJ generation" dialog.
  3. Click OK.
  4. Select Options => Save Options.
  5. Regenerate all RFC/BAPI beans you want to migrate using the new settings.
  6. Export your projects as you would normally, and include all generated classes in preparation for migrating for migrating it to WebSphere Studio.

Figure 4. Generation options
Generation options

In Application Developer, follow these steps:

  1. Switch to a Java perspective.
  2. Create a new Java project, as follows:
    1. Name the project, then select Next.
    2. From the Libraries tab, select Add External JARs.
    3. Browse to <your workspace directory>\Installed Resource Adapters\SAP JCA.
    4. Select all the available JAR files and click Open.
    5. Browse to <WebSphere Studio installation Directory>\plugins\com.ibm.etools.websphere.runtime\lib\.
    6. Select the following JAR files:
      • jca.jar
      • wsif.jar
      • wsdl4j.jar
      • wsatlib.jar
      then select Open.
    7. Click Finish.
  3. Import your previously generated Visual Age for Java ZIP file into the Java project:
    1. Make sure the project is highlighted, then select File => Import.
    2. Select the VisualAge for Jaza ZIP file(s), then select Next.
    3. Use the Browse button to locate your ZIP file, verify you are importing all the necessary files, then select Finish.
  4. Open the RFC Proxy files that will contain some errors (double click on the file and it will open in a java editor).
  5. From the Outline view, right click on the class name and select Add Unimplemented Methods to offset these errors, as shown in Figure 5.

Figure 5. Add unimplemented methods
Add unimplemented methods

Conclusion

In this series, we've examined the new tooling strategy of IBM for connecting to SAP R/3 systems. By plugging WebSphere Adapter for mySAP.com into WebSphere Studio Application Developer, Integration Edition, you can browse BAPIs/RFCs of SAP R/3 systems and add WSDL representations of the desired function modules. The WSDL representations can be used to generate Java applications, J2EE applications and Web service applications. We've also shown how to migrate your VisualAge for Java SAP Access Builder-generated beans into WebSphere Studio.


Resources

About the authors

Sandy Minocha works for the WebSphere Studio Jumpstart ISV Enablement team at the IBM Toronto Software Lab. The team engages with key WebSphere Studio tools partners, providing technical guidance and support as they integrate into the WebSphere Studio set of products. The team also performs technical validations of partner plug-ins for the Ready for WebSphere Studio partner program. Sandy has a BASc in Electrical Engineering degree from University of Waterloo and a MEng in Telecommunications degree from University of Toronto. He is also a PEng. You can contact Sandy at minocha@ca.ibm.com.

Ahmed Khalifa works for the VisualAge and WebSphere Enablement team at the IBM Toronto software lab. His career started back in 1986, in the hot summer of Upper Egypt, when he wrote his first spreadsheet using Basic on a Commodore 64. In 1990, Ahmed received an engineering degree in architecture with a diploma in computer science, and then worked on CAD applications using C++ on DOS, Windows, and Macintosh. Ahmed joined IBM Egypt in 1993 and worked on the development of Arabic APIs for OS/2. Ahmed joined the IBM Toronto Lab team in 1997. He can be reached at akhalifa@ca.ibm.com.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=87662
ArticleTitle=IBM WebSphere Developer Technical Journal: Accessing SAP Systems -- Part 3
publish-date=07162003
author1-email=minocha@ca.ibm.com
author1-email-cc=
author2-email=akhalifa@ca.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers