cancel
Showing results for 
Search instead for 
Did you mean: 

Forceful message mapping failure.

Former Member
0 Kudos

Dear All,

I have a requirement like below:

file to IDOC scenario:

I have 13 fields at source side in which all the occurences is 0..1 and is of string type.

field 4 from source holds value 1 & 5, if i get anyother value i need to raise an alert and fail the message.

@ IDOC side the field is TPLNR which holds this value and also this occurence is 0..1 and of type String.

So if i get the input value other than 1 & 5 I need to fail the message and generate an alert,

Can anyone throw how can i achieve this functionality.

Also, I have a date function which should remove / for eg: 2013/12/22 the output should be 20131212, this can be achieved through standard

data transformation but there is a chance of getting null values sometimes, during such cases it fails at mapping level. so need to validate null values too.

so, if i have any code to eliminate this \ symbol it will be good. I have achieved this functinality by graphical mapping but i need  a code which improves performance.

Please throw some lights.

Thanks,

--Kishore

Accepted Solutions (0)

Answers (2)

Answers (2)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos
ambrish_mishra
Active Contributor
0 Kudos

Hi Kishore,

I personally don't like to implement design to fail the interface because source system sent a wrong value. I would rather handle it from source.

However, this is how you can achieve it:

UDF code is below:

message is the parameter passed to UDF.

Exception e = new Exception(message);

throw new StreamTransformationException(message, e)

Fix Value table:

For the other UDF:

You can try something like this:

Pass the date as input to the UDF.

if (input.contains("/"))
  input
.replace("/", "");


     return input;


Hope it helps!

Ambrish