Hi Experts,
I am doing the Message Mapping as mentioned in the below blog. I am getting the Error as
05:15:46 Start of test
Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Too few values in the first queue in function useOneAsMany. It must have the same number of contexts as the second queue] in class com.sap.aii.mappingtool.flib7.NodeFunctions method useOneAsMany[[Ljava.lang.String;@478d13c, [Ljava.lang.String;@17f0bc6f, [Ljava.lang.String;@3de327b0, com.sap.aii.mappingtool.tf7.rt.ResultListImpl@c42b38e, com.sap.aii.mappingtool.tf7.rt.Context@6f1a35eb]
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Too few values in the first queue in function useOneAsMany. It must have the same number of contexts as the second queue] in class
I have searched in other blog also and ended up with the same error. Please check and do the needful.
The Basic Problem
We have an IDoc ORDERS05 with purchase order information where each purchase order line item (represented by segment .<E1EDP01>) can contain multiple schedule lines (represented by segment <E1EDP20>). For example, we have 2 line items with 3, resp. 2 schedule lines. Then the corresponding portion of message ORDERS05 can look as follows:
...
<E1EDP01>
<POSEX>00010</POSEX>
<E1EDP20 SEGMENT="1">
<WMENG>15</WMENG>
</E1EDP20>
<E1EDP20 SEGMENT="1">
<WMENG>44</WMENG>
</E1EDP20>
<E1EDP20 SEGMENT="1">
<WMENG>3</WMENG>
</E1EDP20>
</E1EDP01>
<E1EDP01>
<POSEX>00020</POSEX>
<E1EDP20 SEGMENT="1">
<WMENG>32</WMENG>
</E1EDP20>
<E1EDP20 SEGMENT="1">
<WMENG>12</WMENG>
</E1EDP20>
</E1EDP01>
...
We want to map the information of the IDoc ORDERS05 to the message OrderCreate of the CIDX v4.0 standard. This message uses a more flat
structure where the purchase order line items and the corresponding schedule lines are on the same level. The corresponding portion of the
message OrderCreate (for the same information as in the IDoc) looks as follows:
...
<OrderCreateProductLineItem>
<PurchaseOrderLineItemNumber>00010</PurchaseOrderLineItemNumber>
<ProductQuantity>15</ProductQuantity>
</OrderCreateProductLineItem>
<OrderCreateProductLineItem>
<PurchaseOrderLineItemNumber>00010</PurchaseOrderLineItemNumber>
<ProductQuantity>44</ProductQuantity>
</OrderCreateProductLineItem>
<OrderCreateProductLineItem>
<PurchaseOrderLineItemNumber>00010</PurchaseOrderLineItemNumber>
<ProductQuantity>3</ProductQuantity>
</OrderCreateProductLineItem>
<OrderCreateProductLineItem>
<PurchaseOrderLineItemNumber>00020</PurchaseOrderLineItemNumber>
<ProductQuantity>32</ProductQuantity>
</OrderCreateProductLineItem>
<OrderCreateProductLineItem>
<PurchaseOrderLineItemNumber>00020</PurchaseOrderLineItemNumber>
<ProductQuantity>12</ProductQuantity>
</OrderCreateProductLineItem>
...
The data in red correspond to data of the segment <E1EDP01>, while the information in blue correspond to data of the segment <E1EDP20> of the original IDoc. Note that the data in red need to be duplicated based on the occurence of segment <E1EDP20>.
Solution 1
A simple solution of this mapping problem exists under the assumption that in the IDoc ORDERS05 each segment <E1EDP01> contains at least one segment <E1EDP20>. Luckily this assumption holds true for IDocs created via the purchase order creation process in ERP.
- 1. Mapping of <OrderCreateProductLineItem>
The segment <OrderCreateProductLineItem> of the target structure needs to be created once for each occurrence of segment <E1EDP20> of our source structure. This can easily be achieved via the following mapping:
Remember to change the context to IDOC.
- 2. Mapping of <PurchaseOrderLineItemNumber>
Since the information for the node <PurchaseOrderLineItemNumber> comes from the IDoc segment <E1EDP01>, this node needs to be replicated based on the occurrence of segment <E1EDP20> under each segment <E1EDP01>. This can be achieved using the node functionuseOneAsManyas follows:
I will not describe the functionality of the node functionuseOneAsManyin detail since there is a lot of excellent documentation available on this function, for example in theSAP help. In our scenario you only need to change the context of the second input parameter to E1EDP01.
With the sample input from above, the functionuseOneAsManywill give the following result:
- 3. Mapping of <ProductQuantity>
Since the <ProductQuantity> is derived from a value of the IDoc segment <E1EDP20> the mapping for this field is trivial (remember that <ProductQuantity> must occur once per <E1EDP20> segment):
Please check the error and guide me how to proceed further.
Regards,
GIRIDHAR