on 03-27-2012 8:09 AM
Hi Experts, I have a requiremnet to fail the mapping if value mapping lookup (standard valuemapping) fails...
For example
vendor --111 --valuemaplookup to aaa ---target =aaa
if vendor 222 does not have value defined in value map table it has to fail the mapping...I am not sure its not working its outputting 222 in the target , any idea whats the cause.
Regards
Ravikiran
you can try this:
add one UDF after value mapping...this UDF will compare the output of value mapping and input source value,
in case if both are same then it will throw a runtime exception
input will be a and b
execution type: single value
if(a.equals(b))
{
throw new RuntimeException();
}
else
return a;
Chk this also:
http://scn.sap.com/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphi...
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.
as far as i know, i think in 7.0 this option of throw exception in value mapping properties is not available. so you can create a UDF using if condition to check for your source values, in then map it to target values and in else condition (if no condition satisfies) throw an exception using throws statement.
You could find the code that Rajev suggest in http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00ee347e-aabb-2a10-b298-d15a1ebf4...
Pages 14 to 16.
Regards.
the situation is slightly tough now.........use the below URL to see the class, interface and methods and try to invoke it in your UDF:
http://help.sap.com/saphelp_nwpi711/helpdata/en/f2/dfae3d47afd652e10000000a114084/frameset.htm
the doc provided by inaki above also uses these and has a better detailed description to use these.
use executeMapping function in your UDF. so if it returns null in UDF, then throw exception.
so in graphical msg mapping, the valuemapping node will be replaced by your UDF having all the input parameters as constants except the source value field in your graphical msg mapping for executeMapping function.
If you have a large number of values you should use for example an RFC Lookup function. I don't know if it is available in SAP PI 7.0.
You could use the code from here http://wiki.sdn.sap.com/wiki/display/Snippets/User-defined+Mapping+Function+for+RFC+Lookup
Regards
Check your code in RFC... Check if it returns the input value if output value is not maintained for the input value. Change your RFC code to return null in case target value is not maintained and raise exception in your message mapping accordingly.
-Amol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
create a UDF for this lookup and for not required values, throw exception using throws statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravikiran,
@RAJEEV GUPTA: UDF is not required here, standard configuration of Value Mapping function can be used.
The solution is: when you double-click the Value Mapping function, a configuration popup appears. You can choose the expected behavior when the lookup fails: Use Key (which is the default and apparently is used in your case), Use Default Value and Throw Exception. You should use the last one in your case. See below:
Hope this helps,
Greg
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.