on 08-12-2008 6:43 AM
I am new to XI and I need some clariffications. While writing user defined functions, every argument is converted to string by default. Is it possible to convert the default string argument to integer value? If so how? Can any one plz tell me?
Thank you very much friends.. i got the answer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naresh,
Suppose say u want to convert the string to integer
String s= "123";
The exact format to convert it into integer:
int i = Integer.parseInt("123");
Now in XI the return type is String so integer to String the format is
String s = Integer.toString(i);
Thanks
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Writing use defrined functions in XI is quite simple. Create a simple UDF, give the import parameters and then just go ahead with the logic coding and then return the output from the UDF.
Just remember that all inputs and outputs to an UDF are always Strings.
This link for User Defined Functions,
http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
please see the below blog for user-defined functions:
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
Just check these out.
http://help.sap.com/saphelp_erp2005/helpdata/en/45/244c40aa6a0272e10000000a155106/frameset.htm
In order to create UDFs, you need to have a basic idea about using Core Java. Also, based on the kind of functonality of the code, you will need to know if you require any extra jar files.
To create a UDF, all you need to do is click on LHS icon in the graphical mapping editor. Also, keep in min that the input and otput of a udf is always in strings.
To test your functions, you can either use the test tab present in the mapping editor or you can even use the following editor(blog by Sravya):-
I think info will be enough for you to start off with creating and using UDFs:)
Also, since you are an ABAPer, you might be interested in this blog which discusses how to use the ABAP editor to create, modify and test java programs!:-
Regards,
Suryanarayana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In UDF, the import argument is always "String".
We can convert it to integer by using the parsing code.
int b = Integer.parseInt(a); where a is the input
Then, again we can convert it to string as
a = b.toString();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
It is possible use this function return (Integer.parseInt(str_var))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
String YourString = "XX";
int YourInt = Integer.parseInt(YourString);
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do like this
Receive String and convert it into Integer inside coding and use it.
In UDF of graphical mapping, u may use the following code:
String strName = "true";
int b = Integer.parseInt(strName);
Regards
Seshagiri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do this using the parsing function of Java.
If a is a string input u can convert it to integer as
Int n = Integer.parseInt(a);
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.