on 09-20-2005 9:00 PM
Hi Prakash,
Please send me the JCA example par file which u have.its bit urgent.
my mail id maha0012@yahoo.co.in
thanks,
maha
Maha just sent you the sample par file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tegala,
Thank you very much.I changed that par file when i test in portal i am getting below exception
calling R/3about to call R/3USER_AUTH_FAILED Portal Runtime Error
An exception occurred while processing a request for :
iView : <b>pcd:portal_content/ABS_OVR
Component Name : ABS_OVR.Display
Tag tableView attribute model: Cannot access bean property myBean.model in page context.
Exception id: 10:42_21/09/05_0075
See the details for the exception ID in the log file</b>
Hi Peter ,
Here is the code
Bean
package com.ust.jcatotable;
import javax.resource.cci.MappedRecord;
import javax.resource.cci.RecordFactory;
import com.sap.security.api.IUser;
import com.sap.security.api.UMFactory;
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.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.htmlb.table.DefaultTableViewModel;
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.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
public class Display extends PageProcessorComponent {
private DefaultTableViewModel model;
public DynPage getPage(){
return new DisplayDynPage();
}
public void TableBean(){
model = new DefaultTableViewModel();
}
public static class DisplayDynPage extends JSPDynPage{
private TableBean myBean = null;
public void doInitialization(){
IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
//Object o = profile.getValue("myBean");
Object o = profile.getValue("TableBean");
if(o==null || !(o instanceof TableBean)){
myBean = new TableBean();
profile.putValue("myBean",myBean);
//profile.putValue("TableBean",myBean);
} else {
myBean = (TableBean) o;
}
// fill your bean with data here...
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();
response.write("calling R/3");
try {
doJca(request);
} catch (Exception e) {
e.printStackTrace();
response.write(e.getMessage());
}
}
public void doProcessAfterInput() throws PageException {
}
public void doProcessBeforeOutput() throws PageException {
this.setJspName("display.jsp");
}
private IConnection getConnection(String alias) throws Exception {
IUser user =
//UMFactory.getUserFactory().getUserByLogonID("os0487");
UMFactory.getUserFactory().getUserByLogonID("Administrator");
IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();
response.write(user.getName() + user.getLocale());
IConnectorGatewayService cgService =
(IConnectorGatewayService) PortalRuntime
.getRuntimeResources()
.getService(
IConnectorService.KEY);
ConnectionProperties prop =
new ConnectionProperties(user.getLocale(), user);
return cgService.getConnection(alias, prop);
}
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());
return cgService.getConnection(alias, prop);
}
public void doJca(IPortalComponentRequest request) throws Exception {
IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();
response.write("about to call R/3");
IConnectionFactory connectionFactory = null;
IConnection client = null;
String rfm_name = "Y_SS_ABSENCE";
//String rfm_name = "BAPI_ADDREMPUS_GETDETAILEDLIST";
//pass the request & system alias
//Change the alias to whatever the alias is for your R/3 system
//client = getConnection("R3IDES");
client = getConnection("SAP_R3_HumanResources");
response.write("connection succesfull");
/*
Start Interaction
*/
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");
importParams.put("MSS_ESS", "M");
importParams.put("MONTH", "09");
importParams.put("YEAR", "2005");
importParams.put("LEVELS", "0");
IFunctionsMetaData functionsMetaData = client.getFunctionsMetaData();
IFunction function = functionsMetaData.getFunction(rfm_name);
/*
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 columnThree = exportStructure.getString("MESSAGE");
response.write(columnThree);
/*
How to get table values
*/
IRecordSet exportTable = (IRecordSet) exportParams.get("YCAL");
//create the tableview mode in the bean
myBean.createData(exportTable);
/*
Closing the connection
*/
client.close();
}
}
}
Tablebean
package com.ust.jcatotable;
import java.io.Serializable;
import java.util.Vector;
import com.sapportals.connector.execution.structures.IRecordSet;
import com.sapportals.htmlb.table.DefaultTableViewModel;
import com.sapportals.htmlb.table.TableViewModel;
public class TableBean implements Serializable {
public DefaultTableViewModel model;
public TableViewModel getModel() {
return this.model;
}
public void setModel(DefaultTableViewModel model) {
this.model = model;
}
//
public void createData(IRecordSet table) {
// //this is your column names
Vector column = new Vector();
column.addElement("PERNR");
column.addElement("NAME");
column.addElement("ABSDATE");
// column.addElement("PERNO");
//// column.addElement("LAST_NAME");
//// column.addElement("FIRSTNAME");
//
// //all this logic is for the data part.
Vector rVector = new Vector();
try {
table.beforeFirst();
while (table.next()) {
Vector data = new Vector();
data.addElement(table.getString("STREETANDHOUSENO"));
data.addElement(table.getString("SCNDADDRESSLINE"));
data.addElement(table.getString("CITY"));
data.addElement(table.getString("STATE"));
data.addElement(table.getString("POSTALCODECITY"));
data.addElement(table.getString("COUNTRY"));
// //data.addElement(table.getString("MAR_DATE"));
// //data.addElement(table.getString("NO_O_CHLDR"));
// //data.addElement(table.getString("NAME_CON"));
// //data.addElement(table.getString("PERMO"));
// data.addElement(table.getString("TELEPHONENUMBER"));
rVector.addElement(data);
//
//// data.addElement(table.getString("STREETANDHOUSENO"));
//// data.addElement(table.getString("SCNDADDRESSLINE"));
//// data.addElement(table.getString("CITY"));
//// data.addElement(table.getString("STATE"));
//// data.addElement(table.getString("POSTALCODECITY"));
//// data.addElement(table.getString("COUNTRY"));
//// //data.addElement(table.getString("MAR_DATE"));
//// //data.addElement(table.getString("NO_O_CHLDR"));
//// //data.addElement(table.getString("NAME_CON"));
//// //data.addElement(table.getString("PERMO"));
//// data.addElement(table.getString("TELEPHONENUMBER"));
//// rVector.addElement(data);
//
}
} catch (Exception e) {
e.printStackTrace();
}
//this is where you create the model
this.setModel(new DefaultTableViewModel(rVector, column));
}
}
JSP
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="TableBean" scope="session" class="com.ust.jcatotable.TableBean" />
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:tableView
id="myTableView1"
model="myBean.model"
design="ALTERNATING"
headerVisible="true"
footerVisible="true"
fillUpEmptyRows="true"
navigationMode="BYLINE"
selectionMode="MULTISELECT"
headerText="TableView example 1"
onNavigate="myOnNavigate"
visibleFirstRow="1"
visibleRowCount="30"
width="500 px"
/>
</hbj:form>
</hbj:page>
</hbj:content>
portal.xml
<?xml version="1.0" encoding="UTF-8"?>
<application>
<application-config>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.ivs.connectorservice"/>
<property name="ServicesReference" value="com.ust.ess"/>
</application-config>
<components>
<component name="Display">
<component-config>
<property name="ClassName" value="com.ust.jcatotable.Display"/>
<property name="SecurityZone" value="com.ust.jcatotable.Display/low_safety"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
</components>
<services/>
</application>
Thanks inn advance
Try this before v can go further:
private IConnection getConnection(String alias) throws Exception {
IUser user =
//UMFactory.getUserFactory().getUserByLogonID("os0487");
UMFactory.getUserFactory().getUserByLogonID("Administrator");
IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();
response.write(user.getName() + user.getLocale());
IConnectorGatewayService cgService =
(IConnectorGatewayService) PortalRuntime
.getRuntimeResources()
.getService(
IConnectorService.KEY);
ConnectionProperties prop =
new ConnectionProperties(user.getLocale(), user);
return cgService.getConnection(alias, prop);
}
Instead of passing user.getLocale() and user..
pass request.getLocale(),request.getUser()
and see what it says..
where this line R3USER_AUTH_FAILED is coming from?
Hi Peter,
I am getting same error with ur code too
calling R/3about to call R/3USER_AUTH_FAILED Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/ABSRPT_DEV
Component Name : ABSRPT_DEV.Display
Tag tableView attribute model: Cannot access bean property myBean.model in page context.
Exception id: 12:25_21/09/05_0088
See the details for the exception ID in the log file
Thanks
Hi Peter,
at last i am getting connection is successful but i have same tableview model error below is the log
<b>calling R/3about to call R/3connection succesfullnull Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/com.na.ko.com.Absence/com.na.ko.com.absrpt_dev
Component Name : ABSRPT_DEV.Display
Tag tableView attribute model: Cannot access bean property myBean.model in page context.
Exception id: 02:28_22/09/05_0119
See the details for the exception ID in the log file</b>
Does anyone have any idea?
thanks in advance
regards,
Harish.
Hi Peter,
connection was successful Cannot access bean property myBean.model in page context was still not resolved.
<b>calling R/3about to call R/3connection succesfullnull Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/com.na.ko.com.Absence/com.na.ko.com.absrpt
Component Name : ABSRPT_DEV.Display
Tag tableView attribute model: Cannot access bean property myBean.model in page context.
Exception id: 03:24_22/09/05_0130
See the details for the exception ID in the log file</b>
Any one please send me the jca example par file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.