cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI Metada

Former Member
0 Kudos

Hi All,

I am working on a J2EE DC project. We are using EJBs to call BAPIs from SAP system. I am using following code to create a JCO connection with SAP system

<b>JCO.Pool pool = JCO.getClientPoolManager().getPool(Constants.Pool.JCO_POOL_NAME);

if (pool == null){

JCO.addClientPool(Constants.Pool.JCO_POOL_NAME,

5,

"600",

"ABCDEF", "test1234", "EN", "host name", "80"

);

}

fdbconnection = JCO.getClient(Constants.Pool.JCO_POOL_NAME);</b>

After writting this code in EJB if I say JCO.Attributes attr = fdbConnection.getAttributes() and if I return any aatribute such as attr.getClient() the I am able to show this in JSP. That means connection to SAP system is established as I am able to print connection attributes.

But while getting the functionTemplate

<b>JCO.Function testBAPI = repository.getFunctionTemplate("ZBAPI").getFunction();</b>

this line from my code throws an error.

This is the default trace that i got

<b>Processing HTTP request to servlet [jsp] finished with error. The error is: java.lang.NullPointerException

at com.abc.cde.service.test.SiteAccess.getdata(SiteAccess.java:51)

at jsp_site1187811520390._jspService(jsp_site1187811520390.java:11)

at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

</b>

Please Help me ASAP this is really urgent.

Dont worry about points

cheers

jayant

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

And just in case the developer has missed it, make sure the BAPI is RFC-Enabled! I've missed this so many times when developing BAPI's and spent ages tracing through my Java only to realise I've forgottton to enable it!

Gareth.

former_member182372
Active Contributor
0 Kudos

Does ZBAPI exist in backend system and user has authorization for it?

Former Member
0 Kudos

Hi,

The user id and password that I am using for JCO connection is of developer who created ZBAPI. How to test whethere ZBAPI is there in the backend or not?

And what type of Authorizations are needed for accessing ZBAPI? Even if I try to acess standard BAPI it's giving me same error. This user id don't have authorization for transaction sm59 in SAP system.

cheers

jayant

former_member182294
Active Contributor
0 Kudos

Jayant,

With same user login to R/3 using logon pad and try to execute the BAPI using transaction SE37. If you do not have authorization to execute it, then contact your BASIS. Here you can check if ZBAPI is available or not.

Regards

Abhilash