cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping One file to Many Idocs

Former Member
0 Kudos

Hello Guru’s,

I have a  mapping to do, and I’m a little bit lost. 

I have a XML file, and I need to generate for each file one to many Idocs following the OrderNumber.

The XML structure and the Idoc DELVRY05 rules for this mapping are explain next.

I have change the definition of the  Idoc in MM with "<xsd:element name="IDOC" type="DESADV.DELVRY05" maxOccurs="unbounded"/>" to allow more than one idocs.

ASN xml file

<ns0:MT_ASN xmlns:ns0="www.bia.be:komatsu">

               

                               <InvoiceNumber>PSI/13002432</InvoiceNumber>

                               <Supplier>

                                               <Identifier>Supplier1</Identifier>

                                               <Name>Supplier</Name>

                                               ...

                               </Supplier>

                               <ShipTo>

                                               <Identifier>Supplier1</Identifier>

                                               <Name>Supplier</Name>

                                               ...

                               </ShipTo>

                               <Invoicee>

                                               <Identifier>Supplier1</Identifier>

                                               <Name>Supplier</Name>

                                               ...

                               </Invoicee>

                               <Case Identifier="Box 1" Type="Carton">

                                               <CaseSize Unit="CM" Height=" 21" Length="  42" Width="  25"/>

                                               <CaseWeight Unit="KG" Gross=" 14.00" Net=" 13.70"/>

                                               <Line Number="1">

                                                               ….

                                                               <OrderNumber>10</OrderNumber>

                                                               <OrderLineNumber>   1</OrderLineNumber>

                                               </Line>

                                               <Line Number="2">

                                                               ….

                                                               <OrderNumber>10</OrderNumber>

<OrderLineNumber>   2</OrderLineNumber>

                                                               …

                                               </Line>

                                               <Line Number="3">

                                                               ….

                                                               <OrderNumber>10</OrderNumber>

                                                               <OrderLineNumber>   4</OrderLineNumber>

                                                               …

                                               </Line>

                                </Case>

                               <Case Identifier="Box 2" Type="Carton">

                                               <CaseSize Unit="CM" Height=" 21" Length="  42" Width="  25"/>

                                               <CaseWeight Unit="KG" Gross=" 14.00" Net=" 13.70"/>

                                               <Line Number="1">

                                                               ….

                                                               <OrderNumber>10</OrderNumber>

                                                               <OrderLineNumber>   3</OrderLineNumber>

                                                               …

                                               </Line>

                                               <Line Number="2">

                                                               ….

                                                               <OrderNumber>10</OrderNumber>

                                                               <OrderLineNumber>   5</OrderLineNumber>

                                                               …

                                               </Line>

                                </Case>

             <Case Identifier="Box 3" Type="Carton">

                                               <CaseSize Unit="CM" Height=" 21" Length="  42" Width="  25"/>

                                               <CaseWeight Unit="KG" Gross=" 14.00" Net=" 13.70"/>

                                               <Line Number="1">

                                                               ….

                                                               <OrderNumber>11</OrderNumber>

                                                               <OrderLineNumber>   1</OrderLineNumber>

                                                               …

                                               </Line>

                                               <Line Number="2">

                                                               ….

                                                               <OrderNumber>11</OrderNumber>

                                                               <OrderLineNumber>   2</OrderLineNumber>

                                                               …

                                               </Line>

                                               <Line Number="3">

                                                               ….

                                                               <OrderNumber>11</OrderNumber>

                                                               <OrderLineNumber>   3</OrderLineNumber>

                                                               …

                                               </Line>

                                </Case>

                </Message>

</ns0:MT_ASN>

Idoc Splitting

  1. Order Number                 --> 1 Idoc per Order
  2. OrderLineNumber            --> 1 segment per order Item E1EDL24 for the order
  3. Case                              --> 1 segment E1EDL37 per case for the Order Number
  4. Line Number                   --> 1 segment E1EDL44 per line in the case

Thanks a lot

Jean-Claude

Accepted Solutions (1)

Accepted Solutions (1)

ambrish_mishra
Active Contributor
0 Kudos

Hi Jean-Claude,

From the example, this is what I could gather. Hope it is correct understanding else please share the screenshot of mapping with source structure clearly shown and I can suggest on mapping.

In this case, 2 IDoc should be created one each for Order Number 10 and 11 ?

First IDoc should have 9 E1EDL24 segments and the second one 3.

For IDoc creation, map OrderNumber with higher context to IDoc node using SplitByValue(Value Change) - > CollapseContext. this should create the IDoc nodes.

For Line Item segment E1EDL24, map OrderNumber with higher context to IDoc node using SplitByValue(Value Change) to E1EDL24 node

For E1EDL37,you should have 2 segments for first order and 1 for second.

OrderNumber (context Case) -> collapseContext - > Split by Value (ValueChange)

Similarly, you have to play around with context of Order Number field even though you have to create E1EDL44 based on LineNumber

Hope it helps.

Ambrish

Former Member
0 Kudos

Thanks Ambrish,

Now I have a problem with Segment E1EDL20.  This one have to created with some header data (always the same for each Idoc coming from one XML File).

I have one segment E1EDL20 per Idoc, and when I apply the same mapping that for Idoc, I have the following message in testing

" Cannot create target element /DELVRY05/IDOC[2]/E1EDL20. Values missing in queue context."

What's the problem

For the other segments, your mapping is correct.

Thanks a lot.

JC

Former Member
0 Kudos

Hello Ambrish,

Thanks a lot for your sample of mapping, it works fine now.

JC

ambrish_mishra
Active Contributor
0 Kudos

Hi JC,

You can simply map it to a constant value since it is a header segment and should always be created.

For the field level, if they can follow the same rule you followed for IDoc creation with collapseContext. Take the first value from the set of values and populate the target field.

If you have any doubts, give me a sample field and which value you want populated from source and I can help you further.

Ambrish

Former Member
0 Kudos

Hello Ambrish,

In segment E1EDL20, I need PO Date and PO Number (from Vendor) coming from 

<Document Identifier="13002432" Date="20130524" Function="9"/> on the same level than <Case>

Where  E1EDL20-PODAT = Date

      and E1EDL20-LIFEX  =  Identifier

I have also the Segment E1EADRM1 (3 times) for the partner base on :

      <Supplier>

            <Identifier/>

            <Name/>

            <StreetAndNumber/>

            <CityName/>

            <Country/>

        </Supplier>

        <ShipTo>

            <Identifier/>

            <Name/>

            <StreetAndNumber/>

            <CityName/>

            <Country/>

        </ShipTo>

        <Invoicee>

            <Identifier/>

            <Name/>

            <StreetAndNumber/>

            <CityName/>

            <Country/>

        </Invoicee>

All this are correct for the first Idoc, but not exists for the others

Thanks a lot for your help.

JC

ambrish_mishra
Active Contributor
0 Kudos

Hi JC,

First on field population of header segment E1EDL20.

the source node <Document Identifier="13002432" Date="20130524" Function="9"/> is at the same level as Case but whats the occurence. If it occurs once per Order, map the fields directly. I don't see the segment in the structure above so I am not confident.

for adrm1 segment, use duplicate subtree twice and create the segment always by mapping to a constant value. For field level, do if Identifier = X, map source field to target field. I am sure the ADRM1 segment will be populated based on identifiers.

Hope it helps!

Ambrish

Former Member
0 Kudos

Hello Ambrish,

Now it's work fine.

For other Segment (always the same in each Idoc), I have used the Graphical Variable, like explain in the William Li's blog

http://scn.sap.com/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-gra...

Thanks a lot for your help.

JC

ambrish_mishra
Active Contributor
0 Kudos

Glad it worked!

Former Member
0 Kudos

Hi Jean,

I am running into same issue. I need to create one IDOC i.e. E1EDL20 per Load number(Like Order number in your case)  and many  E1EDL24s per each different Items(Like order lene number in your case).

I am not able to map many E1EDL24s under one E1EDL20. If you can share your mapping, it will be very helpful.

Thanks in advance...

By

Satish

Answers (0)