Skip to Content
Author's profile photo Ujjwal Kumar

PI 7.4 – Adapter Module Creation using EJB 3.0


The below mentioned scenario is very common and an adapter module needs to be implemented for the same.

This example below will also help to  build an adapter module in SAP PI 7.4 using EJB 3.0.

The Scenario:

The business requirement is to transfer files from one folder to multiple folders on FTP. The files are present in a consolidated manner at source side, it needs to put in different folders at destination side according to the file names.

For this Scenario: Configurations are done in Integration Directory only and no ESR objects are built.

ESR objects are not required as files need to be transferred as it is from one directory to other directory. And there is no message mapping or data processing required. Hence configurations are done directly in the ID which involves Communication channels, Receiver Determination, Interface Determination, Sender Agreement and Receiver Agreement.

The two major components involved in the scenario are:

Sender Communication Channel:

This channel needs to pick multiple files from the source directory. For this either “Advanced Selection for Source File” option in sender communication channel can be used or we can put *.* in File Name to pick all the files from Source Directory.

Advanced Selection for Source File option is shown below:


Receiver Communication Channel:

This channel needs to put the files in different folders on FTP. For a single communication channel to
put the files dynamically in different folders, an adapter Module needs to be developed which will select the Target Directory Name and File Name Scheme at

The Adapter Module FileAdapModule is highlighted below.


Adapter Module Creation Process for SAP PI 7.4:

The configurations and steps required to build adapter module is mentioned in detail below:

  1. Install the latest version of NWDS 7.3 EHP 1. The latest version of NWDS available is NWDS 7.3 EHP1 SP 12.
  2. Use the JDK 1.6.0_07 or higher in NWDS for building the project.
  3. Following JAR files need to be imported from SAP PI system for creating the Adapter Module.The JAR files and their location on PI system is mentioned below:
  4. EJB Project and Session Bean creation in NWDS: For building an Adapter Module EJB Project needs to be created and stateless session bean needs to be created in the EJB project which holds the business logic.

              In NWDS: Go to File – New – EJB Project


              Enter the details for EJB as mentioned below and click on Next: Select the EJB Module Version as 3.0 and add it to EAR project.


          Uncheck the client interfaces and classes checkbox. Select the “Generate ejb-jar.xml” deployment descriptor checkbox and click on Finish.


          An EJB and EAR project will get created as shown below. EJB Project holds the business logic where as EAR Poject is required for deployment.


    5.  JAR files addition to EJB project: As the Adapter Module needs standard SAP JAR files for compilation, these JAR files need to be added to the EJB project.

    Put all the JAR files mentioned in Step 3 in a Folder in your local machine.

    Right click on EJB project and select Build Path – Configure Build Path.


        Select Library tab and click on Add Variable


    Select the JAR Files Folder from machine and click on Extend:


    Select all the JAR Files and click on OK.


    6.  Adding the Stateless Session bean into the EJB Project:

        Right click on the EJB Project and select New – Session Bean(EJB 3.x)



          Enter the session bean details as mentioned below:

  •           Enter the Java package and Class names.
  •           Select the State type as “Stateless”.
  •           Select the checkboxes for Remote and Local Interfaces.


        Click on Next and Finish. Session bean will be added in the mentioned package in the EJB Project as shown below:


    Open the file and logic to determine the Directory and File names will be added in this java file. Add one Method ModuleData process                (ModuleContext, ModuleData) in the bean as shown below . Reference code is attached in attachment section.



    Right click on EJB and Build  the Project.

7. In the EJB Project maintain the META-INF Files as mentioned below for correct deployment. The ejb-jar.xml file is attached for reference:


Maintain ejb-j2ee-engine.xml file as below:


8. Exporting the EJB Jar file: The source code and class files of the EJB are stored in JAR file which gets deployed on the J2EE server.

    Right click on the EJB Project and select Export – SAP EJB JAR File.


    Select the EJB Project and Destination as mentioned below:


    9. EAR Project Settings:

      This Project holds the EJB project JAR file and has SAP Standard EAR Content in the form of application-j2ee-engine.xml file.


    Open the application-j2ee-engine.xml file and put the source code as attached below. Build the EAR Project like EJB Project.

10.  Exporting the EAR file for deployment:

  • Right click on the EJB Project and select Export – SAP EJB JAR File.
  • Select the EAR Project and Destination as mnetioned below.



11. EAR Deployment and Settings: Setting the PI system as the deployment system in NWDS:

  • Go to Window – Preferences – SAP AS Java and click on Add.
  • Provide the Details and system will be added as shown below.


Deploy the EAR Project on PI system as follows:

  • Right click on EAR Project and select Run As – Run on Server.
  • Select the PI system on which deployment needs to be done.
  • Select the EAR project which needs to be deployed and click Finish.

The steps  screenshots are mentioned below:




In the Deployment View Console, the deploymnet status can be checked. The depoyment should take place without any errors.

This is shown in the screenshot below:

12.  Communication channel settings:


Sender Communication channel – As source file names need to be picked by the receiver adapter module for selecting the corresponding directory.

In the Sender channel the ASMA attributes – File Name checkbox needs to be checked.

Sender File.png

Receiver Communication Channel

The adapter module needs to set the Directory Name and File name dynamically, hence in the ASMA attributes checkbox for File Name and Directory needs to be selected.

Receiver File.png

  • The custom adapter module (identified by JNDI Name mentioned in EJB) needs to be added in the Module tab above the standard SAP Module.
  • The Directory path is passed as the parameter to the custom adapter module logic, hence that need to be added in the Module Configuration section as shown below.
  • Then Run the scenario and the audit log can be checked in Communication Channel monitoring  which will also have traces of custom Adapter Module call.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Pablo Lopez
      Pablo Lopez


      Your blog is very useful.

      Just a small suggestion, you don't need to Import Jar files from the server anymore. Rather than using "Add Variable" you can use "Add Library" and select XPI Libraries which includes all the necessary jars.



      Author's profile photo Ujjwal Kumar
      Ujjwal Kumar
      Blog Post Author

      Thanks for the suggestion !!

      Author's profile photo Artem Solohin
      Artem Solohin


      Author's profile photo Sandeep Maurya
      Sandeep Maurya

      Hi Ujjwal,

      If I import these jar files "Add External JAR".. will it not work?


      Sandeep Maurya.

      Author's profile photo Former Member
      Former Member


      Can we deploy the module externally?. Like the option we have in 7.1, export EAR file -> Convert to .sda and then deploy externally. Do we have it here?. if yes, How would i do it?.


      Author's profile photo Oscar Navas Serrano
      Oscar Navas Serrano

      Hi Ujjwal,

      Thanks for this document.

      I tried to import in SAP PO 7.4 (java only) from NWDS 7.31 SP16, but a warning occurs without the correct deployment of the module. Can you help me about it?

      It's the log:

      Exception has been returned while the [] was starting. Warning/Exception :[

      ][ASJ.dpl_ds.006153 Error occurred while starting application []: It is not started successfully on server nodes [32754650]. In order to bring the server in consistent state stop operation will be performed.

      Error occurred on server 32754650 during startApp of : Cannot load bean class for component*xml|FileAdapModuleEJB.jar*xml|FileAdapModule




      >>Update: See solution in my next post

      Author's profile photo Oscar Navas Serrano
      Oscar Navas Serrano

      Hi all,

      Finally I have found the issue: some imagen have a reference to but in the code example the packet are (also in some images too).

      Finally I have found the issue: some images in this ticket have a reference to but in the code example the reference point  to packet (in some images too).

      At the end, I deployed the component with a script because from NWDS I have others issues because the previous deploy exist.

      Scripts path


      Run the deploy command

          deploy.bat <user>:<password>@<host>:<P4 port> <full path to ear file>


      deploy.bat j2ee_admin:password@saphost:50304 /usr/sap/nwds/FileAdapModuleEAR.ear

      Author's profile photo Ujjwal Kumar
      Ujjwal Kumar
      Blog Post Author

      Thanks for sharing your analysis !

      Author's profile photo Mark Dihiansan
      Mark Dihiansan

      Thank you, this is really helpful.

      Author's profile photo Ujjwal Kumar
      Ujjwal Kumar
      Blog Post Author

      Thanks for your comments.

      Author's profile photo Former Member
      Former Member

      Thank you very much for the useful blog,

      I followed all the steps that you explained.but while deploying it I am getting the below error. I am trying deploy it with my user ID, So do i need to deploy it with PI admin credential only??. Please help me


      Deploy Exception.ASJ.dpl_dc.001085 Operation [deploy] of [sap.com_FileAdapModuleEAR] failed [ERROR: 4/1/16 6:36 PM /userOut/daView_category (eclipse.UserOutLocation) Thread[Deploy Thread,5,main]]

      [#1]: Deployment Items status: [

      [INFO: 4/1/16 6:36 PM /userOut/daView_category (eclipse.UserOutLocation) Thread[Deploy Thread,5,main]]

      [#1]: Deployment Exception during deployment phase [DeploymentException], cause=[ASJ.dpl_dc.001085 Operation [deploy] of [sap.com_FileAdapModuleEAR] failed] [INFO: 4/1/16 6:36 PM /userOut/daView_category (eclipse.UserOutLocation) Thread[Deploy Thread,5,main]]

      [#1]: Deployment of [name: 'FileAdapModuleEAR', vendor: '' (sda)] finished. [INFO: 4/1/16 6:36 PM /userOut/daView_category (eclipse.UserOutLocation) Thread[DC_API-ClientSideAsyncNotification#1,5,main]]

      snap for reference.


      I am using nwds-extsoa-7.3-EHP1-SP06-PAT0015-win32 tool for deployment

      Author's profile photo Praveen Gandepalli
      Praveen Gandepalli

      Hi Pavan,

      You need to open a new thread for this and provide the complete error trace.



      Author's profile photo Former Member
      Former Member

      Hello Praveen,

      Thanks for the prompt reply.

      I opened the new thread for this.Please let me know if you need any additional details for error trace.

      Placing files in multiple folders using single receiver channel

      Author's profile photo Antony FERMINUS
      Antony FERMINUS

      Hi Ujjwal,

      Thanks for the nice article.

      I did the steps as you mentioned.

      I get an error on the receiver cc like below.

      The Adapter Message Property Directory was configured as mandatory element, but

      was not supplied in the XI Message header

      The directory is checked on the receiver cc advance tab. I have also a question which values i have to put for the receiver Target directory and File name scheme in the receiver target tab.

      Any suggestions would be appreciated.



      Author's profile photo Antony FERMINUS
      Antony FERMINUS

      Hi All,

      The issue is solved.

      PI7.4 Adapter module configuration mandatory element problem.

      The test files were not with the correct name like Source1.txt, Source2.txt .......

      I changed the file names and it is working fine now.



      Author's profile photo Ashish Goyal
      Ashish Goyal


      Great Blog! will this work for PI 7.31 as well?


      Author's profile photo Former Member
      Former Member

      Hi Ujjwal,

      The information you provided was very useful.
      Can you please provide the source code for this deployment.I am unable to find the attachment.
      Please share for the link source code in the attachment section.


      Author's profile photo Joe S
      Joe S


      Were you able to get the attachment?


      Author's profile photo Former Member
      Former Member

      HI Ujjwal,

      If possible,can you please provide the reference code to my email id :


      Author's profile photo Shivduttsinh Mahida
      Shivduttsinh Mahida

      Hi Ujjwal,

      I guess the configuration of the ejb-jar.xml is missing the blog.  I tried to deploy the adapter module and was getting error because of that. Once i modified the ejb-jar.xml with the below code, the adapter module worked for me.

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns:xsi="" xmlns="" xmlns:ejb="" xsi:schemaLocation="" version="3.0">
      addBOMBean </display-name>



      Author's profile photo Former Member
      Former Member

      Can you please add ejb-jar.xml?

      Author's profile photo Brian Byrne
      Brian Byrne


      Can you please provide the source code for this I can not find the attachment section mentioned.

      Author's profile photo Orland Louie Reyes
      Orland Louie Reyes

      Where is the attachment section? Please point me in the right direction. thanks!

      Author's profile photo Manoj Pothuganti
      Manoj Pothuganti

      Nice Blog, on how to create a Custom adapter Module.
      But for the current requirement, we can directly route using the receiver rules in Interface Determination , using Context Object "fileName"

      Author's profile photo Sathish Venkataraman
      Sathish Venkataraman



      Is this the file? This is missing in the blog,

      <?xml version="1.0" encoding="UTF-8"?>
      <application-j2ee-engine xmlns:xsi=""

      <reference reference-type="hard">
      <reference-target target-type="service"
      <reference reference-type="hard">
      <reference-target target-type="library">
      <reference reference-type="hard">
      <reference-target target-type="service">
      <reference reference-type="hard">
      <reference-target target-type="interface">

      <reference reference-type="hard">
      <reference-target target-type="library">

      <reference reference-type="hard">
      <reference-target target-type="library">