on 12-01-2005 6:34 PM
Hi
I have a scenario which I guess - all of you would have faced if you calling a SAP std BAPI/RFC through XI from an external client application to read some information based on SAP material/customer
Normally, to get details of a material by calling a relevant RFC in SAP - for eg : if the material number contains only numbers ( no alpha ), then , when calling the RFC , the material string has to be lpadded with zeroes for the remaining lenght upto 18. This lpadding need not be done in case the material string contains an alpha character.
I tried lpadding the remaining length -say for the material using number format function in XI message mapping- but obviously this fails if the material string contains an alpha character....
Obviously , there has to be a check - whether the material string passed from the client application contains an alpha or not. If there is an alpha character , there is no need to lpad, otherwise there is a lpadding necessary.
1. Can this check for presence of an alpha character be done using the graphical editor and pre-defined functions ? Or do we have to write a advanced function using Java to do this ?
2. Can the whole logic of mapping the material number to the format required by the RFC be done using the graphical editor with the pre-defined functions
Can anybody share the advanced function code or some technicalities in the graphical mapping to achieve the whole mapping or atleast the check for the alpha character ?
Thank you in advance for your time.
Hi Karthik,
Here's the easiest way to do this:
1) Write a java function called isNumeric to check if the value is numeric. There are lots of ways to do this. Here's the simplest:
try {
Integer.parseInt(a);
} catch (NumberFormatException e) {
return false;
}
return true;
2) Use the built-in FormatNum function to pad the zeros. There's no need to write java code to do this. If you want to pad to 10 places, specify 0000000000 as the format.
3) Setup an If-Else statement. If isNumeric then FormatNum else just pass the value unchanged.
Thanks,
Jesse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
have a look at this piece of code:
String vendornum = "asd13342";
String Returnvend = null;
String zero = "0";
int strlength = vendornum.length();
int standardlength = 18;
Returnvend = vendornum ;
for (int i = strlength ; i< standardlength; i++)
{
Returnvend = zero.concat(Returnvend);
}
return Returnvend;
(you can adopt it to your simple use function)
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.