Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problems trying to retrieve data from R/3 using Java - RecordSetWrapper

Hello everyone!

I am having problems retrieveing a result from r/3 using Connector Framework API. An ABAP consultant has created a ABAP program which returns an employee based on his or her personal number as an input.

<b>When i run the AbstractPortalComponent i get the following:

<u>RS2: com.sapportals.connectors.SAPCFConnector.execution.structures.RecordSetWrapper@24648563</u></b>

My code is as follows:

import java.util.ArrayList;
import java.util.Iterator;

import javax.resource.cci.MappedRecord;
import javax.resource.cci.RecordFactory;

import com.sapportals.connector.connection.IConnection;
import com.sapportals.connector.execution.functions.IInteraction;
import com.sapportals.connector.execution.functions.IInteractionSpec;
import com.sapportals.connector.execution.structures.IRecordSet;
import com.sapportals.connector.execution.structures.IStructureFactory;
import com.sapportals.connector.metadata.functions.IFunction;
import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.runtime.PortalRuntime;

public class Search extends AbstractPortalComponent{
	String sapSystem = "*****";

	public void doContent(IPortalComponentRequest request, IPortalComponentResponse response){

		IConnection con = null;
		ConnectionProperties conprop = null;
		ConnectionProperties cp = null;

			Object connectorService = PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
			IConnectorGatewayService cgService = (IConnectorGatewayService) connectorService;
			cp = new ConnectionProperties(request.getLocale(),request.getUser());
			if(cgService == null){
				response.write("Error in getting Connector Gateway Service <br>");

				con = cgService.getConnection(sapSystem, cp);
				IInteraction ix = con.createInteractionEx();
				IInteractionSpec ixSpec = ix.getInteractionSpec();
				ixSpec.setPropertyValue("Name", "Test_RFC");
				RecordFactory rf = ix.getRecordFactory();
				MappedRecord importParams = rf.createMappedRecord("INPUT");
				IFunction function = con.getFunctionsMetaData().getFunction("Test_RFC");
				IStructureFactory structureFactory = ix.retrieveStructureFactory();
				IRecordSet table = (IRecordSet) structureFactory.getStructure(function.getParameter("I_PA0002").getStructure());
				importParams.put("PERNR", "123456");
				MappedRecord output = (MappedRecord) ix.execute(ixSpec,importParams);
				Object rs = null;
					Object result = output.get("I_PA0002");
					if(result == null){
						rs = new String ("Error");
						response.write("RS1: " +rs+ "<BR>");
						if(result instanceof IRecordSet){
							rs = (IRecordSet) result;
							response.write("RS2: " +rs+ "<BR>");
							response.write("RS3: " +rs+ "<BR>");
				catch(Exception e){
					response.write("Error " + e.getMessage()+ "<BR>");
			catch(Exception e){
				response.write("Connection to SAP system failed <br>");

			if(con == null){
				response.write("Connection is null <br>");
				response.write("Connection succsesful<BR>");
		catch(Exception e){
			response.write("Exception occured<BR>");

			response.write("Connection closed<br>");
		catch(Exception e){
			response.write("Could NOT close connection<BR>");

The result should be all data stored on the person which I search for, but instead i get the following result:


RS2: com.sapportals.connectors.SAPCFConnector.execution.structures.RecordSetWrapper@24648563</b>

I am really stuck and do not know how to solve the problem. I appreciate any help or sample (or just some answers...)

Thanks in Advance.

Best Regards,

Ola Aarthun



From your code you are just displaying the object rs. You have to handle the display of each record the way you want it(as a table).

You can find a sample code how to build a table from the result object at the following link



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question