cancel
Showing results for 
Search instead for 
Did you mean: 

Fixed Length File Mapping - Record Type Order issue

Former Member
0 Kudos

Hello,

I have the folowing scenario.

I need to read in to PI (V7.1) a file containing records of fixed length. My issue is my input file is in the following format

I have simplified my structure to highlight my problem.

.e.g record type, Invoice reference, data (for simplicity)

0000 File header info

0001 Invoice 1 header data etc

0001 Invoice 2 header data etc

0001 Invoice 3 header data etc

0002 Invoice 1 item data etc

0002 Invoice 2 item data etc

0002 Invoice 3 item data etc

0003 Invoice 1 tax data etc

0003 Invoice 2 tax data etc

0003 Invoice 3 tax data etc

Each record has the invoice number in a data field for reference. but as the rows are sorted by record types there are not in order. i.e. the row above has no connection to the row below. The only thing linking the record types is the field invoice number which is on all the file rows.

I would ideally like the file sent to me in the following format (i.e. sorted) but this is not possible

0000 File header info

0001 Invoice 1 header data etc

0002 Invoice 1 item data etc

0003 Invoice 1 tax data etc

0001 Invoice 2 header data etc

etc etc

How can I sort such data on the fly so I can map to the IDOC structure in a easier way. Do I have to pre-map or am I missing something? Any help would be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

> How can I sort such data on the fly so I can map to the IDOC structure in a easier way. Do I have to pre-map or am I missing something? Any help would be appreciated.

Just a thought. You can use fcc to read this file using the below recordset structure.

File Header 1 to 1

--> Keyfield 0000

--> info

Header 1 to unbounded

--> Keyfield 0001

--> Invoice reference

data

Item 1 to unbounded

--> Keyfield 0002

--> Invoice reference

--> item data

Tax 1 to unbounded

--> Keyfield 0003

--> Invoice reference

--> tax data

Recordset Structure FileHeader, 1, Header, * , Item, * , Tax,*

This link might be helpful to some extent.

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

Answers (1)

Answers (1)

former_member518917
Participant
0 Kudos

Steps

Step1 : First do the content conversion to group the header , Items and Tax records.

keys 0001 for header

0002 for Item

0003 for Tax

Output of content conversion would be like

Header

.......all header recods

Item

.......all Itemrecods

Tax

.......all Taxrecods

Now In message Mapping

Mapping of InvoiceReference :

InvoiceReference (Context change to Message type) -> sort -> SplitByValue -> InvoiceReference (targetField)

Mapping of rest of the target field (say RecordType)

InvoiceReference (Context change to Message type) -\

-


sortByKey -> SplitByValue ->RecordType (targetField)

RecordType (Context change to Message type)---/