cancel
Showing results for 
Search instead for 
Did you mean: 

Prakash ....send me JCA par file

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Maha just sent you the sample par file

Former Member
0 Kudos

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>

Former Member
0 Kudos

Hi all,

can anyone help why i am getting exception where do need to change the code.

Thanks in advance.

Former Member
0 Kudos

U may post the code..

Regards,

Former Member
0 Kudos

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

Former Member
0 Kudos

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?

Former Member
0 Kudos

Hi Peter,

Thank you very much for your response .I am still getting same error.Some thing mistake in setting the model.

Thanks in advance.

Former Member
0 Kudos

i don think u are goin that far..

coz it never printed .

response.write("connection succesfull");

Mail me, i wud send U my code

sapmails@gmail.com

Regards,

PS: U can say thanx with points too..

Former Member
0 Kudos

Hi Peter,

i sent a mail to you .Please give me a reply .

Thanks,

maha

Former Member
0 Kudos

Hi Peter,

I am really sorry i did not passed

request.getLocale(),request.getUser() properly last time.

When i use these code instead of

user.getLocale(), user

i am getting error in IDE that <b>filed request is not visible.</b>

sorry for bothering you please help its little urgent

thanks

Former Member
0 Kudos

I replied to ur mail,Iam not sure what tht error means...but it cud be some syntax error.

Regards.

Former Member
0 Kudos

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

Former Member
0 Kudos

I changed the RFC name,system alias ,export table in your code still i am getting same error.DO i need to change anything else.Please help me in this case its really urgent.

Thanks in advance

Former Member
0 Kudos

Whatz this error: R/3USER_AUTH_FAILED

May be u don't have sufficient authorizatoins to use the system alias..Iam not sure..

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hey,

How did u get pass that line?was that autorization issue?

K..now the error seems to be in the line

<jsp:useBean id="TableBean" scope="session" class="com.ust.jcatotable.TableBean" />

U Used the id as TableBean and in the htmlb tableview ..u used myBean...Is it true?

CHeck it out!

Regards

Former Member
0 Kudos

Hi Peter,

i didnt done any thing it is displaying successful.i changed the myBean to TableBean but still it is displaying same.It is so wierd displaying again user auth failed.I dont know why?

any one have any idea.....

Thanks peter

Former Member
0 Kudos

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>

Former Member
0 Kudos

Send me your par file..may be i can check ur code.

Regards.

Former Member
0 Kudos

Hi Peter,

i sent par file your id please check it.

Thanks

Former Member
0 Kudos

Maha that error is from RFC, Get authorization to execute the RFC...

Former Member
0 Kudos

Any one please send me the jca example par file.