cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic Header handling in File(Fixed length) to Proxy scenario

Former Member
0 Kudos

Dear all,

My souce file may get n number of headers and trailers.

I need to group as the below file structure.

My file structure is

H(Header Detail record),D(Detail Record)

<ROOT>

H1

D1,D2,D3.......

H2

D1,D2,D3,...

...

...

...

...

HN

D1,D2...

</ROOT>

my question is can this structure handled in SAP PI?

if yes give me pointers on how to handle .

Thanks,

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sree, you didnot specify about the trailer in the file structure...and also elaborate more on the file strcuture and file coming in...

Former Member
0 Kudos

There is no Trailer

That Structure has multiple headers and detail records which is a .txt file .

I need to segregate header with its details the second header with its details and third header with its details.

Please let me know how to handle this (mapping and FCC) .

Eg:

Header1 x w e c n
a d e f g
Header2 d
w d
Header3 g
z d g h

..

...

Header n a

there will be 1 key value to differentiate bet header and detail

THANKS,

SREE

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You might want to check this blog that gives idea about pattern recordset structure.

http://scn.sap.com/people/shabarish.vijayakumar/blog/2005/06/08/content-conversion-patternrandom-con...

former_member184681
Active Contributor
0 Kudos

Hi,

Use the following set of parameters for FCC:

Recordset Name = Document
Recordset Structure = Header,*,Item,*
Recordset Sequence = Ascending (this is very important for further mapping)
Key Field Name = LineType

Header.fieldNamesLineType,Field1,Field2
Header.fieldSeparator;
Header.endSeparator'nl'
Header.keyFieldValueH
Item.fieldNamesLineType,Field3,Field4
Item.fieldSeparator;
Item.endSeparator'nl'
Item.keyFieldValueD

As a result, you will get the following source structure for each document that occurs
<Document>
<Header>
<LineType>H</LineType>
<Field1>content</Field1>
<Field2>content</Field2>
</Header>
<Item>
<LineType>D</LineType>
<Field3>content</Field3>
<Field4>content</Field4>
</Item>
...
</Document>

Some more important design points:

  • You need a field that will let PI distinct between Header and Item. In my example, it is LineType, that equals H for header lines and D for details, but of course this can be any value anywhere in the structure. It doesn't even have to be at the beginning of the line.
  • Thanks to Recordset Sequence = Ascending, you will get a new Root each time a new Header occurs. This will allow you to do the mapping properly.
  • After you perform a source conversion like this, you can go on with the scenario as usually, building graphical mapping or anything else you need.


Hope this helps,
Greg

Former Member
0 Kudos

In the FCC parameters u need to use the below paramters, if u have an unique identifier for header and detail records..something like the below structure..

H,1

D,1

D,2

H,2

D,3

D,3

so, H and D will be the unique identifiers for header and detail respectively.

Parameters

header.keyFieldValue

header.fieldFixedLengths or header.fieldSeparator (it depends on file)

header.endSeparator

header.fieldNames

header.processFieldNames (value should be "fromConfiguration")

detail.keyFieldValue

detail.fieldFixedLengths or header.fieldSeparator (it depends on file)

detail.endSeparator

detail.fieldNames

detail.processFieldNames (value should be "fromConfiguration")

hope this helps...

Former Member
0 Kudos

I am having multiple headers as mentioned.

if the input is h1,h2....
                   d1,d2....D may belong to h1 or h2.I could able to design it.

if the input is h1->d1,d2,dn.
                    h2->d1,d2,dn

How to design the same.

Former Member
0 Kudos

Reopening the same in other thread with exact requirement.

Former Member
0 Kudos

Hi Shree,

In order to establish relationship between header and detail records, you need to have a common field between header and detail structure that will hold disnict values for each header and same values for all detail records belonging to a particular header.

Please refer to the below example.

<Document>

<Header>

<LineType>H</LineType>

<HeadNo>123</HeadNo>

<Field1></Field1>

</Header>

<LineType>H</LineType>

<HeadNo>124</HeadNo>

<Field1></Field1>

</Header>

<Detail>

<LineType>D</LineType>

<HeadNo>123</HeadNo>

<Field2></Field2>

</Detail>

<Detail>

<LineType>D</LineType>

<HeadNo>123</HeadNo>

<Field2></Field2>

</Detail>

<Detail>

<LineType>D</LineType>

<HeadNo>124</HeadNo>

<Field2></Field2>

</Detail>

</Document>

In the above structure, we have 2 headers. The 1st header has 2 details and 2nd header has 1 detail records. Here the node <HeadNo> is used to group detail records based on headers.

In configuration, Greg has written all you need.

Hope this helps.

Thanks & Regards,

Samir

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Reopening the two threads for the similar requirements does not help author and experts. This is mere waste of time. Close one thread if you create an another one.