Connect Liferay with SAP using SAP JCO Connector

This post will elaborate you on how to connect your Liferay portal with SAP Database.
Many times we want need data from SAP database either using web service call or using any third party connector.
In this post we are going to use JCO connector to connect Liferay portal with SAP Database.


Prerequisite

1) First download SAP JCO Connector for your operating system from http://service.sap.com/connectors.
If you are using windows then make sure you download correct version of sapjco dll and jar.
For windows you need to place sapjco dll inside Windows\System32 directory

2) Next thing is configure sapjco3.jar inside Lifeary portal.
Place this jar inside [LIFERAY_TOMCAT]/lib/ext.


Liferay SAP Integration


Following diagram will give you some idea on integrating Liferay with SAP. [Image 1 Diagram]

SAP Java Connector (SAP JCo) is a middle ware component that supports communication with the SAP Server in both directions: inbound calls (Java calls ABAP) and outbound calls (ABAP calls Java).

In this post we will only try to understand inbound calls on how java calls ABAP (SAP)

There are basically 3 steps required to connect with this SAP System.

  1. Defining Destination
    • Define and prepare property file with all connection details.
    • Connection details includes
      1. Host Name
      2. System Number
      3. Client Details
      4. User Name
      5. Password
  1. Establishing Connection
    • In the 1 st step we created property file with all connection details.
    • In this step we are going to use property file to establish connection with SAP System.
  1. Executing Function
    • The RFCs enable you to call and execute predefined functions in a remote system.
    • The RFCs manage the communication process, parameter transfer, and error handling. 

Example

  • I have created sample portlet in LR 6.1 GA2 to connect liferay with SAP database.
  • Portlet will display success message when connection is successfully done.
  • Download and play with this portlet. Here is the download link.
  • Following are some portlet screens that will help you to understand this sample portlet.



  • Click on Test SAP Connection button to connect with SAP System.
  • Once Connection is successfully done you will see following screen.



  • Define all connection related properties inside portlet.properties file of this sample portlet.



0 comments :

Post a Comment