cancel
Showing results for 
Search instead for 
Did you mean: 

FTP Sender Adapter - Dynamic fields in a comma separator csv

former_member440449
Participant
0 Kudos

Hi Gurus,

I have to design a simple FILE to proxy interface.

The file has a header with field names, and everything is separated by comma.

This is the way the file is coming:

A,B,C

1, name1, id

1, name2, id

1, name3, id

So header is A,B,C and rest are the values that need to be maped (rows).

This is easy to do with FCC, but there are some cases like this:

A,B,C

1, name1, id

2, name2, id, name3, id

1, name4, id

3, name5, id, name6, id, name7, id

1, name8, id

As you can see, the first number tells the quantity of repetitive columns B and C and I need this information to be in my structure.

Is anyone able to let me know if there is a way to catch all the data of the .csv with File Content Convertion?

I hope I was clear, otherwise just let me know.

Thanks!!!!

Accepted Solutions (0)

Answers (1)

Answers (1)

Muniyappan
Active Contributor
0 Kudos

can you translate this flat file into expected xml?

A,B,C

1, name1, id

2, name2, id, name3, id

1, name4, id

3, name5, id, name6, id, name7, id

1, name8, id

what are the max no of occurrence of names and id in one row? 3 times is the max?

3, name5, id, name6, id, name7, id

Regards,

Muni

former_member440449
Participant
0 Kudos

Hi Muni,

Thanks for your reply.

There is no max number of occurrence here. I used the 3 as an example, but it may contain more than 7 in real examples.

Any idea?

Muniyappan
Active Contributor
0 Kudos

if you know the count, then you can put field names to capture in FCC, when values are present, it will get populated,when values are not there then it won't appear in the xml. you can control this using NameA.missingLastFields and NameA.additionalLastFields

https://help.sap.com/saphelp_nw73/helpdata/en/44/682bcd7f2a6d12e10000000a1553f6/frameset.htm

else read the file by line by line, in the mapping format the message using udf.

you can convert whole input into input xml like below

<Record>
<line>A,B,C</line>
<line>1, name1, id</line>
<line>2, name2, id, name3, id</line>
<line>1, name4, id</line>
<line>3, name5, id, name6, id, name7, id</line>
<line>1, name8, id</line>
</Record>

https://blogs.sap.com/2005/08/16/configuring-generic-sender-file-cc-adapter/

Regards,

Muni