cancel
Showing results for 
Search instead for 
Did you mean: 

Question about File Content Conversion and parent-child relationships...

0 Kudos

Hello!

I have read probably every blog, article and SAP Help document on the topic, but I am stuck on this one. I am trying to convert a General Ledger flat file to an IDoc using the classic file --> IDoc scenario. The setup is done and working, but the IDocs are formatted incorrectly and I believe at least part of the reason is how I am converting the file content.

The root of my problem is that the flat file has a parent-child relationship between the document header and the document item and I want to maintain that since the IDoc type (FIDCCP01) has the same structure in the BKPF and BSEG segments.

Here is the flat (non-XML) file layout that is coming into the file adapter:

FileHeader

DocumentHeader

DocumentItem

...

...

...

DocumentHeader

DocumentItem

...

...

...

and so on (until the number of documents is complete

I would really like the content to be converted so that the line items stay under their parent document headers like this:

<FileHeader></FileHeader>

<DocumentHeader>

<ItemHeader>

...

...

...

</ItemHeader>

</DocumentHeader>

<DocumentHeader>

<ItemHeader>

...

...

...

</ItemHeader>

</DocumentHeader>

.....

But I keep getting this, where it lists the document headers first (one after another), and then all of the line items after the document headers like this:

<FileHeader></FileHeader>

<DocumentHeader></DocumentHeader>

<DocumentHeader></DocumentHeader>

<DocumentHeader></DocumentHeader>

<ItemHeader></ItemHeader>

Is is possible to maintain that parent-child relationship from the flat file and pass it over to the XML?

Thanks,

John

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hey Satish;

You certainly got me in the right direction. I was able to at least get the line items underneath their respective document headers so there is the correspondence within the XML.

The rest of the change was in the message type; I move the line item to the same level as the document header, instead of a level below, and now the message is getting mapped correctly.

Thanks!

John

Former Member
0 Kudos

Good to know John.

Cheers,

---Satish

Former Member
0 Kudos

John,

If you have any key field between the document header and item then you can read easily using the file adapter.

Regards,

---Satish

0 Kudos

Hi Satish;

Thanks for the help; I thought I may have had it fixed but it is just acting differently now.

There is a common field value between the document header and document line item (the document sequence field), but I am unsure how to configure the file adapter to lay down the XML the way I want it to. I tried using the same key field name for the document header and document line item, but then it does not put in the tag for the line item, it just uses the document header tag (because the key field is the same). So I end up with this:

<FileHeader>.....</FileHeader>

<DocumentHeader>

......

......

</DocumentHeader>

<DocumentHeader>

......

......

</DocumentHeader>

<DocumentHeader>

......

......

</DocumentHeader>

instead of:

<FileHeader>.....</FileHeader>

<DocumentHeader>

<Document Line Item>

......

......

</Document Line Item>

</DocumentHeader>

<DocumentHeader>

<Document Line Item>

......

......

</Document Line Item>

</DocumentHeader>

Thanks,

John

Former Member
0 Kudos

Hi,

Check some links on FCC.

/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1

/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter

/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1

/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2

/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter

/people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns

/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem

/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm

Regards,

Phani

Reward points if Helpful