cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc to File scenario (External Definition)

Former Member
0 Kudos

Hi

I have a scenario which is a Idoc to file scenario. Here I want to continue with mapping only if the field MATNR exists on the source side (Idoc) otherwise I should get a message on the target side that the "Mapping failed because MATNR field does not exist " and the mapping should fail.

There are two independant MATNR fields and mapping should fail if I either of them does not exist.Please keep in mind that there indepandant of each other.

Please help

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Use exists (Node function) for both the MATNR fields and then Boolean function AND so that the result will be true only if both the MATNR fields exists. But here you need to take care of contexts. But as the mapping step failed there won't be any message to target node.

Else use conditional receiver determination and check the existance of MATNR fields in source payload and route the message accordingly.

Former Member
0 Kudos

There is one more condition if these conditions do not suffice and when the mapping fails i need an error msg citing the reason that why the mapping has failed . How do I go about till here I have also done.

Former Member
0 Kudos

You have to write an UDF with exception. In exception you can write your message (the reasone of failure).

something like this..

//Mapping trace will add the warning to show in MONI (if trace level is set to 1 atleast in Tcode SXMB_ADM).

MappingTrace trace = container.getTrace();

for (int i = 0; i < MATNR.length; i++)
{
          if(MATNR<i>.equals(""))
          {
               trace.addWarning("MATNR is missing.");
               throw new RuntimeException("MATNR is missing.");        
           }
}

abvoe code is just an example, you have to modify and put the logic as per your need.

Regards,

Sarvesh

Former Member
0 Kudos

Write an UDF for customized error message in SXMB_MONI.

Refer these blogs for help-

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

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping