Skip to Content
0
Mar 08, 2006 at 11:53 AM

Table Navigation Error in TableView

11 Views

Hi

I am getting an error while accessing the TableView using JSPDynpage. This error occurs during build time. It is not recognizing the 'this' keyword.

Below is the source code :

package com.training.test;

import javax.resource.cci.MappedRecord;

import javax.resource.cci.RecordFactory;

import com.sap.tc.logging.Event;

import com.sap.tc.logging.FileLog;

import com.sap.tc.logging.Location;

import com.sap.tc.logging.Severity;

import com.sapportals.connector.ConnectorException;

import com.sapportals.connector.connection.IConnection;

import com.sapportals.connector.connection.IConnectionFactory;

import com.sapportals.connector.execution.functions.IInteraction;

import com.sapportals.connector.execution.functions.IInteractionSpec;

import com.sapportals.connector.execution.structures.IRecord;

import com.sapportals.connector.execution.structures.IRecordSet;

import com.sapportals.connector.metadata.functions.IFunction;

import com.sapportals.connector.metadata.functions.IFunctionsMetaData;

import com.sapportals.htmlb.event.TableNavigationEvent;

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

import com.sapportals.portal.htmlb.page.JSPDynPage;

import com.sapportals.portal.htmlb.page.PageProcessorComponent;

import com.sapportals.portal.ivs.cg.ConnectionProperties;

import com.sapportals.portal.ivs.cg.IConnectorGatewayService;

import com.sapportals.portal.ivs.cg.IConnectorService;

import com.sapportals.portal.prt.component.IPortalComponentProfile;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.runtime.PortalRuntime;

public class Display extends PageProcessorComponent {

public DynPage getPage(){

return new DisplayDynPage();

}

public static class DisplayDynPage extends JSPDynPage{

private static Location myLoc =

Location.getLocation("com.training.test.Display");

private TableBean myBean = null;

public void doInitialization(){

IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();

Object o = profile.getValue("myBean");

if(o==null || !(o instanceof TableBean)){

myBean = new TableBean();

profile.putValue("myBean",myBean);

} else {

myBean = (TableBean) o; }

// fill your bean with data here...

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

doJca(request);

}

public void doProcessAfterInput() throws PageException { }

public void doProcessBeforeOutput() throws PageException {

this.setJspName("display.jsp");

}

public void onNavigate(Event event) {

TableNavigationEvent tne = (TableNavigationEvent) event;

this.visibleRow = tne.getFirstVisibleRowAfter();

}

private IConnection getConnection(IPortalComponentRequest request, String alias) throws Exception {

IConnectorGatewayService cgService = (IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);

ConnectionProperties prop = new ConnectionProperties(request.getLocale(),request.getUser());

myLoc.entering("method - murli locale" + request.getLocale());

myLoc.entering("method - bored User" + request.getUser());

return cgService.getConnection("CVNSIDES_47", prop);

}

public void doJca(IPortalComponentRequest request) {

myLoc.setEffectiveSeverity(Severity.PATH);

myLoc.addLog(new FileLog("C:
temp
testOutput.log"));

myLoc.entering("method - murli hello");

IConnectionFactory connectionFactory = null;

IConnection client = null;

String rfm_name = "BAPI_COMPANYCODE_GETLIST";

try {

try {

//pass the request & system alias

//Change the alias to whatever the alias is for your R/3 system

System.out.println("Abt to get connection - murli ");

myLoc.entering("method - murli connecting...........");

client = getConnection(request, "CVNSIDES_47");

} catch (Exception e) {

myLoc.entering("method - murli eror...........");

System.out.println("Couldn't establish a connection with a target system.");

myLoc.entering("Couldn't establish a connection with a target system");

return; }

/* * Start Interaction * */

myLoc.entering("method - murli Final" + client);

IInteraction interaction = client.createInteractionEx();

IInteractionSpec interactionSpec = interaction.getInteractionSpec();

interactionSpec.setPropertyValue("Name", rfm_name);

/* * CCI api only has one datatype: Record * */

RecordFactory recordFactory = interaction.getRecordFactory();

MappedRecord importParams = recordFactory.createMappedRecord("CONTAINER_OF_IMPORT_PARAMS");

IFunctionsMetaData functionsMetaData = client.getFunctionsMetaData();

IFunction function = functionsMetaData.getFunction(rfm_name);

if (function == null) {

System.out.println("Couldn't find " + rfm_name + " in a target system.");

return; }

/* * How to invoke Function modules * */

System.out.println("Invoking... " + function.getName());

MappedRecord exportParams = (MappedRecord) interaction.execute(interactionSpec, importParams);

/* * How to get structure values * */

IRecord exportStructure = (IRecord) exportParams.get("RETURN");

String columnOne = exportStructure.getString("TYPE");

String columnTwo = exportStructure.getString("CODE");

String columnThree = exportStructure.getString("MESSAGE");

System.out.println(" RETURN-TYPE = " + columnOne);

System.out.println(" RETURN-CODE = " + columnTwo);

System.out.println(" RETURN-MESSAGE =" + columnThree);

/* * How to get table values * */

IRecordSet exportTable = (IRecordSet) exportParams.get("COMPANYCODE_LIST");

exportTable.beforeFirst(); // Moves the cursor before the first row.

while (exportTable.next()) {

String column_1 = exportTable.getString("COMP_CODE");

String column_2 = exportTable.getString("COMP_NAME");

System.out.println(" COMPANYCODE_LIST-COMP_CODE = " + column_1);

System.out.println(" COMPANYCODE_LIST-COMP_NAME = " + column_2); }

//create the tableview mode in the bean

myBean.createData(exportTable);

/* * Closing the connection * */

client.close();

} catch (ConnectorException e) {

//app.putValue("error", e);

System.out.println("Caught an exception: \n" + e);

} catch (Exception e) {

System.out.println("Caught an exception: \n" + e);

}

} //doJCA Over

}//DisplayDynPage Over

}

Regards,

Murali