cancel
Showing results for 
Search instead for 
Did you mean: 

JCO Connection to a backend SAP system in Hybris 5.3

0 Kudos

Hello Experts,

I am trying to call a SAP CRM RFC from a Hybris service layer class. However, the connection object always seems to be null and throws up an exception. I have followed the steps in the below link.

https://wiki.hybris.com/display/release5/sapcorejco+Extension+-+Technical+Guide#sapcorejcoExtension-...

Below is my code: package com.sap.trial.services;

 import de.hybris.platform.sap.core.bol.backend.BackendType;
 import de.hybris.platform.sap.core.bol.backend.jco.BackendBusinessObjectBaseJCo;
 import de.hybris.platform.sap.core.jco.connection.JCoConnection;
 import de.hybris.platform.sap.core.jco.exceptions.BackendException;
 
 import com.sap.conn.jco.JCoFunction;
 
 
 /**
  * 
  */
 @BackendType("ERP")
 public class ZCallSampleSAPRFCBackend extends BackendBusinessObjectBaseJCo
 {
 
     //    @Resource
     //    private JCoManagedConnectionContainer managedConnectionContainer;
     JCoConnection conn = null;
 
 
     public String getUserName()
     {
         conn = getDefaultJCoConnection();
         String name = "";
         try
         {
             final JCoFunction function = conn.getFunction("Z_READ_UNAME");
             conn.execute(function);
             name = function.getExportParameterList().getString("EV_UNAME");
         }
         catch (final BackendException e)
         {
             e.printStackTrace();
         }
         return name;
     }
 
 
 }
 

Can you please help to point what I am missing in this flow:

PS: I have setup the RFC destination in hmc and the ping also works fine from there.

Pradeep

View Entire Topic
0 Kudos

Thank you Pradeep

0 Kudos

Hi Pradeep,

I was wondering if you could help us out with our issue trying to make jco work. We reported an issue in here, https://answers.sap.com/questions/12759659/sap-jco-integration-issue-spring.html. Unfortunately, without a reply.

I explored the forum and I think you could help us out.

Thanks.

0 Kudos

Hi Sagar,

Could you perhaps help us out?

Thanks.

0 Kudos

Hi, The link you provided below doesnt seem to exist. Can you please explain the issue you have? Pradeep