on 11-09-2011 9:02 PM
Hi Experts,
I am facing an issue with the xsd:decimal, totalDigits and fractionDigits in my mapping
I have declared my target field as type-xsd:decimal,totalDigits=15, fractionDigits =4 and when I pass the value to it as 9.1234567891234567, its not throwing any exception in PI and executing successfully where I was expecting it to fail as the total number of fraction digits is more than 4, which I have declared.
This mapping output is passed to the proxy, there I can see a system error in SAP. The ABAP tech type is DEC(15) in the proxy.
Ideally I was expecting a mapping error in PI , please provide your inputs on this
thanks in advance
This is pure XML validation. Since you dont do XML Validation during pipeline step, it wont validate your data against schema definition. Remember if you use PI 7.1 and later there is an option to do xml validation and you can configure in sender agreement(both adapter engine (java) and integration engine(abap) for the inbound message and receiver agreement (abap stack) in the outbound message. But triggering xml validation might cause performance issue too.
Refer this link for example
You can do business validation in the backend system and send error response if the fraction digit is not with requirement or correct the data in mapping using udf or standard function.
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 use the formatNumber (double click on that function and give format as 00.0000 [after dot it should be 4 zeros]) function in b/w source and target fields mapping.
If you want to throw an exception in the mapping use this UDF.
String tempVar = "";
tempVar = strAmtVal.replaceAll(",", "");
String strValidChars = ".0123456789.";
int dotcounter = 0;
char strChar;
boolean binResult = true;
if(strAmtVal.trim().length() > 0)
{
for (int i = 0; i < tempVar.length() && binResult == true; i++)
{
strChar = tempVar.charAt(i);
if(strChar=='.') dotcounter++;
if (strValidChars.indexOf(strChar) == -1)
binResult = false;
if(dotcounter>3)
{
binResult = false;
break;
}
}
if (binResult == true)
{
int len1=0;
len1=tempVar.length();
int len2= tempVar.indexOf(".");
if (len2 == -1)
len2 = len1;
int diff = len1 - len2;
if(diff < 4)
return tempVar;
else throw new RuntimeException("Error: More than 4 digits exist after decimal");
}
else
throw new RuntimeException("Number Format Exception");
}
else
throw new RuntimeException("Number Format Exception");
Here "strAmtVal" is the input parameter and also in this UDF contains extra validation (number format, accepts only numeric values), if you don't want those validation then you can remove the those validations code.
Regards,
Venkata Ramesh
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.