Introduction

When I first shared on SCN the custom adapter modules that I developed, I hoped that it would be beneficial to others who require similar solutions for their requirement. My intention was to bridge some of the gaps in SAP’s own standard offering (some gaps which have been around for far too long!) by providing highly reusable solutions.

I have been pleasantly surprised by the response of SCN members to the com.equalize.xpi.af.modules suite of adapter modules (FormatConversionBean, AttachmentSplitterBean and DynamicAttributeChangeBean). As I have provided the EAR file that can be used for direct deployment to PI/PO 7.31/7.4 (and I believe it should also work in PI/PO 7.3), many have deployed it on their systems and provided feedback that the modules are working well. Some have also provided feedback on issues and bugs which have helped me improve the modules further.

Occasionally, there are some requests on setting up the project in NWDS (based on the source codes I provide in GitHub) in order to further customize the solution. Although the blog Recompile com.equalize.xpi.af.modules as EJB 2.1 modules in NWDS 7.1x was written with the intention to enable those working on older PI systems to compile the modules, the procedures are also relevant for NWDS 7.3x and higher.

As I use EGit more and more in my daily routine, it has provided various valuable ways to enhance my workflow such as using EGit to quickly create an Adapter Module’s EJB & EAR project.

Similarly, for those working on NWDS 7.3x and higher and interested in customizing these adapter modules, it is much easier to use EGit to setup the project from the GitHub repository (instead of the steps in the blog for NWDS 7.1x). I have since restructured the GitHub repository so that it can be easily cloned and imported into an Eclipse/NWDS workspace. In this blog, I will share the steps of how this can be achieved relatively easily. I hope this will be useful for those who are interested in customizing/enhancing this solution further.

Prerequisite

Note: This blog assumes that a working setup of an NWDS installation is already in place. There are many blogs in SCN that already covers that topic.

1. EGit installation and configuration

EGit comes pre-installed in an NWDS 7.5 bundle. For NWDS 7.3x, follow the Installation section of the following blog.

Using EGit for Java source code management in NWDS

Once it is installed, complete the Initial Configuration section of the above blog.

2. PI Adapter Module library files

Although NWDS 7.3x onwards provides built in XPI Adapter Libraries, these are reduced copies and do not contain all classes compared to the libraries which are on the system. Some of the logic in the custom adapter modules refer to some classes which are not available in these reduced libraries. As such, the following JAR files need to be retrieved from the PI system.

  • com.sap.aii.af.cpa.svc.api.jar
  • com.sap.aii.af.ms.ifc_api.jar

Refer to the following Wiki for the location of these files and how to get them.

Where to get the libraries for XI development – Process Integration – SCN Wiki

3. Apache POI library files

Download the following Apache POI 3.9 library files, and extract the JAR files to a folder named Apache_POI in the local file system.

Apache POI 3.9 ZIP file

Step by Step Procedure

Step 1 – Clone Git repository and Import Projects to NWDS

Go to the Git repository on the following site and click Copy to clipboard.

GitHub – engswee/equalize-xpi-modules

/wp-content/uploads/2016/01/github_872905.png

In NWDS, switch to Git perspective, and select Clone a Git repository.

/wp-content/uploads/2016/01/clone_872909.png

The cloning wizard will be auto populated with the GitHub repository details. Click Next twice.

/wp-content/uploads/2016/01/git_repo_872911.png

Select an appropriate location to store the Git repository locally. In the same step, select Import all existing projects after clone finishes.

/wp-content/uploads/2016/01/folder_872912.png

Switch to the Java EE perspective, and the following 4 projects will be listed in the Project explorer. The first two are the EAR and EJB projects, followed by a standalone testing project, and lastly a Java project which the EJB project is dependent on.

/wp-content/uploads/2016/01/projects_872919.png

Step 2 – Resolve JRE System Library

The projects were originally developed using SAP JVM 6. If a different JDK is used in your system, the JRE System Library needs to be updated accordingly.

Right click on the EJB project, select Build Path > Configure Build Path.

/wp-content/uploads/2016/01/libs_872920.png

For example, if this was imported into an NWDS 7.5 installation (which supports Java 8), we can switch it to JDK 1.8.

/wp-content/uploads/2016/01/jdk_872921.png

Step 3 – Resolve classpath variable for Apache POI libraries

The Apache POI libraries need to be bundled together in the EAR file during deployment. As such, they are included in the build path of the EJB project as classpath variables.

Go to Window > Preferences > Java > Build Path > Classpath Variables. Select New.

/wp-content/uploads/2016/01/variables_872922.png

Add a new entry named EXT_LIB, and select the parent folder where the Apache_POI folder reside. In the example below, select Library.

/wp-content/uploads/2016/01/ext_lib_872923.png

Save all the settings and when the following prompt is displayed, select Yes.

/wp-content/uploads/2016/01/build_872927.png

Step 4 – Resolve user library for PI adapter module libraries

Since the PI adapter module library files already exists in the system, they do not need to be bundled in the EAR file. Instead they are referenced in the EJB project as user libraries.

Go to Windows > Preferences > Java > Build Path > User Libraries. Select New.

Add a new user library named PI_LIB.

/wp-content/uploads/2016/01/user_lib_872929.png

Click Add External JARs to the new user library.

/wp-content/uploads/2016/01/ext_jar_872937.png

Select the following two JAR files (which should already be downloaded based on the Prerequisite section).

/wp-content/uploads/2016/01/af_lib_872936.png

Save all the settings. At this point, all the build path should be resolved and all classes should compile and build successfully.

For this point, furthercustomization to the codes can be performed.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Andres Guerrero

    Hi Eng,

    Im having a problem compiling the EJB project, i have done all the steps but i can´t fix this:

    /wp-content/uploads/2016/07/error_1003008.jpg

    i am using SAP Enhancement Package 1 for SAP NetWeaver Developer Studio 7.3, thanks for your help.

    Note: the JDK version is 1.6.0_45

    (0) 
    1. Eng Swee Yeoh Post author

      Hi Andres

      From your screenshot, there seems to be nothing under PI_LIB. You might want to check if you have completed step 4 which adds the external JARs listed under prerequisite item 2.

      /wp-content/uploads/2016/07/pi_lib_1003139.png

      If you still have any issues, please raise it as a discussion thread since the comment section in the blog is not the appropriate area for resolving issues.

      Regards

      Eng Swee

      (0) 
      1. Andres Guerrero

        Hi Eng,

        i found the problem, i was using the wrong version of the nwds, i found the solotion thanks of one of your posts.

        THANKS.

        Regards

        Andres Guerrero.

        (0) 

Leave a Reply