Simple Steps to build an Adapter Module using EJB,EAR template
To build an adapter module in SAP XI/PI/PO there are many standard step by step SAP documents, blogs etc.. available on SAP SDN.
How this blog is different?
Well, this blog indirectly covers all those common steps but in the form of a EJB, EAR project template to simplify development effort in Netweaver Developer Studio (NWDS)
How to make use of EJB,EAR template?
Quite easy 😉 Download the EJB,EAR template zip file from https://app.box.com/s/n2amg8rcts8vc9a0csfk. (Also attached to this blog now) In NWDS, File menu -> Import option wizard (General -> Existing Projects into Workspace) and load the downloaded zip file into your NWDS workspace as EJB, EAR projects
What all changes required to the imported projects?
- Right click on both the imported EJB and EAR projects together (use CTRL key) and then in the context menu click validate to see if any errors
- Right click on the imported EJB project to configure build path to the mandatory module API jars/external jars ( Beginners, please refer to steps 4.1, 4.2 and 4.7 for required jar files and detailed procedure http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa?QuickLink=index&overridelayout=true)
- Rename (Refactor option in the context menu of right click on EJB project) YourAdapterModule_EJB to desired name as per your project requirement e.g., for this demo I am using ForSDNDemo_EJB
- Expand ForSDNDemo_EJB project and then refactor the current java package “yourpackagename” according to your project requirement e.g., for this demo I am using “com.sapsdn.demo” as package for module development. Ignore any errors during this step and continue
- Similarly refactor “YourAdapterModuleBean” java file to your own java file. E.g., ForSDNDemoBean. Click Next -> and then Finish. ** Amend the java code according to your requirement with your code
- Optional step but it is a good practice: Open ForSDNDemoBean.java file, and then find (CTRL+F) “YourAdapterModuleBean.java” and replace with ForSDNDemoBean.java (import extra packages and add your own java code according to your requirement) and also replace yourpackagename with your project package i.e., in this demo com/sapsdn/demo
- ** Expand META-INF folder and then open ejb-j2ee-engine.xml -> go to source tab, then change <ejb-name> tag value to ForSDNDemo (same as your EJB project name) from YourAdapterModule. Also, the most important <jndi-name> tag value to your specific jndi-name, for this demo I used ForSDNDemoJNDI as jndi name in place of YourAdapterModuleJNDI
- Similary, change <ejb-name> tag value of ejb-jar.xml to ForSDNDemo (same as your EJB project name) from YourAdapterModule
- Build your EJB project from its context menu when you are done with above steps
- Finally rename YourAdapterModule_EAR project to ForSDNDemo _EAR and then export project as SAP EAR File for deployment into XI system by BASIS team (or) directly deploy to XI server from EAR project context menu Run AS -> Run on Server. For direct deployment option please refer 4.11 and 4.12 sections of above step1 reference SAP document
Hope the above procedure is clear and helps you to build your custom module requirement easily. Appreciate your feedback and comments to improvise this blog content
Few important snap shots for above procedure,
Nice one Praveen.
Wow - superb guide - it is super easy to make a module with it.
Thanks Vladimir, - //BR, Praveen Gujjeti