on 11-29-2006 3:02 PM
Hello all.
I am currently attempting to develop a scenario that takes a CSV file and maps it to an XML file.
I have defined two XML structures, one is a very simple flat one, used for the CSV import in cooperation with the plan2xml adapter module. The second is a more complex XML structure that will be the target message.
The source file has 5 fields that are multidimensional. So for example, there is a field called WEIGHT in which the value of the field may be:
5.800,7.400,4.200,1.606
The target XML structure has an unbounded element, consisting of several subelements. Looks similar to this:
-UnboundedElement
-element1
-element2
-element3
-element4
I would like to loop the unbounded element, so that for each multidimensional field in the source message, I can store that data in the unbounded element. So, more simply, it should look something like this:
Start Loop:
-First iteration:
copy 5.800 to element1 of unboundedelement
-Second iteration
copy 7.400 to element1 of unboundedelement
etc.
(1) First I need to know how to create that loop.
(2) Second, what is the best way to map this? It seems to me that there should be a way to combine existing functions to make this possible. But do you think I would have to create a user defined function to do this?
Thanks in advance. I hope I explained this clearly enough.
Hi,
I'm not sure if i'm right... but as far i understand you have a source structure with the WEIGHT value.
like:
<weight>5800</weight>
<weight>7400</weight>
<weight>4200</weight>
...
and you want a target structure like:
<unboundedelement>
<element1>5800<element1>
<element1>7400<element1>
<element1>4200<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
For this ist looks very easy just map the Weightelement in Kontext of the hole message or some higher level tag to your element1 in the target structure.
And now you can tell me where i understand you wrong
And i will try again.
Regards,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Close, but a little bit different.
Source message WEIGHT field looks like this:
5800,7400,4200
...
And the target structure should look like this:
<unboundedelement>
<element1>5800<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
<unboundedelement>
<element1>7400<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
<unboundedelement>
<element1>4200<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
I have decided to avoid the requirements for the loop by simply changing the data type of the target message to have 4 instances of <b>unboundedelement</b>. However, I still have to split that value in WEIGHT up into multiple target fields. I believe I can use the <b>substring</b> function, in cooperation with a conditional statement to verify that something exists in that location. I'm going to try this out, and I'll let you all know if I am still stuck.
Hi,
I guess it difficult to change the context with a substring function.
try to put the value into a user-function.
There you can split the value in a loop with substring.
And in the loop you will set the value and change to context on the target structure:
result.addValue(ActualValue);
result.addContextChange();
Regards,
Robin
Hi Harrison:
(1) First I need to know how to create that loop.
--> In your integration repository goto software component SAP BASIS.
There are examples (See multi-mapping)!
Regards Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Name: MultipleFlightBookingCoordination
Namespace: http://sap.com/xi/XI/Demo/Agency
Software Component: SAP BASIS 6.40
--> Split of a multiple booking order and merge of single confirmations
Regards Mario
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.