on 02-08-2008 9:14 AM
Hi Friends,
It is a outbound PO interface. The vendor number is coming from IDOC and it is being padded with zeros in the PO file. It shouldnt have any zeros preceding the vendor number. For instance if the Vendor is "800012", the field is being created with 0000800012 as the vendor number when it should be created in the file as 800012.
Is there any code to remove the preceding zeros before sending it to the target system.
Thanks in Advance,
Meghna.
Hi,
Use this peace of code to achicve your requirement
String b= (new Integer (Integer.parseInt(a))).toString();
return b;
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
just do a UDF function.
copy and paste it:
public String DeleteRightZeros(String s_string,Container container){
int i_string;
// convert the string to int.
i_string = Integer.parseInt(a_string);
//convert the int to string
s_string= String.valueOf(i_string);
return s_string;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Meghna,
please go in function Arthmetic --> round in Message Mapping,
use message mapping INPUT NO --> ROUND --> Output No
Reward points, if helpful,
Sandeep Kaushik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
just use the FormatNum function with no values in it
this will solve your problem.
Ranjit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Meghna,
The preceeding zero's are a often faced phenomen in SAP integration scenarios,
SAP uses conversion exits to change in and output values to for dispaly inside SAP.
This also comes into account in integrating standard interfaces as many Function Moduls return numbers formatted that way.
If you have a chance to have influence on your function module use the according conversion exit to remove
the numbers during the call inside SAP as this is a SAP interna.
(Also see this thread about conversion exits for inputs (conversion_exit_alpha_input) and and outputs (conversion_exit_alpha_output)).
Of course also the other way is to write a user defined function, that cuts the leading zero's in XI, but
in my oppion this is moving something away from its cause.
And also that one you have to write by yourself.
With best regards
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> It is a outbound PO interface. The vendor number is coming from IDOC and it is being padded with zeros in the PO file. It shouldnt have any zeros preceding the vendor number. For instance if the Vendor is "800012", the field is being created with 0000800012 as the vendor number when it should be created in the file as 800012.
> Is there any code to remove the preceding zeros before sending it to the target system.
There is no tcode to remove the zeros.
Let me know the scenario.
Regards,
Sarvesh
Edited by: Sarvesh Singh on Feb 8, 2008 3:21 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you dn't need any UDF for this, you can achieve this by using simple substring function.
For ex: if ur Vendor number is like 000200, then use the substring function to elemenate first three digits. In the properties you can set as starting position 3 and number of characters 3. You will get the output as 200.
Regards
Edited by: Vijaya Lakshmi MV on Feb 8, 2008 10:42 AM
> I mean to ask in XI is there any User Defined Function (UDF) Code which can be written (for removing preceding zeros)and map it the 'vendor field'.
>
There is no Generic Function in XI mapping which removes the Zero but you can write a very-2 small and easy User Defined Function (UDF) to remove the leading zeros.
Logic: Inside the udf code just declare a variable as integer and pass your incoing value to it, it will remove all the leading zeros.
Regards,
Sarvesh
> I think you dn't need any UDF for this, you can achieve this by using simple substring function.
>
> For ex: if ur Vendor number is like 000200, then use the substring function to elemenate first three digits. In the properties you can set as starting position 3 and number of characters 3. You will get the output as 200.
>
Hi,
You never know how may leading zeros are coming, so you can not use substring and hence can not set a fix position as said above. In this case you have to write the UDF.
Regards,
Sarvesh
Hi,
Check the links for UDF.
UDF
http://flickr.com/photos/8764045@N06/
Example 1
http://www.flickr.com/photo_zoom.gne?id=544183191&size=o
http://www.flickr.com/photo_zoom.gne?id=544183195&size=o
http://www.flickr.com/photo_zoom.gne?id=544183225&size=o
http://www.flickr.com/photo_zoom.gne?id=544183233&size=o
Example 2
http://www.flickr.com/photo_zoom.gne?id=545133789&size=o
http://www.flickr.com/photo_zoom.gne?id=545133791&size=o
http://www.flickr.com/photo_zoom.gne?id=545133801&size=o
http://www.flickr.com/photo_zoom.gne?id=545133807&size=o
http://www.flickr.com/photo_zoom.gne?id=545133811&size=o
http://www.flickr.com/photo_zoom.gne?id=545138911&size=o
http://www.flickr.com/photo_zoom.gne?id=545138913&size=o
http://www.flickr.com/photo_zoom.gne?id=545138915&size=o
http://www.flickr.com/photo_zoom.gne?id=545138917&size=o
http://www.flickr.com/photo_zoom.gne?id=545138947&size=o
http://www.flickr.com/photo_zoom.gne?id=545138951&size=o
http://www.flickr.com/photo_zoom.gne?id=545005958&size=o
Example 3
http://www.flickr.com/photo_zoom.gne?id=549186611&size=o
http://www.flickr.com/photo_zoom.gne?id=549186651&size=o
http://java.sun.com/j2se/1.5.0/docs/api/
/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Regards,
Phani
Reward points if Helpful
hi,
check this code to " trim leading zeroes"
public String trimLeadZero(String a,Container container)
{
int ii = 0;
//Convert string to integer to remove leading zeros.
ii = Integer.parseInt(a);
//Typecast integer back to string.
a = ii+"";
//Return String value.
return a;
}
code to "remove leading zeroes"
public String RemoveLeadingZeros(String a,Container container)
{
String result = "";
if (a == null)
{
result = "";
}
char [ ] chars = a.toCharArray();
int index = 0;
for (; index < a.length(); index++)
{
if (chars[index] != '0')
{
break;
}
}
return (index == 0) ? a : a.substring(index);
}
please reward with necessary points if found helpful.
regards
madhu
Hi,
There is no tcode to remove preceding zeros. For Example, if IDoc is to inbound to XI and update the data in ABAP table, the system will add automatically preceding zeros. In the opposite case (IDoc to File), if you want to remove leading zeros, you have to do this at the mapping level.
Kind Regards,
Jeg P.
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.