Container in advanced UDF
Hi,
could you please tell me the use of Container in advanced UDF ?? Preferrably with examples
thanks
kumar
Kumar,
Refer below links it will be more helpful.
http://help.sap.com/saphelp_nw70/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm
Best Regards,
raj.
Similar Messages
-
Hi
I have wrote a below Advanced UDF (using context). But I want to return string array "temp" through "result". My below code throug error as last "result" statement is wrong. If anybody knows how to define this statement could you plz help me out ?? Any help in this regard is highly appreciated.
String[ ] temp = new String[1000000000];
for (int i = 0; i < a.length; i++) {
if ((Integer.parseInt(a<i>) == 11) || (Integer.parseInt(a<i>) == 12) || (Integer.parseInt(b<i>) == 4)) {
temp<i> = "1";
temp<i> = "0";
// String temp1 = Arrays.toString(temp).
result = (temp [ ]);
Thanks in advance
kumarIf you need to output the value of 'temp',then you can try this code : -
String temp = null;
for (int i = 0; i < a.length; i++) {
if ((Integer.parseInt(a) == 11) || (Integer.parseInt(a) == 12) || (Integer.parseInt(b) == 4))
temp = "1";
result.addValue(temp);
else
temp = "0";
result.addValue(temp);
Regards
Priyanka -
How to read container variable in UDF
Hello expert,
I have created a container variable(var_callerId) in an integrationprocess.
In a mapping I want to read the container variable with an UDF.
Can anyone send me the code for the UDF please ?
I can't find the solution in any post message / blog.
Thx for your help!
Best regards,
JuergenHi navneet,
thanks for your fast reply.
Let me explain why I wanted to use container variables:
(Perhaps there is a better way to fix the requirement)
I've following IP
Message Interface (input)
<getData>
<callerInfo>
<callerID>SYSA</callerID>
<SessionID>43545455545355</SessionID>
<number>3434344334</number>
</callerInfo>
</getData>
Then I have a mapping (<number>) to call a webservice.
I get the data from the webservice.
At last I will send the data back to the business System.
But I need the both tags from the input interface (SessionID, callerID) again, to send it back.
I tried a mapping to map sessionID and callerID from the input interface to the output interface, but it doesn't work.
So I thought I can store the sessionID and callerID in a container variable and in a mapping I will get it back with an UDF.
I think there should be a possiblility to get the stored value from the container variable inside the IP. But I don't find any solution.
I don't understand your solution with the global container. How can I access to the container variable(IP).
Thx for your help
Best regards
Juergen -
Alert container element in UDF
Along with the BPM container element there is the containar element and specific variables maintained in ALERTCATDEF also while declearing the Alert, is it possible to access these variables in UDF.
Hi,
Kidly refer to the Divya's thread for the alert related container variables. Also you can go through this:
http://help.sap.com/saphelp_nw04/helpdata/en/80/942f3ffed33d67e10000000a114084/frameset.htm
Regards,
Sanjeev. -
Hi all,
this is a file to idoc scenario.there are 2 parameters that may required to be passed to below udf.
taxamt,dtl
taxamt is a fieldname,dtl is rootnode which has about 15 fields.
int i = 0;
for ( int j = 0; j < b.length ; j ++)
if (b[j].equals(ResultList.CC))
{ result.addContextChange(); i = i + 2; }
else{
if (a<i>.equals("000000000"))
result.addValue("U0");
// else if (a<i>.equals(ResultList.CC)){}
else
result.addValue("U1");
taxamt----
dtl----
UDF tax_code
r1
r2
r15
the problem i am facing is that there are about 11 line items in my fileeg U1,U2......U11.
all these elements must be sent to the receiver Idoc.I could able to receive only 1 line item.
Please correct my code so that I can receive all the line items..
Thanks,
SrinivasaHi,
did you check the occurrance of the line item in target idoc structure? if it is 1:1 then change it to 1: unbound...
it shd work...
Karna,,, -
Difference between Simple and Advance UDF
Hi,
Could you please help me what is the Defference between Simple and Advanced User Defined Functions.
Thanks and Regards,
Nag.Hi Nag,
Here is the Information for your request as follows.
<u>1. Simple UserDefined Function:</u>
Simple functions, which can process individual field input values for each function call. Simple functions, therefore, expect strings as input values and return a string.
<u>2. Advanced User Defined Function:</u>
Advanced functions, which can process nonsingle string field input values for each function call. You can pass either all field values of a context or the whole queue for the field in an array when calling the function. Each input field is passed as an array of String. Returned values are stored in a String array, ResultList.
Cheers,
AshokKumar. -
Advance UDF --- Remove Context
Hi all
I want to use RemoveContext function in UDF ...as this will be based on few conditiond.
Hence i can not use the standard removeContext node function..
can any one tell me the code for doing the same..
Sheetalyou can have a remove context functionality outside the UDF itself.
Right click the source field and change the context from the parent node to the top(root) node to remove all contexts.
Note: you can indeed ADD context etc in a UDF - http://help.sap.com/saphelp_nw04/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm -
Hi,
I am very much confused when to use UDF's and when to use XSLT etc. Please make me to understand with good examples.HI,
UDF's are user defined functions are of two types,simple UDF which takes in one input and gives out one output and the second one is advanced UDF where in u can access more than one fields,and the result is passed on to ResultList.
UDF can be used in graphical mapping depends upon the requirement.
1) If u wanted to do manuplication in data which can not be done by using the standared XI function that time we go for UDF.
2) For doing Lookup we write the code in UDF and pass the value to R3 system.
3) If u need to compare the input value and pass the other value based on comparision that time can go for UDF.
There are many different requirement for which we can go ahead with UDF.
What is XSLT:
XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.
It can be used to transform
XML to XML - From one XML data format to another
XML to Text
XML to HTML/XHTML
XML to PDF
A few example cases in which an XSLT mapping can be used:-
 When the required output is other than XML like Text, Html or XHTML (html displayed as XML )
 When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
 When data is to be filtered based on certain fields (considering File as source)
 When data is to be sorted based on certain field (considering File as source)
 When data is to be grouped based on certain field (considering File as source).
Advantages of using XSLT mapping
 XSLT program itself defines its own target structure.
 XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
 XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
 File content conversion at receiver side can be avoided in case of text or html output.
 Multiple occurrences of node within tree (source XML) can be handled easily.
 XSLT can be used in combination with graphical mapping.
 Multi-mapping is also possible using xslt.
 XSLT can be used with ABAP and JAVA Extensions.
But at the same XSLT has the disadvantages also.
Thnx
Chirag -
Issues in P6v7 saving layouts with UDF's and Filters
In P6v7 have created series of layouts which contain columns for UDF's and Layout Filters based on selecting green form Indicator type UDF's
The project activities have entries in the UDF's eg the UDF fields have entries for most but not all of activities.
When exporting the layouts as .plf files and importing into another version of P6v7 the UDF's come in correctly however the columns are missing from the spreadsheet.
Also when importing the layout filter criteria doesn't come across correctly - or at all.
Is this a bug or at the least a known issue.
Any help welcomed.If you don`t already yuse the xfl file format instead of the fla, try this.
If possible dont use network drives for saving. -
Hi,
I'm starting with UDF functions.
How can i split source string at '-' and take first part into target.
ex : 123-456 -> 123
Easy points for those who know...
Thanks in advance,
Laurent.Hi Laurent,
Use an Advanced User Defined Function. Adavnced user Defined Functions can return Multiple values.
UDF1:
1.Takes renmark as input.
2.Does the split on the basis of ;
3. Splits each split of step 2 on the basis of /
4. Add the output of step 3 to the resultlist with a context change.
UDF2:
1.Takes renmark as input.
2.Does the split on the basis of ;
3. Splits each split of step 2 on the basis of /
4. Add the output of step 3 to the resultlist with a context change.
For Advanced UDF's,
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm.
You can try this piece of code in your mapping...
You need 3 UDFs each for <detail>, <field1>,<field2>
UDF1: For <detail>
String arr[] = a[0].split(";");
for (int i=0;i<arr.length;i++)
result.addValue(arr);
UDF2: For ><field1>
String str = a[0];
String str1 = null;
String sarr1[] = str.split(";");
for (int i=0; i<sarr1.length;i++)
str1 = sarr1;
String sarr2[] = str1.split("/");
for (int j=0; j><sarr2.length;j++){
result.addValue(sarr2[j]);
j++;
result.addContextChange();
UDF2: For ><field2>
String str = a[0];
String str1 = null;
String sarr1[] = str.split(";");
for (int i=0; i<sarr1.length;i++)
str1 = sarr1;
String sarr2[] = str1.split("/");
for (int j=0; j><sarr2.length;j++){
j++;
result.addValue(sarr2[j]);
result.addContextChange();
..All these functions requires one input <remark>
Hope this helps you ..
*Reward with points if helpful*
Regards,
Shibani -
Needed UDF in Shabarish Vijayakumar's weblog
Hi,
In the Shabarish Vijayakumar's weblog
/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers
1. I need code for the following UDFs
ChkSum and AnyError
and
2. how Constant (RDFILE) can be created ?
Thanks,
ss
Message was edited by:
s sHi Mudit,
I tried the code as advanced UDF but it gave me
<b><u>Source code has syntax error:</u></b>
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:86: cannot resolve symbol symbol : variable amount location: class com.sap.xi.tf._RD_MM_ for(int i=0;i<amount.length;i++) ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:88: cannot resolve symbol symbol : variable amount location: class com.sap.xi.tf._RD_MM_ totAmount=totAmount+Integer.parseInt(amount); ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:90: cannot resolve symbol symbol : variable sum location: class com.sap.xi.tf._RD_MM_ if(totAmount==Integer.parseInt(sum[0])) ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:97: cannot resolve symbol symbol : variable Input1 location: class com.sap.xi.tf._RD_MM_ if(Input1.equals("true") && Input2.equals("0")) ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:97: cannot resolve symbol symbol : variable Input2 location: class com.sap.xi.tf._RD_MM_ if(Input1.equals("true") && Input2.equals("0")) ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:98: cannot return a value from method whose result type is void return "0"; ^
C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:100: cannot return a value from method whose result type is void return "1";
what went wrong ?
Thanks,ss -
Advanced Mapping question.
All,
we have 2 input messages, that need to be mapped into the output message.
<source1>
<response><id>1</id><cat>prodid</cat><value>PRD01</value></response>
<response><id>1</id><cat>name</cat><value>Name01</value></response>
<response><id>1</id><cat>price</cat><value>20.00</value></response>
<response><id>2</id><cat>prodid</cat><value>PRD02</value></response>
<response><id>2</id><cat>name</cat><value>Name02</value></response>
<response><id>2</id><cat>price</cat><value>30.00</value></response>
</source1>
<source2>
<product><id>1</id><prodid></prodid><isbn>isbn1</isbn><name></name><price></price></product>
<product><id>1</id><<prodid></prodid><isbn>isbn2</isbn><name></name><price></price></product>
</source2>
The target is exactly similar to source2 message. But the values of the nodes <prodid>, <name>, <price> needs to be populated from source1 message by matching the <id> and node name.
<target>
<product><prodid>PRD01</prodid><isbn>isbn1</isbn><name>Name01</name><price>20.00</price></product>
<product><prodid>PRD02</prodid><isbn>isbn2</isbn><name>Name02</name><price>30.00</price></product>
</target>
How can we do this using Advanced UDF?
ThanksCheck the following SAP Help link. It has a similar example.
http://help.sap.com/saphelp_nw04/helpdata/en/d9/cea942ad920c31e10000000a1550b0/frameset.htm
Thanks. -
Advanced User Defined Function
Dear All,
I have a target structure as follows:
<Item>
<Record10>
<RecordType>
<BankCode>
<AccountID>
<Amount>
</Record10>
<Record50>
<RecordType>
<Segment1>
<segment2>
<segment3>
</Record50>
</Item>
I want to fill the elements in the Record50 in a special way by using some logic. Sometimes I may have to create multiple Record50 structures. So I'm using an advanced user defined function to do this.
My mapping is as follows:
Source Structure -> myFunction()->Record50
And in myFunction() I wrote the following piece of code:
result.addValue("50");
result.addValue("PayRef1");
result.addValue("Address");
result.addValue("Nil");
I expect the output to be:
<Record50>
<RecordType>50</RecordType>
<Segment1>PayRef1</Segment1>
<segment2>Address</segment2>
<segment3>Nil</segment3>
</Record50>
But the output is like this:
<Record50>50</<Record50>
<Record50>PayRef1</<Record50>
<Record50>Address</<Record50>
<Record50>Nil</<Record50>
Can somebody tell me how to proceed? I tried to insert a context change in the beginning, but then the Record50 itself is not appearing.
Thanks,
SandeepHi,
Advanced UDF will not create you like you expected.
You need to do like this
Source>myFunction1()-><RecordType>
And in myFunction() you do code:
result.addValue("50");
Source>myFunction2()-><Segment1>
And in myFunction2() you do code:
result.addValue("PayRef1");
so on..
Thanks,
Prakash -
UDF: how to find out the context in in-queue has been changed? (java)
Hi,
does anybody know?
Is there som function for this? Because I have a inbound queue with 2 separate contexts, let's say:
A
B
C->changes context
X
Y
Z-?changes context
Let's say I need to return first values in each context. how to do that in UDF?
Thank you,
Olian
Edited by: Olian Saludew on Aug 12, 2008 7:11 PMHi,
Create the Advanced UDF as below
While creating the UDF select the Cache parameter as Context
Then just use below code.
here a---> Source field
result.addValue(a[0]);
This will always take only 1st value of queue.
Thanks
swarup -
Not able to see UDFs created in Pricelist
Hi all,
I have created 2 separate UDF one in Pricelist and second in pricelist row level.
Now when I tried to open pricelist window within Inventory I am not able to see the UDF window.
Please note I have already checked View UDF in main menu
Thanking in advanceA UDF can only be created at Pricelist level. When you create a UDF in Master Data > Price List you can see this UDF as a column when you open Inventory > Price lists (perhaps after Group drop down)
Please click on Form Setting when you are on the Price Lists window and see if Visible and Active is checked
Maybe you are looking for
-
Material document ,quantity and stock location for a given material
hello all, i have a requirement like this. in the selection screen i have, material..... plant.... posting document date..... i need to get material document number,quantity,units and stock location for the above mentioned selection criteria... what
-
We have a sales tool that we have created for one of our clients in iBooks Author. They need the iBook creating in various languages. We need to be able to supply the multiple versions of the same document (in the different languages) to our client a
-
Mystery - One scripts folder works - the other doesn't
I've been using some of Doug's great iTunes scripts <http://dougscripts.com/itunes/> for a couple of years, but the following unsolved mystery is driving me nuts: According to his ReadMe files (and other documentation), there are two locations where
-
Netflix problems with macbook pro
does anyone have a problem accessing netflix? I had a geek squad agent install silverlight which he said is the operating system netflix uses, and it worked for awhile but now im again getting the error message that the netflix site is temporarily un
-
Ps elements 10 on mac problems
hi, i just downloaded the programm yesterday from the app store onto my imac. i want to use it as an extention to my aperture 3. I have the following questions/problems: + starting the programm takes at least 2 minutes, is this normal? I use an Imac