Dynamic Mapping: SalesOrder to PurchaseOrder(s)

Home Page Forums BizTalk 2004 – BizTalk 2010 Dynamic Mapping: SalesOrder to PurchaseOrder(s)

Viewing 1 reply thread
  • Author
    Posts
    • #15010

      Hello, and thanks for assisting.

      This seems like it should be relatively easy, My Orchestration recieves a in SalesOrder and must send out PurchaseOrder(s). A SalesOrder can contain multiple lineItems, each lineItem contains a Supplier. Similar to the schema below:

      <SalesOrder FirstName=\”first_name\” LastName=\”last_name\”>
      <OrderLineItems>
      <LineItem ProductId=\”product_1\” Supplier=\”supplier_1\” Quantity=\”1\” />
      <LineItem ProductId=\”product_2\” Supplier=\”supplier_1\” Quantity=\”1\” />
      <LineItem ProductId=\”product_3\” Supplier=\”supplier_2\” Quantity=\”1\” />
      <LineItem ProductId=\”product_1\” Supplier=\”supplier_2\” Quantity=\”1\” />
      <LineItem ProductId=\”product_6\” Supplier=\”supplier_1\” Quantity=\”1\” />
      </OrderLineItems>
      </SalesOrder>

      What I need to do, is take the SalesOrder and create PurchaseOrder(s), the PurchaseOrder contains a list of all lineItems from the SalesOrder that go to a Supplier. Based upon the above SalesOrder the output of PurchaseOrders is shown below:

      <PurchaseOrder FirstName=\”first_name\” LastName=\”last_name\” Supplier=\”supplier_1\”>
      <OrderLineItems>
      <LineItem ProductId=\”product_1\” Quantity=\”1\” />
      <LineItem ProductId=\”product_2\” Quantity=\”1\” />
      <LineItem ProductId=\”product_6\” Quantity=\”1\” />
      </OrderLineItems>
      </PurchaseOrder>

      <PurchaseOrder FirstName=\”first_name\” LastName=\”last_name\” Supplier=\”supplier_2\”>
      <OrderLineItems>
      <LineItem ProductId=\”product_3\” Quantity=\”1\” />
      <LineItem ProductId=\”product_1\” Quantity=\”1\” />
      </OrderLineItems>
      </PurchaseOrder>

      The difficulty that i am running into is that the number of suppliers is unknown and constantly changing, as well the SalesOrder will be broken down from 1 PurchaseOrder to Multiple PurchaseOrders. After the PurchaseOrder is created it is sent off to another Orchestration.

      Could you please help me by pointing me in the right direction, do I do some sort of loop of the LineItems and with each lineItem check to see who the supplier is and add that item to the associated PurchaseOrder? Can I dynamically create multiple instances of a purchaseOrder to hold the information? How would I send the created PurchaseOrders to another Orchestration, seeing as the number of PurchaseOrders is dynamic, based on the number of Suppliers?

      Should i use a ‘Transform’ and use the Biztalk mapper to do this? Any suggestions on how this would be accomplished?

      Thanks for your help.
      –Steven

    • #15011

      Greg,

      As always thanks for your information, it led me in the right direction and I got what was needed complete.

      Thanks,
      –Steven

      • #15012

        You will need a two stage process one to group the LineItems by supplier and one to split the document into separate purchase orders.

        There are a number of ways to group the line items
        [url]http://www.biztalkgurus.com/Samples/Sorting-Grouping.html[/url]

        my preferred method is using a custom Xslt with <xsl:key>
        [url]http://www.biztalkgurus.com/forums/viewtopic.php?t=637[/url]

        To first link also show how to debtach the purchase orders

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.