on 08-12-2013 9:00 PM
Hi,
Source Structure -
HEADER (0 to unbound)
DETAIL (0 to unbound)
Target Structure -
HEADER(0 to unbound)
DETAIL(0 to unbound)
Let's say source file has following nodes
HEADER
DETAIL
DETAIL
HEADER
HEADER
DETAIL
DETAIL
The target nodes should be as below (Same sequence as the source)
HEADER
DETAIL
DETAIL
HEADER
HEADER
DETAIL
DETAIL
Is this possible to do in message mapping ?
Thanks,
Sway
Hi,
if you want output same as input you can follow hari's reply.
if you are looking to achieve this in message mapping follow below link
write a code like below in the function tab of message mapping and do not map anything in the editor.
public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException {
try {
String targetxml ="";
String line ="";
StringBuffer sb = new StringBuffer();
InputStream ins = in.getInputPayload().getInputStream();
BufferedReader br = new BufferedReader( new InputStreamReader(ins));
while ((line = br.readLine()) != null)
{
sb.append(line);
}
br.close();
targetxml = sb.toString();
out.getOutputPayload().getOutputStream().write(targetxml.getBytes());
}
catch (Exception e) {
throw new StreamTransformationException(e.getMessage());
}
}
function Tab
Test results
Regards,
Muniyappan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Java mapping helped me here. I don't think we can keep the same order in target as the source with Message Mapping. Thanks for all the suggestions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Check this (in fact this is what Mark was referring to):
http://scn.sap.com/community/pi-and-soa-middleware/blog/2010/01/14/file-conversion-using-nodeception
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
There was a blog here is SDN that is similar to yours. What he did was this:
1. Create a data type (imported in message type) that has this structure
<Root>
<row>
<HEADER> (0..n)
<DETAIL> (0..n)
2. Once the mapping is done and the output is correct e.g
<Root>
<row>
<HEADER>
<DETAIL>
<DETAIL>
<row>
<HEADER>
<row>
<HEADER>
<DETAIL>
<DETAIL>
3. He removed the row using Java/XSLT
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.
Hi,
Do a direct mapping... in case you need to apply transformation rules in the data fields.
Ex Map header to header and so on....
Otherwise what Hari says will work.
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sway,
If you want same input as output . Don't use any mapping in your scenario, problem solved
Regards
Hari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.