on 04-10-2007 7:16 AM
hi, there
I will realize a mapping rule.
sender is a char data type with length 8 bytes. after mapping , if the real content is not 8 byte, '0' will be added into the front of string.
for example.
11 --> 00000011
aaa --> 00000aaa
etc.
Maybe the standard function is not satified with the requirement. WOuld you please tell me the realization way. The add-on java mapping program is necessary?
thank you in advance
Best Regards,
Kevin
Try this UDF so that you get the desired result. this will pad the string you pass with the correct zeros.
<i><b>
int len = 8 ;
StringBuffer sBuf= new StringBuffer(a);
while (sBuf.length() < len) {
sBuf.insert(0,' ');
}
result.addValue(sBuf.toString());
</b></i>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try with this UDF with a as input
<b>if(a.length()<8)
{
String str = "";
for(int i=0;i<(8-a.length());i++)
{
str=str+'0';
}
resut.addValue(str+a);
}
else
{
resut.addValue(a);
}</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try with FormatNum standard function.
Converts it according to a pattern that you define using the function properties
see the below link
http://help.sap.com/saphelp_nw2004s/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
I checked in the data type for character i did not see char type.Could you please check it and let me know.
Even if you select data type as string you will not get '0' as preeceding value.
Please let me know if you have any queries...............!
Thanks and Regards,
Chandu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, Chandu
thanks a lot for your answer.
Sorry for the wrong decription.
Yes, Actually the string type is default for the field.
Yes, Even i select data type as String i still will not get '0' as preeceding value.
So how to realize the mapping like showed example below.
source target
aa 000000aa
1111 00001111
Best Regards,
Kevin
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.