cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a Stored Procudre from UDF by passing parameters

Former Member
0 Kudos

Hi All,

In UDF I need to call a stored procedure by

example:

Channel channel = null;

Map rowMap = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

String Query = null;

//Query ="EXECUTE dbo.sp_flow <INTID> <USERID>;

Query = "EXECUTE dbo.sp_flow \'304\' , \'shankar\' " ;

try{

//Determine a channel, as created in the Configuration

channel =

LookupService.getChanne"BS_XXX","CC_XXX_JDBC_Rcv");

//Get a system accessor for the channel. As the call is being made to an

DB, an DatabaseAccessor is obtained.

accessor = LookupService.getDataBaseAccessor(channel);

//Execute Query and get the values in resultset

resultSet = accessor.execute(Query);

for(Iterator rows = resultSet.getRows();rows.hasNext();){

rowMap = (Map)rows.next();

result.addValue((String)rowMap.get("FLOW_ID"));

}

Suggest me how to statement Query=Query = "EXECUTE dbo.sp_flow \'304\' , \'shankar\' " ; is correct or not !!

Regards

Shankar

Accepted Solutions (0)

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

the DataBaseAccessor will not be able to execute a stored procedure

there is a workaround ( /people/arpil.gupta/blog/2008/11/03/workaround-for-jdbc-scenarios ) but not recommended

Former Member
0 Kudos

why DataBaseAccessor will not be able to execute a stored procedure? Can you expain in brief?

Can I use the code which you have given in blog. I am case I just need to call the SP and get the data.

You said this is not recomended but if I use this what all problem I get in real time.

Please explain

Thanks

Shankar

Former Member
0 Kudos

Hi Shabarish Vijay... ,

I am able to call a one Stored Proc which I am able to return the resultset. But for my senario I am able to call the Stored Proc by passing the parameter like userid and password. But I am getting a exception below.

<access>

<INT_FLOW_ID><![CDATA[Exception during processing the payload. Error when calling an adapter by using the communication channel CC_XXXXX_JDBC_Rcv (Party: , Service: BS_MICROSOFT_SQLXXXX_D, Object ID: 7c072037b7ac3bf0b698f3493ec73024) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error processing request in sax parser: Error when executing statement for table/stored proc. 'table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'.

com.sap.aii.mapping.lookup.LookupException: Error when calling an adapter by using the communication channel CC_XXXJDBC_Rcv (Party: , Service: BS_MICROSOFT_SQLXXXX_D, Object ID: 7c072037b7ac3bf0b698f3493ec73024) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error processing request in sax parser: Error when executing statement for table/stored proc. 'table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'.

at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:127)

at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:76)

at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:148)

at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:76)

(Processor.java:222)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)

]]></INT_FLOW_ID>

Can you pls help me out any solution to solve this.

Regards

Shankar