on 04-23-2008 6:45 PM
Im having a problem with mapping a source IDOC to a target XML.
The main problem is with mapping the output based on a value in the each segment and then grouping them properly.
Here is the format of the source and target (There are more fields used, I am only showing these to explain my problem.)
The Source IDOC is PPCC2RECORDER01
We are using the E1BP_PP_PDC_OPERA2 segment which can repeat basically unbounded.
example
PPCC2RECORDER01
EDI_DC40
E1PPCC2RECORDER
E1BP_PP_PDC_OPERA2
OrderID
OperationID
E1BP_PP_PDC_OPERA2
OrderID
OperationID
The Target XML looks like the folowing
<Workorders>
<WorkOrder> <!-- Occurs 0 - unbounded -->
<WorkOrderHeader> <!-- Occurs 1 per Workorder -->
<WorkOrderID></WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation> <!-- Occurs 0 - unbounded -->
<OperationID></OperationID>
</WorkOrderOperation>
</WorkOrder>
</WorkOrders>
WorkOrder in the target repeats for each unique OrderID
and WorkOrderOperation should repeat for each Operation ID contained within a WorkOrder
Here is sample input
PPCC2RECORDER01
EDI_DC40
E1PPCC2RECORDER
E1BP_PP_PDC_OPERA2
OrderID 0000111
OperationID 0010
E1BP_PP_PDC_OPERA2
OrderID 0000111
OperationID 0020
E1BP_PP_PDC_OPERA2
OrderID 0000111
OperationID 0030
E1BP_PP_PDC_OPERA2
OrderID 0000222
OperationID 0015
E1BP_PP_PDC_OPERA2
OrderID 0000222
OperationID 0025
E1BP_PP_PDC_OPERA2
OrderID 0000333
OperationID 0100
This is the output I am getting
<Workorders>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000111</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0010</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0020</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0030</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0015</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0025</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0100</OperationID>
</WorkOrderOperation>
</WorkOrder>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000222</WorkOrderID>
</WorkOrderHeader>
</WorkOrder>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000333</WorkOrderID>
</WorkOrderHeader>
</WorkOrder>
</WorkOrders>
This is the desired output
<Workorders>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000111</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0010</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0020</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0030</OperationID>
</WorkOrderOperation>
</WorkOrder>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000222</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0015</OperationID>
</WorkOrderOperation>
<WorkOrderOperation>
<OperationID>0025</OperationID>
</WorkOrderOperation>
</WorkOrder>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000333</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0100</OperationID>
</WorkOrderOperation>
</WorkOrder>
</WorkOrders>
How can I get this to map the way I want? I have tried many different mappings some result in the error message "Cannot produce target element WorkOrders/WorkOrder/WorkOrderOperation[4]/OperationID. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd"
Thanks,
Tim
Hi,
try this,
You can use FormatByExample function to solve problem.
follow the below steps,
FormatByExample(node function)-->OperationID(TargetField)
FormatByExample function required 2 inputs. which are as follows,
1) OperationID>RemoveContext>
2) OrderID>RemoveContext>SplitByValue(Value Change)-->
I think this will solve your problem,
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the replys, I looked at the OneToMany option and it didn't seem to fit the problem I am having, unless I'm not understanding how it works.
It does seem that the FormatByExample looks like it might do what I am looking for, however when I use this I still get a error when I try to test the mapping. Here is the error
Cannot produce target element /WorkOrders/WorkOrder[2]/WorkOrderOperation/OperationID. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd.
When I look a the display queue on the FormatByExample it looks like the context change happens at the right place. I suspect that the OperationID queue is empty by the time the IE tries to map the values for the second WorkOrder. Could this be true and if so how can I get those values to display in the second, third...etc WorkOrders where they belong?
OK,,, So I'm a little closer. I have the first OperationID for each Workorder comming out, but the other OperationIDs are being dropped. Here is a sample of what is coming out now
<Workorders>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000111</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0010</OperationID>
</WorkOrderOperation>
</WorkOrder>
<WorkOrder>
<WorkOrderHeader>
<WorkOrderID>0000222</WorkOrderID>
</WorkOrderHeader>
<WorkOrderOperation>
<OperationID>0015</OperationID>
</WorkOrderOperation>
</WorkOrder>
</WorkOrders>
Looks like it needs to be a change in the mapping for WorkOrderOperation, any Ideas on what this mapping needs to be? Right now I have
OperationID -> RemoveContext -> SplitByValue(each value) -> WorkOrderOperation
I've trie to use the FormatByExample as shown above only going to WorkOrderOperation instead of OperationID, but get the Error message I mentioned above.
Thanks,
Tim
Hi Timothy,
Here is the error
Cannot produce target element /WorkOrders/WorkOrder[2]/WorkOrderOperation/OperationID. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd.
1)This error comes only when your context is mismatched.
2)You have to apply my above solution only for OperationID node not for WorkOrderID.
3)You need only three node of WorkOrderID as per your above example.
4)If you want logic for WorkOrderID node also then try this,
OrderID>RemoveContext>Sort(NodeFunction)>SplitByValue(ValueChange)>CollapsContext-->WorkOrderID.
This will solve your problem.
Regards,
Rohit.
Reward points if solution is helpful.
Hi Timothy,
try the function "useOneAsMany"
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping (to know how to use the three parameters)
Regards
Mickael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.