cancel
Showing results for 
Search instead for 
Did you mean: 

FCC with multiple structure

former_member474221
Participant
0 Kudos

Hi

This is a file to SAP scenario.

I have a txt file with header,1,body,*,Footer,1

I understand that I can read this txt file using the keyfield concept....But what if the sender application is not ready to add the key field in the txt file..??

...what are my options ??

Accepted Solutions (1)

Accepted Solutions (1)

Satyagadadas
Active Participant
0 Kudos

Hi,

   Try using the record sequence as variable which points the unique number for each record set.

Like PO number is unique per one set of "header,1,body,*,Footer,1"- PO number repeats in 1 set. .

In the mapping consider the fist line as header, rest all body except the last one as footer.

Regards,

former_member474221
Participant
0 Kudos

In my case one file will contain only one set of  "header,1,body,*,Footer,1"

will this record sequence feature work in this case?

former_member184681
Active Contributor
0 Kudos

Hi Hema,

Actually, here is what SAP Help says about the Key Field Name:

If you have entered a variable number of substructures under Recordset Structure, that is, you have entered the value * for at least one structure, specify a Key Field Name. [...] you must specify a key field, and the field name must occur in all substructures.

Based on this, it looks like Key Field is mandatory for FCC in case any structure has variable occurrence. If you still want to experiment (which might prove worth it, but I'm not sure), simply try omitting this field in configuration and see what happens - whether PI raises an error, or is still able to interpret the file content properly, as the "human logic" says: first line is header, last line is footer, the rest are items.

If this doesn't help, and the sender is really unable to send key field values, then you have one more option. Read the whole lines of the file into one single fields, then use some pre-mapping (Java one would be most suitable, I think) that will manually do the FCC for your scenario. You could also think of developing your own adapter module, but this might be the most difficult option of those that I mentioned.

Regards,

Greg

former_member474221
Participant
0 Kudos

yes...i tried without key fields ...and it gave the error " keyfield missing"

anyways how can I read the entire file as a string using FCC

former_member184681
Active Contributor
0 Kudos

Hi,

Try with the following settings. It doesn't really read the whole file into one field, but rather each line to a separate node, which should be easier for further parsing:

Regards,

Greg

Former Member
0 Kudos

Hi,

I have a similar scenario FILE to SOAP, in which I need to map complete content of flat file into a single xml node in the target structure.

I have used sender File Adapter(FCC), and maintained FCC parameters as used by you above.

But i doesn't read whole file into one field, but rather each line to a separate node.

Can you please suggest possible ways to achieve this.

i.e.

My Source File is like

34100000      020261156501000156                    00910 000000008051                                      

34100011C2010000 261156501000156                    00910 000000008051

34100011C2010000 261156501000157                    00910 000000008051

And what i want is

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

- <ns:MT_conteudoTexto xmlns:ns=http://xi.sap.com/abc>

- <conteudoTexto>

  <conteudoTexto>34100000 020261156501000156 00910 000000008051

     34100011C2010000 261156501000156                    00910 000000008051

     34100011C2010000 261156501000157                    00910 000000008051

</conteudoTexto>

But what i am getting is

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

- <ns:MT_conteudoTexto xmlns:ns=http://xi.sap.com/abc>

  <conteudoTexto>

<conteudoTexto>34100000 020261156501000156 00910 000000008051</conteudoTexto>

<conteudoTexto>34100011C2010000 261156501000156                    00910 000000008051</conteudoTexto>

                <conteudoTexto>34100011C2010000 261156501000157                    00910 000000008051</conteudoTexto>

</conteudoTexto>

Answers (0)