cancel
Showing results for 
Search instead for 
Did you mean: 

File content conversion question

AntonioSanz
Active Participant
0 Kudos

Hi all,

I have a flat file input structure like this:

HEADER,.....

LINE,........

RECORD,....

RECORD,....

RECORD,....

LINE,.....

RECORD,.....

RECORD,.....

It is possible to build a xml structure like

<RECORDSET>

</HEADER>

    <LINE>

        </RECORD>

        </RECORD>

        </RECORD>

    </LINE>

    <LINE>

        </RECORD>

        </RECORD>

        </RECORD>

    </LINE>

    .....

I have tried and I only get (all the records are at the same level):

<RECORDSET>

</HEADER>

</LINE>

</RECORD>

</RECORD>

</RECORD>

</LINE>

</RECORD>

</RECORD>

</RECORD>

I als want to ask if it possible to define a key, with is buitl upon in to fields (message type | submmessage), for instance:

01|00|.........

01|01|.......

01|01|.........

02|00|.....

02|01|.....

01 will be message (for instance orders), and 00 header, and 01 lines

and 02 will be other message and 00 will be header and 01 lines

Thanks!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

i think you need to redesign your msg struc somethinglike:

recordset

     record

          header number

          line item number

          field1

          field2 etc

then after FCC you will get structure something like recordset having multiple records each with a header number data, line item number data, field1 data, field2 data etc.

former_member184681
Active Contributor
0 Kudos

Hi Antonio,

I have some bad news for you: creating hierarchical structures is not possible with FCC. You can only achieve structures like the one you have now. I think you have three possibilities here:

1. Use some Java/XSLT mapping before the "main" mapping to adjust the structure from FCC to your needs.

2. Write your own adapter module that you will use instead of FCC.

3. Agree to work with the structure that is generated by FCC and map it as-is to the target structure .

For the additional key - it isn't really necessary, as PI will start the new Header when the new line with key 00 appears, and assign the following lines to that particular header, based on their sequence.

Hope this helps,

Greg

iaki_vila
Active Contributor
0 Kudos

Hi everyone,

Grzegorz, i think is possible to make an hierarchical structure with a maximum deepht of three levels, isn't it?, may be i misundertand something of Antonio's requeriments

In SAP documentation show how make an structure like this:

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

<ns:MT_Input xmlns="urn:bit450.com/xi/00">

<Input>

<prefix>

   <agency>London</agency>

   <date>20.04.2004</date>

</prefix>

<main>

  <product>DAR</product>

  <contract>1100</contract>

  <total>0000123456,00</total>

  <GPnum>1234567890</GPnum>

...

Antonio, Is a structure like that, you want to create?

Regards.

former_member184681
Active Contributor
0 Kudos

Hi Iñaki,

You are right that FCC handles the structures that are up to 3 levels deep. But Antonio's structure seems even more complex:

<MessageType>

    <Header>

      <Field1/>

      ...

      <Line>

         <Field2/>

         ...

         <Record>

            <Field3/>

            ...

         </Record>

      </Line>

      ...

   </Header>

   <Header>

   ...

</MessageType>

As you can see, Field3 is on fourth level (or even fifth, if you count the message type). And what is also impossible with FCC, the Header contains both: fields and substructures. Would you agree with that?

Regards,

Greg

AntonioSanz
Active Participant
0 Kudos

Thanks Greg,

but regarding the key:

I've got 00|00 or 00|01  I mean, if I have 00|00 I have to map to a record, and if I have 00|01 I have to map to another differente record. Is that possible?

former_member184681
Active Contributor
0 Kudos

Hi Antonio,

I'm not really sure if I got it correctly now. Let me explain my understanding: in the source file, your field separator is "|" and you have two values (this 00|01) that depict:

00 -> to which consecutive Header this line belongs

| -> field separator, that is common accross the file line

01 -> which recordset structure should the line be mapped to: Header, Line or Record.

So your complete file lines look like that:

00|00|some|header|fields

00|01|further|line|fields

...

If so, you can ignore the first field (lines will be assigned to Headers based on their sequence in file) and simply use the second field to differentiate between recordset structures. And if I am wrong about my understandigng of your scenario, please let me know my mistakes, so that I could give you more details.

Regards,

Greg

AntonioSanz
Active Participant
0 Kudos

Thanks greg, let me give you more detail:

In the same file I have several message types, and each of those message have a header and lines.

First field are used to define the message type and second field to define wheter is a header or a line.

For instance:

00|00|field1|field2.....   --> Orders + Header

00|01|field1|field2......  --> Orders + Lines

01|00|field1|field2......  --> OrderResponse + Header

01|01|field1|field2......  --> OrderResponse + Lines

....

So I need the first two fields to select my record strcuture.

Does this help you?

Thanks

iaki_vila
Active Contributor
0 Kudos

Thanks Grzegorz,

I was understood this structure:

<RECORDSET>

  <HEADER> </HEADER>

<LINE>

     <RECORD></RECORD>

     <RECORD></RECORD>

     <RECORD></RECORD>

</LINE>

<LINE>

     <RECORD></RECORD>

     <RECORD></RECORD>

     <RECORD></RECORD>

</LINE>

</RECORDSET>

I agree with you then.

Thanks

former_member184681
Active Contributor
0 Kudos

Dear Antonio,

Yes, it definitely helps, now I see your requirement clearly. Unfortunately I do not know any way to get multiple Message Types out of one FCC, I'm not even sure if this is possible at all. The only solution I can think of is to write an adapter module to handle it. Or read the whole file line as a single field, then process it further in the mapping, or as a separate (Java?) pre-mapping to first achieve the required source structure, and only then map it to target.

Regards,

Greg

AntonioSanz
Active Participant
0 Kudos

OK, many thanks.