cancel
Showing results for 
Search instead for 
Did you mean: 

How to fail a message based on payload?

Former Member
0 Kudos

Hi Experts,

Currently Iu2019m working on IDOC2JDBC scenario wherein the customer master details needs to be send from CRM system to Oracle system. My question is there are two fields at source side Postal code and Tax and my requirement is, if any of these two fields are initial (doesn't contain any value) then the message should fail in XI? I mean the message shouldn't go to Target system. Can I achieve this functionality in XI or at R/3 side? If yes please let me know the method or procedure by which the above functionality can be achieved? Do I need to fail the message at mapping level?

Your help is highly appreciated

Rgds

Faisal

Accepted Solutions (1)

Accepted Solutions (1)

sbuttler77
Active Participant
0 Kudos

You can fail the message during mapping using a UDF(needs adjusting obviously), e.g.

if ( a.lenght() == 0 ) ) {

throw new RuntimeException("Postal code initial");

}

else {

return a;

}

Former Member
0 Kudos

Hi,

Sorry for late replying as i was a bit busy. Can you please provide me the complete code i mean UDF?

Regards

Faisal

former_member190313
Active Participant
0 Kudos

hi Abdul,

Here is the sample UDF.

If(tax[0].length()==0)

{

throw new RuntimeException("Can Not proceed , Tax value can not be balnk ");

}

else

{

resultlist.addValue(tax[0]);

}

U can write same for Postal Code.

Regards,

Sheetal

Answers (5)

Answers (5)

Former Member
0 Kudos

Faisal,

if any of these two fields are initial (doesn't contain any value) then the message should fail in XI? I mean the message shouldn't go to Target system.

These are two different things - do you want the message to fail in PI or you don't want to create the target message if the condition fails?

If you want the message to fail in PI - write an UDF and can raise an exception / create email notifications.

If you don't want to create the target structure, you can use "if-else" condition / UDF / createif function.

Regards,

Neetesh

udo_martens
Active Contributor
0 Kudos

Hi Faisal,

configure inside the data type the two corresponding fields as mandatory (occurance 1-1) and define a min length of 1.

You can configuret he validation of the datatype (XSD) in the agreement of IB Directory.

Regards,

Udo

rajasekhar_reddy14
Active Contributor
0 Kudos

You can do this in two ways

You can check condition in pi mapping then send a mail to corrsponding poerson saying that values misisng.if you dont required any mail like that then better to do it R/3 level.

Regards,

Raj

Shabarish_Nair
Active Contributor
0 Kudos

you can achieve it at the receiver determination level.

Create a condition for all successful validation and assign a receiver.

And from the option; you can choose to handle the 'no receiver found' case.

Options for Behavior at Runtime If a Receiver Is Not Found - http://help.sap.com/erp2005_ehp_04/helpdata/EN/26/5ccd3bb4560f01e10000000a11402f/frameset.htm

Former Member
0 Kudos

Hi,

I think that is better to resolve this problem at R/3 side, changing the ABAP program.

Fabio