cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
Former Member
0 Likes

I assume that you are using the standar function Value Mapping to do the value mapping.

You could test this example:

ESR:

ID:

The values are in the configuration part, then it is a better aproximation if you need to change this values in the future.

Regards

Former Member
0 Likes

Hi Thanks for the answer i donot have "throw exception" option my my value mapping function , I am using 7.0 I guess might be due to patch level

Former Member
0 Likes

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.

Former Member
0 Likes

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.

Former Member
0 Likes

Hi Rajeev,

Thanks , yeah thats a mess now , do u have any sample UDF ,I guess putting around 3000 values in UDF does not sound good to me ...any simple UDF to raise exception if there is a blank value..then I can build my mapping condition around that

Former Member
0 Likes

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.

Former Member
0 Likes

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