cancel
Showing results for 
Search instead for 
Did you mean: 

FCC - Hierarchical Structure - Sender Channel

jegathees_waran
Active Participant
0 Kudos

Hello Friends,

Our input csv file contains Purchase Order details, arranged with Header and Details like below.

-------------------------------------------------------

H,100

D,S101,Screw 2,5,NOS,2.00

D,S102,Screw 3,6,NOS,3.00

H,101

D,V100,V Belt A-48,1,NOS,4.25

H,102

D,G101,Grease A-51,2,KGS,629.50

D,G102,Grease A-52,3,KGS,350.21

D,G103,Grease A-53,4,KGS,225.10

-------------------------------------------------------

The input structure (Message Type) to receive this data we designed like below.:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_PurchaseOrder xmlns:ns0="http://abc.com/PI/TEST">

   <PurchaseOrder>

      <OrderNo>100</OrderNo>

      <ItemDetails>

         <ItemNo>S101</ItemNo>

         <Description>Screw 2</Description>

         <Qty>4</Qty>

         <UOM>Nos</UOM>

         <Price>110.00</Price>

      </ItemDetails>

      <ItemDetails>

         <ItemNo>S102</ItemNo>

         <Description>Screw 3</Description>

         <Qty>5</Qty>

         <UOM>Nos</UOM>

         <Price>120.00</Price>

      </ItemDetails>

   </PurchaseOrder>

   <PurchaseOrder>

      <OrderNo>101</OrderNo>

      <ItemDetails>

         <ItemNo>G101</ItemNo>

         <Description>Grease 2 T</Description>

         <Qty>2</Qty>

         <UOM>Kgs</UOM>

         <Price>180.00</Price>

      </ItemDetails>

   </PurchaseOrder>

</ns0:MT_PurchaseOrder>

This input XML taken from the message mapping. In this structure <PurchaseOrder> node occurrence is 0..unbounded and <ItemDetails> node occurrence is 0..unbounded. Then <ItemDetails> node in under the parent node <PurchaseOrder>.

We use the same Message Type for inbound interface (receiver). Mapping is simple one-to-one mapping.

In the sender channel, we have specified the FCC parameters are as below.

Document Name: MT_PurchaseOrder

Document Namespace: http://abc.com/PI/TEST

Recordset Structure: PurchaseOrder,*,ItemDetails,*

Recordset Sequence: Ascending

Recordsets per Message: *

Key Field Name: key

--------------------------------------------------------------------

PurchaseOrder.fieldSeparator  : ,

PurchaseOrder.fieldNames: key,OrderNo

PurchaseOrder.keyFieldValue: H

PurchaseOrder.keyFieldInStructure: ignore

PurchaseOrder.endSeparator: 'nl'

ItemDetails.fieldSeparator: ,

ItemDetails.endSeparator: 'nl'

ItemDetails.fieldNames: key,ItemNo,Description,Qty,UOM,Price

ItemDetails.keyFieldValue: D

ItemDetails.keyFieldInStructure: ignore

ignoreRecordsetName: true

--------------------------------------------------------------------

When we place the input file and test, the adapter converts into XML format. In this XML, <PurchaseOrder> end tag comes immediately after end tag of Order No field. </OrderNo>.  Whereas in the design time mapping check, </PurchaseOrder> end tag comes after last item details node in each purchase order. Due to this <PurchaseOrder> tag misplace, in the output XML, <ItemDetails> node mapping is skipped. Really we don't understand why this. I have attached the input.xml and output.xml for your reference.

Friends, could you please clarify, how to fix this.

Kind regards,

Jegathees P.

Accepted Solutions (0)

Answers (4)

Answers (4)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Since this requirement has two level relationship and it' not easy to fit using the recordset structure definition, as I already mentioned above you cannot handle just using File content conversion parameters.  Follow other alternate options.

Plus you get Header followed by items in a repeated fashion.

zameerf
Contributor
0 Kudos

Hello,

You may want to check this below thread which also has a similar scenario.

http://scn.sap.com/thread/1969830

-Zameer

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Just few cents...

I see you wrap ItemDetails inside purchaseorder. But Recordset Structure says

Recordset Structure: PurchaseOrder,*,ItemDetails,*

Is that right?

jegathees_waran
Active Participant
0 Kudos

Hi Baskar,

It is right. Because, an input file contains n number of purchase orders, and each purchase contains contains one or n number of items. (Though if we put "PurchaseOrder,1,ItemDetails,*", the input and output XMLS are same, there is no difference).

Any clue Baskar?

baskar_gopalakrishnan2
Active Contributor
0 Kudos

This is two level relationship structure.  THe given Recordset structure would not work. THinking about other options. In the meantime try as below

provide just PurchaseOrder,*    see how that behaves.

Plus, PurchaseOrder fieldNames does not contain Items, so the output.xml would not show the items inside purchase order.

former_member184681
Active Contributor
0 Kudos

Hi,

You need a small change to your FCC configuration. Add "PurchaseOrder" as a value for Recordset Name attribute that you did not use so far. In addition to that, add the following to the attributes list:

PurchaseOrder.ignoreRecordsetName = true

Regards,

Greg

jegathees_waran
Active Participant
0 Kudos

Hello Grzegorz

Thank you for your immediate reply. As you said, I have entered Recordset Name: PurchaseOrder in the channel and added FCC parameter PurchaseOrder.ignoreRecordsetName = true. And executed the scenario. Still the same error I am getting. There is no change in the input.xml and output.xml.

Really I am wondering what is the mistake?, why the system adds

</PurchaseOrder> tag immediately after

</OrderNo> tag ,  instead at the end of the

</ItemDetails> in each purchase order. This is causing the trouble.

Any idea Grezegorz?



former_member184681
Active Contributor
0 Kudos

Hi,

I think I can see the problem now, and I have to admin that I was wrong. The solution to prepare has to be a little bit more complex. Required changes, comparing to your initial setup, are:

  1. Recordset Name = PurchaseOrder, as I said initially.
  2. Do NOT use ignoreRecordsetName.
  3. Change the name of the "header" structure name, for instance to Header. So you will have: Recordset Structure = Header,*,Item,*. Then adjust the attributes below accordingly (Header.fieldSeparator and so on).
  4. Use Nodeception as described by in his blog here:   to delete the <Header> and </Header> tags (but leave the contents of this tag as they were). Unfortunately this would require using a Java mapping & Operation Mapping, but the whole source code was already prepared by Shabarish, so I believe it's not a problem.

I hope this solves your problem finally. And once again apologies for my initial mistake.

Greg

jegathees_waran
Active Participant
0 Kudos

Hi Grezegorz,

Sorry for the delay. Thanks for your hints and reply. I will try the options and follow what Sabarish suggested and let you know.

Thank you very much.

Hi Baskar,

This would be the alternate approach to fix my issue I believe.  Thanking you for your guidance and reply.