Author |
Message
|
lvraa |
Posted: Wed May 19, 2004 3:16 am Post subject: XML Message set |
|
|
 Novice
Joined: 18 May 2004 Posts: 12 Location: Denmark
|
Hi!
I'm building a XML message from a SAP IDoc. The target Message Set has XML as wire format. The issue i'm faceing is that the elements in the output message is written in the sequence that they are assigned to the output. I expected that they would be formatted in the sequence defined in type ORGUNIT_t.
Message structure:
HR_ORGUNITS (HR_ORGUNITS_t)
--ORGUNIT (ORGUNIT_t)
----OrgUnitID
----ParentOrgUnitID
----.....
Reset message format properties:
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageSet = 'JOVDHKO002001';
SET OutputRoot.Properties.MessageType = 'HR_ORGUNITS';
SET OutputRoot.MQMD.Format = 'MQSTR';
SET OutputRoot.MQSAPH = NULL;
Writing to the output:
SET OutputRoot.MRM.ORGUNIT.OrgUnitID = InputRoot.IDOC.CONTROL_RECORD.ZHR_EXT01.E2PLOGI[1].OBJID;
.... _________________ Kind regards
Lars Vraa
lavr@lundbeck.com |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 19, 2004 3:57 am Post subject: Re: XML Message set |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
lvraa wrote: |
The issue i'm faceing is that the elements in the output message is written in the sequence that they are assigned to the output. I expected that they would be formatted in the sequence defined in type ORGUNIT_t. |
That's the way it works, except in certain specific conditions.
So, reorder your code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lvraa |
Posted: Wed May 19, 2004 4:15 am Post subject: Re: XML Message set |
|
|
 Novice
Joined: 18 May 2004 Posts: 12 Location: Denmark
|
Hi jefflowrey
Thanks for you answer. I reordered the code already but I expected the Message Set to force the defined structure - like when working with DTS. I'll just have to accept if thats the way it works
jefflowrey wrote: |
So, reorder your code. |
- works! _________________ Kind regards
Lars Vraa
lavr@lundbeck.com |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 19, 2004 4:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The reason it works the way it does is this - at least as I understand it (and I don't work for IBM!)
If you are starting with a blank Output message, then each ESQL assignment statement is adding a brand new node to the logical message tree.
This node is inserted as the last child of the appropriate parent node.
The MRM writer then goes through and walks the tree in node order, writing fields as it finds them. Anything else would be much less efficient.
If you could find a reasonably efficient way to prepopulate your Output message in the right order with empty fields, then you could assign values to them in any order in your code. This is because the set operation first looks to see if there's an existing node that you are trying to work with.
But there isn't a clean AND efficient way - that I know of - to prepopulate your output tree like this. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lvraa |
Posted: Wed May 19, 2004 4:31 am Post subject: |
|
|
 Novice
Joined: 18 May 2004 Posts: 12 Location: Denmark
|
Hi
Youre probably right that its a performance design decision. Very large XML messages could be tough to parse otherwise. It would be nice if it could be turned on and of though
jefflowrey wrote: |
The MRM writer then goes through and walks the tree in node order, writing fields as it finds them. Anything else would be much less efficient.
|
_________________ Kind regards
Lars Vraa
lavr@lundbeck.com |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 19, 2004 4:36 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, one of the cases where it will reorder your message tree is apparently when you are modelling with unordered sequences. So if your XML message consists of types that are unordered sequences, the parser will supposedly reorder them by the sequence in the message set.
But then if you're modelling an unordered sequence, you shouldn't care whether the ESQL determines the order of the fields or whether the model does.
This stuff is documented - I just haven't looked at the relevant sections in a while. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|