on 08-09-2007 12:21 PM
Hi,
I want to use simple user defined function in xi to reverse a string .
I have written the java code :
public class StringRevChar {
public static void main(String[] argv) {
//+
String sh = "FCGDAEB";
System.out.println(sh + " -> " + new StringBuffer(sh).reverse());
//-
}
}
the code is working .
<b>But I dont know how to write this code in UDF portion of XI .</b>Pls help me .
Thanx & Regards,
somenath
Somenath,
Create simple UDF - Cache- Value ;
String sh ="FCGDAEB";
StringBuffer sb = new StringBuffer(sh);
sb.reverse();
return""sb.toString()"";
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks Raj ............... ur answer is very helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have done the mapping in mapping editor and the code is working , but i want to take the input from the user ...... but i dont know how to read it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
I have done this . I want to know how take the input in xi?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Somenath,
Refer the link http://flickr.com/photo_zoom.gne?id=976271330&size=o
Describing accorning to the URL
Cache : Value.
Argument : input_name
<b>//Code:</b>
StringBuffer sb = new StringBuffer(input_name);
sb.reverse();
return""sb.toString()"";
Best regards,
raj.
thanx everybody 4 reply the code(sample code of raj) is working in XI. But what is the procedure to take the i/p from user? suppose i want to take the string from the user
thanx ,
somenath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
take a look into that link on how to create a UDF, and then try to implement the code that was provided in the above suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't need to use the Class name and Main methods in UDF. Just create a function with input parameter as the source string, and work on that string in order to get the output in reverse.
You can just use the logice which you have specified.
Thanks
Krishna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In the left hand side of Message Mapping Editor, there is an option User Defined.Use this and map it to the source and target.you will be successful in achieving your goal.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Somenath,
The same code will work in XI also. Just few modification required.
1. take the your string as the input to the UDF and UDF type as value
2. Your input varible name is "sh"
3. Write the following logic
return( new StringBuffer(sh).reverse() );
This will work fine in XI. I hope you understand clearn.
Warm Regards,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please give your input tag as an argument to the UDF
Then in your udf do this
function(String arg, Container container)
{
String output = (new StringBuffer(arg).reverse()).toString();
return output;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.