on 02-27-2008 2:50 PM
Hi Friends,
My requirement in XI is : Padded zeros which is removed need to be replaced by spaces.
for removing padded zeros I used the UDF:
int i = Integer.parseInt(a);
return (Integer.toString(i));
It is working fine.
Please help as how to go abt in coding : whatever zeros get taken off , need to be replaced with spaces.
Thanks in Advance,
Meghna.
hi
is the problem solved??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please take into account that when you replace the 0 with space you won't see it in sxmb_moni because as default internet explorer is removing leading spaces. In order to check it please download message and open in notepad.
BR,
WG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>String prefix = "";
>while (a.startsWith("0")) {
> a = a.substring(1);
> prefix = prefix.concat(" ");
>}
>return prefix.concat(a);
Regards,
Henrique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
According to the logic given by Henrique, its working. But the point to the noted is that :
The number of spaces need to be equal to the number of zeros removed, where it not happening in this case.for the below Ex when applied it returned ' 12345' instead of ' 12345'.
For ex. source field is '000012345' then the target field need to be ' 12345'.
the Type declared in the data type for the receiver field is integer with length 15.
Is it possible to move the field value to the right justified, so the the padded zeros code when applied will automatically load spaces.Becoz the code written for removing zeros contains String due to which it is left justified i think.
The code written for removing zeros is :
int i = Integer.parseInt(a);
return (Integer.toString(i));
please suggest in this regard.
Regards,
Meghna.
Edited by: meghna swaraj on Feb 27, 2008 6:05 PM
try this
parameter of function (s_str)
int L1 = 0;
int L2 = 0;
String s_aux = "";
String s_blanks = "";
int value = Integrer.parseInt("s_str");
String s_aux = String.valueOf(value)
L1 = s_str.lenght();
L2= s_aux.lenght();
L1=L1-L2;
for(int i = 0; i <= L1;i++){
s_blaks.concat(" ");
}
s_blanks.concat(s_aux);
return s_blaks;
Hi Rodrigo Pertierra,
Please mention the code along with the declaration parts.
This is the syntax error i am getting when copied & placed the code:
Source code has syntax error: /usr/sap/XID/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapc8758fb0e55911dcb23800145e48d1c2/source/com/sap/xi/tf/_MM_PO1_TMS_.java:762: ';' expected parameter of function (s_str) ^ /usr/sap/XID/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapc8758fb0e55911dcb23800145e48d1c2/source/com/sap/xi/tf/_MM_PO1_TMS_.java:771: ';' expected L1 = s_str.lenght(); ^ 2 errors
Regards,
Meghna.
Hi,
//write your code here
int L1 = 0;
int L2 = 0;
String s_aux = "";
String s_blanks = "";
//convert inbound value to integer to delete zeros
int value = Integer.parseInt(s_str);
//convert value to string again
s_aux = String.valueOf(value);
//get length of inbound value and string without zeros
//for determinate hay many blanks i have to add
L1 = s_str.length();
L2= s_aux.length();
L1=L1-L2;
//create an string with blanks
for(int i = 1; i <= L1;i++){
s_blanks = s_blanks.concat(" ");
}
//concat de blanks to string without zeros
//s_blanks.concat(s_aux);
return s_blanks+=s_aux ;
Edited by: Rodrigo Pertierra on Feb 27, 2008 2:59 PM
Edited by: Rodrigo Pertierra on Feb 27, 2008 3:06 PM
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.