Calling the function NUMBER_GET_NEXT from an XI User Defined Function
Hi there,
A number range object has been created on our XI server, called, ZBC_BKSTMT.
I need to call the function NUMBER_GET_NEXT (standard SAP function for number range objects) with the parameters:
NR_RANGE_NR = 01
OBJECT = ZBC_BKSTMT
Calling the NUMBER_GET_NEXT function will return a unique integer. However, i need to call it from a User Defined Function because I need to make use of the returned integer in my message mapping.
Thanks,
Hello,
If you have SP13, SAP provides a RFC API which can be called during the mapping. Refer to this document:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/xi%20mapping%20lookups%20rfc%20api.pdf
Also check this weblog :
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
For pre-SP13 systems, refer to this How-To
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20perform%20sap%20data%20lookups%20within%20xi%20mappings
***************Reward points,if found useful
Similar Messages
-
How can I use Seeburger java functions on SAP XI's user defined functions?
Hi All,
As my title implies; how can I use Seeburger java functions on SAP XI's user defined functions? I've tried searching over the net in tutorials regarding this topic but I failed to find one; can someone provide me information regarding my question? thanks very much.
best regards,
MikeHi Mike !
You should check your documentation about which java classes you need to reference in the "import" section of your UDF. And also deploy the java classes into the java stack or include them as a imported archive in integration repository...it should be stated in the seeburger documentation.
What kind of functions are you trying to use?
Regards,
Matias. -
Calling ORACLE Store Procedure with parameters in user define function
Hi everybody,
We have a scenario connecting Oracle DB thru JDBC adapter.
We have to call store procedure with input parameter and output parameter to retrieve data from DB. The implementation was made using JDBC adapter by building the correct XML message with EXECUTE action, and it works fine.
Now we need to use DB lookup within mapping. I wrote users define function with SELECT statement (using the JDBC adapter) and it works fine but I need to call store procedure in ORACLE instead of SELECT statement.
I found lot of examples concerning DB lookup but none of them explained how to write UDF calling store procedure in ORACLE with input and output parameters.
I am looking for an example.
Thanks in advance,
GigiI agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
If you think you are going to get existing MS Stored Procedures or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
You could use the EF backdoor, call Oracle Command object and use the Packages, if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
That's about your best shot.
http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx -
Can we call proxy communication channel of type XI in user defined function
HI ,
can any body tell whether we call proxy communication (type xi) in an user defined function
regards
sandeepHi,
The Proxy is an abap coding only.
Hence it can be called from anywhere in R/3 region.
But we need to ensure that the SPROXY settings and proper linking between XI & R/3 are established.
I think, we can get more clarity on this from the Netweaver forum rather in R/3 ABAP.
Regards,
Ramani N -
How to Use Sequence Object Inside User-defined Function In SQL Server
I'm trying to call sequence object inside SQL Server user-defined function. I used
Next Value for dbo.mySequence to call the next value for my sequence created. But I'm getting an error like below.
"NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables."
Is there any standard way to call sequence inside a function?
I would really appreciate your response.
Thanks!The NEXT
VALUE FOR function cannot be used for User Defined function. It's one of the limitation.
https://msdn.microsoft.com/en-us/library/ff878370.aspx
What are you trying to do? Can you give us an example and required output?
--Prashanth -
How to use StreamTransformationException in user-defined function?
Hi,
I'm doing a DBLookup (using Java pgm in one of my Imported Java archives) for populating one of the fields in message mapping. If the DB connection fails, I want to terminate the mapping by throwing a StreamTransformationException from within a user-defined function.
I require urgent help in this regard.
Thanks in advance.
Regards,
Sridhar Rajan NHi,
I had the same problem. I failed to find the way how to throw a StreamTransformationException in my user-defined function. But I used another exception: NullPointerException. Yes, I know, this is not an elegant solution...
Best regards,
Andrzej Filusz -
Message Mapping (user-defined function)
Hi all,
Is there anyway to determine the XML message ID using an user-defined function in Message Mapping? When I go to SXI_MONITOR I see that all messages have an unique ID, but I'm having some difficulties to understand if there is any way to get that ID in a message mapping and pass it to a target structure? I see that it is possible to use constants like "Sender" and "Receiver", but I haven't found anything for the message ID.
Can you please help me?
Thanks in advance.
Regards,
Ricardo InácioTry this code..
Create an UDF and do not pass any arguments to it..
java.util.Map map;
// get runtime constant map
map = container.getTransformationParameters();
// get value of header field by using variable key
String msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
return msgid;
Now map this udf to your target field. Now test it....
P.s. Since message id is run time property therefore in mapping test tab it will not work. Try it at runtime.
Regards,
Sarvesh -
How to check empty idoc fields in user defined function
Dear All,
I am working on an IDOC to file scenario. In my user defined function, I want to check whether a particular field of the idoc is populated. I can perform this test in message mapping by comparing the field with an empty constant.
How can I do the same test in an advanced user defined function? I have tried all the following, but none has worked so far
If (a.length == 0) .
If (a[0].length == 0)
If (a[0] == )
If (a[0] == )
Am I doing something wrong?
Thx/FarshadTo check whether an element is not available:
if (a.length == 0)
but you have to set cache to context. If you set cache to queue, it will not work, as in this case the context changes are part of the array a.
To check whether an element is empty:
if (a[0].equals(""))
Regards
Stefan
Message was edited by: Stefan Grube
Message was edited by: Stefan Grube -
Determine Element maxLenght in User-Defined Function
Hi,
I have the problem, that I have to fill up several fields with leading 0. I wrote a User-Defined Function for this. But the function doesn't know how long this element is, so I have to give the function the length of the element.
Is it possible to determine the length of the current element in an extended User-Defined Function
Yours
ThomasHi,
>use a simple user defined function with the desired
>source element as input and give the following code...
>int k = a.length();
>String len = Integer.toString(k);
>return len;
That function will only give me the actual lenght of the input element, what I need is the max lenght of the target element...
>You can also use the built-in FormatNumber function to
>insert leading 0s.
How can I use this function to add leading zeros?
"'000'#" ? But there I have to do this for every element
>I think an easy solution for this is, just have a
>simple function with two arguments. The first is the
>element, the second is a constant, where you put the
>length.
Well I have this function. But I am looking for way to the safe the second argument ;o)
Thank you all for your help
Thomas -
Access to whole payload in user defined function
Hi,
is there a way to access the whole XML payload in a user defined function or is it necessary to employ a Java mapping?
Kind regards,
HeikoHi,
did you have a look at this weblog:
Own Logging of XI Messages
/people/udo.martens/blog/2006/02/16/own-logging-of-xi-messages
by Udo Martens?
it's a complete solution to your issue
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Calling PL/SQL user defined functions from ODI Constraints
Hi All,
We are trying to call user defined PL/SQL functions from ODI. We are able to call them from ODI's User functions. But when we are trying to call them from ODI Constraints under Models, it is throwing an error 'ORA-00920 invalid relational operator'. Kindly let me know if anyone has faced the same issue and got the resolution for the same. Thanks in Advance.
Regards,
Abhishek SharmaHi Ace,
Thanks for the response, the same error was coming in operator also.
I am able to call PL?SQL user defined functions from ODI Constraints. We have to first call ODI User functions from the ODI constraints as we cant call PL/SQL function (compiled in database) directly.
From the ODI User functions, we can then call the PL/SQL functions.
Please reach out to me if you need further details reg this. -
How to distinguish the User-Defined-Function from Oracle Build-In function
Hi Friends,
I could get the function list form all_objects table by the SQL:
select * from all_objects where object_type = 'FUNCTION'
but there is no column in all_objects specify the function is build-in or user-defined.
But I found in SQL Server there is a column "is_ms_shipped" in the sys.all_objects table. This column will specify the object is build-in or user-defined. I want to get the equivalent column in Oracle but failed.
Could anyone tell me how to solve this problem?
Thanks,
RickyThanks Pavan.
But if an user connects to database using "conn /as sysdba" syntax and creates a function. This user-defined funtion goes into the "SYS" schema also. I know it is not the best practise to create objects using sys user so I think your solution is right.
Regards,
Ricky -
How to resolve the error while using user defined function.
EPN Assembly file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:wlevs="http://www.bea.com/ns/wlevs/spring"
xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.bea.com/ns/wlevs/spring
http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
http://www.oracle.com/ns/ocep/jdbc
http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
http://www.oracle.com/ns/ocep/spatial
http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
<wlevs:event-type-repository>
<wlevs:event-type type-name="TestEvent">
<wlevs:class>com.bea.wlevs.event.example.FunctionCEP.TestEvent</wlevs:class>
</wlevs:event-type>
</wlevs:event-type-repository>
<wlevs:adapter id="InputAdapter"
class="com.bea.wlevs.adapter.example.FunctionCEP.InputAdapter">
<wlevs:listener ref="inputStream" />
</wlevs:adapter>
<wlevs:channel id="inputStream" event-type="TestEvent">
<wlevs:listener ref="processor" />
</wlevs:channel>
<wlevs:processor id="processor">
<wlevs:listener ref="outputStream" />
<wlevs:function function-name="sum_fxn" exec-method="execute">
<bean>com.bea.wlevs.example.FunctionCEP.TestFunction</bean>
</wlevs:function>
</wlevs:processor>
<wlevs:channel id="outputStream" event-type="TestEvent">
<wlevs:listener ref="bean" />
</wlevs:channel>
<bean id="bean" class="com.bea.wlevs.example.FunctionCEP.OutputBean">
</bean>
</beans>
Event class
package com.bea.wlevs.event.example.FunctionCEP;
public class TestEvent {
private int num_1;
private int num_2;
private int sum_num;
public int getSum_num() {
return sum_num;
public void setSum_num(int sumNum) {
sum_num = sumNum;
public int getNum_1() {
return num_1;
public void setNum_1(int num_1) {
this.num_1 = num_1;
public int getNum_2() {
return num_2;
public void setNum_2(int num_2) {
this.num_2 = num_2;
Adapter class
package com.bea.wlevs.adapter.example.FunctionCEP;
import com.bea.wlevs.ede.api.RunnableBean;
import com.bea.wlevs.ede.api.StreamSender;
import com.bea.wlevs.ede.api.StreamSource;
import com.bea.wlevs.event.example.FunctionCEP.TestEvent;
public class InputAdapter implements RunnableBean, StreamSource {
private StreamSender eventSender;
public InputAdapter() {
super();
public void run() {
generateMessage();
private void generateMessage() {
TestEvent event = new TestEvent();
event.setNum_1(10);
event.setNum_2(20);
eventSender.sendInsertEvent(event);
public void setEventSender(StreamSender sender) {
eventSender = sender;
public synchronized void suspend() {
Output Bean class
package com.bea.wlevs.example.FunctionCEP;
import com.bea.wlevs.ede.api.StreamSink;
import com.bea.wlevs.event.example.FunctionCEP.TestEvent;
import com.bea.wlevs.util.Service;
public class OutputBean implements StreamSink {
public void onInsertEvent(Object event) {
System.out.println("In Output Bean");
TestEvent event1 = new TestEvent();
System.out.println("Num_1 is :: " + event1.getNum_1());
System.out.println("Num_2 is :: " +event1.getNum_2());
System.out.println("Sum of the numbers is :: " +event1.getSum_num());
Function Class
package com.bea.wlevs.example.FunctionCEP;
public class TestFunction {
public Object execute(int num_1, int num_2)
return (num_1 + num_2);
config.xml file
<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
<processor>
<name>processor</name>
<rules>
<view id="v1" schema="num_1 num_2">
<![CDATA[
select num_1, num_2 from inputStream
]]>
</view>
<view id="v2" schema="num_1 num_2">
<![CDATA[
select sum_fxn(num_1,num_2), num_2 from inputStream // I am getting error when i am trying to call this function
]]>
</view>
<query id="q1">
<![CDATA[
select from v2[now] as num_2* // Showing error while accessing the view also ]]>
</query>
</rules>
</processor>
</wlevs:config>
Error I am getting is :
Invalid statement: "select >>sum_fxn<<(num_1,num_2),age from inputStream"
Description: Invalid call to function or constructor: sum_fxn
Cause: Probable causes are: Function name sum_fxn(int,int) provided is invalid, or arguments are of
the wrong type., or Error while handling member access to complex type. Constructor sum_fxn of type
sum_fxn not found. or Probable causes are: Function name sum_fxn(int,int) provided is invalid, or
arguments are of the wrong type., or Error while handling member access to complex type.
Constructor sum_fxn of type sum_fxn not found.
Action: Verify function or constructor for complex type exists, is not ambiguous, and has the correct
number of parameters.
I have made a user defined function in a java class and configured this function in the EPN assembly file under the processor tag.
But when i am trying to access the function in the config.xml file , it is giving me an error in the query.
Please provide urgent help that how to write the exact query.Hi,
In the EPN Assembly file use
<bean class="com.bea.wlevs.example.FunctionCEP.TestFunction"/>
instead of
<bean>com.bea.wlevs.example.FunctionCEP.TestFunction</bean>
Best Regards,
Sandeep -
Calling user defined function in Oracle BI Answers?
Hi
I am new in Oracle BI . I want to use the user defined function in Oracle BI Answers as a column,function written in Oracle database to calculate the Sales Revenue.
I am using Oracle BI Standard Edition One and Oracle 10g database.
Please suggest me.
Thanks
NusratSearch for EVALUATE function you can call function and pass parameters
Example:
EVALUATE Function
This function is intended for scalar and analytic
calculations.
Syntax: EVALUATE('DB_Function(%1)', {
Comma separated Expression})
Example: SELECT
e.lastname,sales.revenue,EVALUATE('dense_rank()
over(order by %1
)',sales.revenue) FROM sales s, employee e; -
How 2 Develope user defined functions to call function modules in R/3 syst
How to Develope user defined functions to call function modules in SAP R/3 system....in xi
HIi,
If those function modules are RFC enabled then we can call those function module from user defined functions. Please see below link
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Reward points if helpful.
Thanks,
Vijay Kumar T,
Maybe you are looking for
-
SIGNING problem in soap receiver adapter
Dear Friends, I am sending the file to soap adapter , it reaching to reciever system but I SIGNING is not happening. sender side file adapter receiver side soap adapter sender side ok , reciever side also ok but only the problem is SIGNING. receiver
-
Messenger Invite keeps returning even after delete
Hi, Problem regarding BBM. A friend of mine added me as a contact and we chatted with no problem. He added me using my email address. A few hours later I got an "invite request" from him again, even through he was already my contact so I accepted it
-
How to speed up the loading of live data into flash file.
How to speed up the loading of live data into flash file if the swf file size is 1.5 MB. Flash file is using 20 web service connections to load the live data.
-
Active Directory - Open Directory Magic Triangle
I have a 10.5.5 server that I am trying to bind to our AD so I can provide SSO to our Mac users. I start from a Standalone installation and Bind to AD through the Directory Utility without issue. The servers computer record is created in AD. However
-
Password protection of an email attachment
Hi, I need to pass an attachement (any format) with an email and ensure that the user will be prompted for a password when he tries to open it and only if it matches with a previously saved pwd, should he be allowed to open the document. Since this v