cancel
Showing results for 
Search instead for 
Did you mean: 

** How to convert selected rows from CSV file to XML (Sender File Adapter)

jegathees_waran
Active Participant
0 Kudos

Dear friends,

I face one one problem. I have asked to process only detail records from the given CSV file. I give below the format & content of CSV file.

-


00001 EMPDEMO1.CSV

00002 COMPCODE,EMPCODE,EMPNAME,BASIC

00003 1000,A546,JEG,8000

00004 1000,A547,KUYIL,4000

00005 1000,A548,MAYIL,7000

00006 EMPDEMO2.CSV

00007 COMPCODE,EMPCODE,EMPNAME,BASIC

00008 2000,E341,ARUN,2300

00009 2000,E342,MUKESH,4300

-


The file contains Header1, Header2 and Detail data. Header1 data contains file name. Header2 contains fields list of the detail file. Detail contains actual data. In the above example, line 00001 is Header1 data. Likewise, 00006 is Header1 data. Lines 00002, 00007 are Header2 data since it contains field names list. Remaining lines 00003,00004,00005,00008,0009 are details data. The file has data likewise. Whenever the company code change, Header1 & Header2 is inserted. Since details data are actual data, we are asked to process only those records from file to XML format.

Friends, I understand this is possible only thru 'File Content Conversion' option in sender File Adapter. But, the critcal point is how to process the selected records from file. I am searching how to do this.

Friends, could you kindly help me how to do this?

Thanking you.

Regards,

Jeg P.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

We have an option in sender File adpter

Document Offset :Specify the number of lines that are to be ignored at the beginning of the document. This enables you to skip comment lines or column names during processing. If you do not make an entry, the default value is zero lines

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Also see the below links

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 - sender file name as receiver file name

/people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter

/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file /people/harrison.holland5/blog/2006/12/20/xi-configuration-for-mdm-integration--sample-scenario /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp /people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy

Regards

Chilla

Answers (1)

Answers (1)

jegathees_waran
Active Participant
0 Kudos

Hi Chilla,

Thanks for your reply. Now, we are able to skip lines from top. But, in middle of the file how to skip lines based on some condition. For Ex: in the above file, skip lines 00006, 000007. Because, it contains header data.

Thanks for your help. If we solve this problem, (skip lines in the middle), then it will be good.

Kind Regards,

Jegatheeswaran P.

Former Member
0 Kudos

HI,

This can be solved in two ways i hope,

one is sort the all rows and skip the first header lines ,

Similarly in Mapping you can have the filter condition in UDF --

map to top most node in both sides ,

and in UDF use the condition and check if it is true the ResulList.SUPPRESS. to suppress the target node, and remember the target node should be 0..more occurences

Regards

Chilla