cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping error if source field doesnt exsist

Former Member
0 Kudos

Hi All,

How to make mapping to fail in XI before it reaches R/3 (file to Idoc) if the source field doesnt exist. I do not want to send any empty string or any error message etc, Mapping has to fail in XI.

Any clues please?

Cheers,

Paul

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

use this UDF (choose value and one argument to this UDF is a(vendor))


   //write your code here
 if(a.trim().equals(""))
throw new RuntimeException("No Value in Vendor Field");
else return a;

map as shown below


Vendor(source Field)-------------->UDF--------->TargetField

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Paul,

You might also take the approach to check for field level validity at the Reciever Determination step.

Under Type of Reciever Determination you can build a condition for your Configured Recievers.

After creating data rules here you can end a message without error by selecting End Message Processing Without Error in the section under If No Receiver is Found, Proceed as Follows.

We've used this for transactions that we don't want to send on for mapping, but at the same time don't want to raise as an exception at the adapter layer or mapping layer.

Regards,

Aaron

Former Member
0 Kudos

Hi,

You can use the concept of Raising Exceptions in Message Mapping.

Check these for the same

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

Regards

Seshagiri

Edited by: N V Seshagiri on Oct 19, 2009 4:55 PM

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi All,

>

> How to make mapping to fail in XI before it reaches R/3 (file to Idoc) if the source field doesnt exist. I do not want to send any empty string or any error message etc, Mapping has to fail in XI.

>

> Any clues please?

>

> Cheers,

>

> Paul

is the target field mandatory?

only in case it is mandatory it will fail in the mapping if the source data for it doesnt come.

else even if the target field is not mandatory, then you can do a check in your receiver determination and fail the message using the option Terminate Message Processing with Error (Restart Possible). for this provide a dummy receiver

Former Member
0 Kudos

Hi,

Thanks for all your inputs. However, i couldnt acheive the required. My source has a field called vendor (occurance 0 to 1) and target idoc has field vendor (0 to 1). If source field vendor has some value in it then map it to target field vendor and if the source vendor doesnt have any value , then the mapping has to fail without going any further. I have used conditions like if exists / if not exists/ if exists and not equals = constant etc, but none of them helped to fail mapping.

Cheers,

Former Member
0 Kudos

Hi Seshagiri,

I will try the blog you attached and let you know, as in this blog it says it can handle "empty incoming value" to raise an expection.

Cheers,

Former Member
0 Kudos

Hi,

You try this also....

http://img17.imageshack.us/img17/7000/mapp1.jpg

Regards

Seshagiri

Former Member
0 Kudos

Thanks Seshagiri.

Will let you know soon.

Regards,

former_member187339
Active Contributor
0 Kudos

Hi Paul,

>>How to make mapping to fail in XI before it reaches R/3 (file to Idoc)

Make the target field mandatry (so if source is not there target will not be created and it will fail). But in thi scase since yo have idoc in receiver you need to see the occurence of the field.. if it is 1..1 then this will help

Can you paste here what field you are trying to map in the target and what is it occurence?

Regards

Suraj

prateek
Active Contributor
0 Kudos

Simply check in graphical mapping with condition with "if" and "exist" function.

You may then pass this to UDF and follow this

/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

I have used if, exists, not, etc, but the mapping is not failing. It will execute with creating either empty string or not creating target element in mapping. But i want the message mapping to fail, which is like [not passing a value to a mandatory field]. I would like to see something like message mapping error in moni.

Hope, you're getting me.

Cheers,