You are on page 1of 2

SAP Resource Adapter, Exercises

Unit: Remote call using SAP Resource Adapter


Topic: Java Connector

At the conclusion of this exercise, you will be able to:


• How to use the Common Client Interface to make a remote function
call.

1. Development Objectives
Creating a J2EE Project and using the Common Client Interface API to make a
remote function call. The J2EE Project will contain an EAR application and a
WAR application. The Web Application will have a Servlet which will make use
of the Common Client Interface API Classes to get a list of Company Codes from
SAP R/3 function module BAPI_COMPANYCODE_GETLIST.

2. Prerequisites
2-1 You have installed the SAP Resource Adapter file on the Web Application
Server.
2-2 You have launched the Netweaver Developer Studio.
2-3 You have selected the J2EE perspective.

3. Exercise Guide

3-1 Open the project template in the exercise directory called


InitialProjects.
3-2 Setup classpath – Add connector.jar to the classpath
3-3 Add code to the doGet method of the servlet
3-3-1 Obtain the JNDI Context
3-3-2 Lookup a Connection Factory
3-3-3 Get a Connection from the Connection Factory
3-3-4 Get a RecordFactory and an Interaction
3-3-5 Execute the BAPI_COMPANYCODE_GETLIST fn. Module.
3-3-6 Display the results in HTML table format.
3-3-7 Release the interaction.

4. Deploying the Application


5-1 Right Click on the SAPJRAExampleWeb Project and “Choose Build Web
Archive”.
5-2 Right Click on the SAPJRAExample Project and “Choose Build Application
Archive”.
5-3 Right Click on the SAPJRAExample.ear file and “Choose Deploy to J2EE
Engine”

5. Testing the Application


Open Web Browser and Navigate to this URL http://localhost:<http-
port>/SAPJRATest/SAPJRATestServlet

6. Result
As a result of the exercise you will be able to display a list of Company Codes and
Company Names.

You might also like