cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Error - Dump source message to file adapter comm channel

Former Member
0 Kudos

Hi

Does anyone know of a way to dump the source message to a file adapter comm channel if - and only if - the message fails during mapping. For example, we receive a message from a trading partner that lacks an element that is mandatory during the mapping. When the mapping fails, the source message is sent - as is - to a file adapter comm channel.

I don't need anything more than the source message i.e. no need for any errors etc... to be included.

The kicker.. I would like to do this without using BPM if at all possible.

Any ideas greatly appreciated. Thx, Duncan

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks to all for the inputs. More than anything, we have a great start on our work to implement the 'advanced' validation. Point awarded. Thanks again! Duncan

Former Member
0 Kudos

Hi Henrique

Niot quite as simple as it gets =( I know how to handle with Rec Det. [ Ram, Just use the XPATH to test that e.g. the node is there. Then set the if no receiver found, continte to a fixed party and service. This means that any message failing the XPATH condition gets routed to that other party and service. ]

However, to use this approach to handle what I want, I am back to building the full validation i.e. in a message that contains 50 elements, I have a 'mega' Rec Det that tests their existance, length etc... That is not really manageable.

Yours and the other suggestions are ways to do something more accurate than I need right now. Again, assume the message gets through Rec Det, if it fails for any reason - element is missing, sky is too blue etc... - I dump a copy of the source to the filesystem.

Appreciate the help though 😃

Cheers, Duncan

henrique_pinto
Active Contributor
0 Kudos

Well Duncan,

you can either use condition for simple validation or create a full validation program for all the fields.

Instead, you want a simple method for validating all or a lot of fields of your message. That's wanting a lil too much, my friend. =P

simple method -> tiny validation

large validation -> complex method

Thats how it goes.

Regards,

Henrique.

Former Member
0 Kudos

Satish, Michal

For now, I am looking for something quicker and easier to help with a current 'mess' we have in a production system. Basically, the trading partner is dumping garbage onto us. I want to facilitate the team working on identifying the various issues by dumping out the entire source message if it fails for any reason in the mapper. That makes like easier for the team as it gives them a clear to-do list of bad messages.

The two approaches you indicate require us to build the validation. This is really helpful as we are looking at that in an upcoming version of our solution.

Immediately, looking for something less sophisticated and implemented quick 'n' easy to get us past the worst 😃

Cheers, Duncan

Former Member
0 Kudos

Duncan,

The other thing i can think about is writing a user defined function and try out.

User defined function for checking the vendor number exists in the input file or not. If it doesnot exists then it will write a error file in FTP location:

public String validation(String a, Container container) {

//write your code here

if (a.equals("")) {

try {

String source = "Vendor cannot be empty";

char buffer[] = new char[source.length()];

source.getChars(0, source.length(), buffer, 0);

for (int i = 0; i < buffer.length; i +=2)

{

f0.write(buffer);

}

f0.close();

FileWriter f1 = new FileWriter("

10.10.0.55
sapmnt
trans
edixiin
err.txt");

f1.write(buffer);

f1.close();

}

catch (IOException e) {}

}

}

return "ERROR";

More details are on this thread:

---Satish

henrique_pinto
Active Contributor
0 Kudos

As simple as it gets: if the element that you want to check is always the same, just use condition in receiver determination.

If that node exists (or is equal a particular value, or different from a particular value etc), send it to the processing system.

If not, send it to the receiver file comm channel.

Regards,

Henrique.

Former Member
0 Kudos

hi Henrique,

can you make it more clear? how can we do it in reciever determination.

cheers

ram

henrique_pinto
Active Contributor
0 Kudos

Hey Ram,

Go to Integration Directory and open the Receiver Determination for your scenario.

Check the configured receiver services. They are in a table-like area in the middle of the screen.

In this table of configured receiver services for that particular Sender Service/Interface, you should have the system that normally receives that message (your ERP or any other application system) and the service that contains the receiver file comm channel that will receive the message in case of error.

Check help.sap.com for help on condition editor on receiver determinations.

Now, the issue. You can only check whether a field exists, you can't check whether it doesn't exist (There's only a "EXIST" operator, and no negative operator). Thus, you can only do the following: always send messages to File, but you can avoid messages that dont have field from being sent to App System. Yeah, that sucks...

But don't fear, young padawan! There is a possible workaround. =D

In your message mapping, do the following for that particular field:

If field exists (check with Exist and IF standard functions) just bypass the field. Else, map the field with an impossible value (like string "$CREATED$"). Then, in your receiver determination, you will do the following conditions:

for App System: If field =/= $CREATED$

for File Receiver: If field = $CREATED$

Now, if the field doesnt exist, it will have value $CREATED$, thus the message will be sent to File and not to App System. If the field exists, the message will be sent to App and not to File.

Try that out.

Regards,

Henrique.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

a very simple approach :

you could try to add file validation module to your

sender file adapter - that would check for mandatory values

if some of them are missing fill in one of your own adapter specific parameters

(let's say with value MISSING)

then inside directory add a routing rule:

if parameter empty = process

if parameter MISSING = send directly to file

and no BPM

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Former Member
0 Kudos

Duncan,

Check this out:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...ValidationsinSAPXI-ACaseStudy.pdf

/people/dmitry.govberg/blog/2007/02/12/informing-the-sender-about-bad-records

---Satish