on 02-23-2011 9:54 AM
Hello Friends,
We have a transformation logic in which we have to deliberately fail a mapping.
The Logic is
1) Concatenation of 3 fields.
2) After concat if length>9,make it boldFAIL.
If the len<=9,then pad as many zeros to make the length 11 and the add a constant 5 at the beginning
Now, how do we go about FAIL part of the mapping.
Hi,
You can achieve this by just a single line of code in UDF.
After check for length > 9 in if then else boolean function in graphical mapping.
call a UDF with following code.
public String callException(String var1, Container container) throws StreamTransformationException{
throw new RuntimeException("Length Greater than 9") ;
return null;
}
If you want to display some message in the trace. you can use the trace object:
AbstractTrace trace = container.getTrace();
trace.addInfo("callException: Length greater than 9.");
regards,
Aravind
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please go through the following link which is exteremely useful:
/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
This link should definitely solve your issue.
Thanks
Biswajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Deepak,
The requirement is that there is a segment for CO PA data in a file. there are 3 segments overall. Header, Detail and COPA.
So, If the COPA segment has data in the source file, then in the Target. The segment E2BPACKEC in the Target IDoc has to occur 30 times in the Target.
Any good?
Hi,
What is the occurence of segment E2BPACKEC. Is it 0..1 or 0...unbounded?
If it is 0..1, then you can duplicate the segment E2BPACKEC 30 times and put a condition that the node will occur only when there is data for COPA segment.
it is is 0 ..unbounded, youhave to write a udf.
Regards,
Deepak.
Hello,
Alternatively, you can use this mapping:
source --> lenght --> greater --> createIf --> RootNode
constant:8 ------------> /
Since it would be failing at the Root level if the condition is not met, you can use the second logic for the actual node
If the len<=9,then pad as many zeros to make the length 11 and the add a constant 5 at the beginning
source -------------> add --> target
constant: 500000000000 /
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FAIL means>
you want to stop mapping execution , with red flag in MONI
clarify this point;
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.