Skip to Content
0

FTP Sender Adapter - Dynamic fields in a comma separator csv

Nov 22, 2017 at 06:55 PM

67

avatar image
Former Member

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!!!!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Muniyappan Marasamy Nov 25, 2017 at 06:47 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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?

0

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

0