cancel
Showing results for 
Search instead for 
Did you mean: 

JSP initialization and connection to R3 using a link in JSP

Former Member
0 Kudos

Hi all,

I am new to JSP's. I need java scriptlet code for jsp initialization.Also in my jsp page i need to make a link and on clicking, this link should fetch data from the backend R3 system.

Suggest some help.

Pooja Gehani

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I think You need to read something about JCO (JavaConnector) - is java based library thanks to it You can make calls to function modules in R3 system (for example fetch data using some function module). When it comes to jsp please check some tutorials in SDN or Google cause it is difficult to explain You jsp technology in few words.

Below is example of jsp page which connects to R3 System, invoke some function with some parameters, gets return table and save it to file rettab.html.

Remeber to add sapjco.jar to classpath.

Please reward points if it was helpful.


<%@ page import = "com.sap.mw.jco.JCO.*" %>


<HTML>
<head>
</head>
<body>
<%
		JCO.Client mConnection;
		mConnection = JCO.createClient("001","koperski","password",null,
			"127.0.0.1","01");
		JCO.Repository mRepository;
		mRepository = new JCO.Repository("myRep", mConnection);
		try {
			mConnection.connect();
			IFunctionTemplate funcTemplate = 
				mRepository.getFunctionTemplate("someFunction");
			JCO.Function function = funcTemplate.getFunction();
			ParameterList parameterList = function.getImportParameterList();
			parameterList.setValue("0010000000082","someParameter");
                        			JCO.Table retTable = 
			function.execute();	function.getTableParameterList().getTable("SomereturnTab");
			retTable.writeHTML("f:\rettab.html");
                        mConnection.disconnect();
catch (Exception e) {}

%>
</body>
</HTML>