cancel
Showing results for 
Search instead for 
Did you mean: 

How to read only the first record of CSV file in PI?

Former Member
0 Kudos

Hi experts,

My requirement is need to read only the first line or record of incoming CSV file in SAP PI 7.1

Note:  first record should be header in CSV file. (It means i need to read only the header record only from the incoming CSV file)

How I can achive this?

Is it possible to achive this by using FCC or UDF?

Please revert your suggestions and solutions for this ASAP.

Thanks,

Jeevitha G

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Read the complete file and during the mapping just process first record values.

You can use copy value[0] to access first line values.

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

Hi Jeevitha,

If the header is in the first line you can copy this line and to rewrite the file or in a new one in a linux script and to execute this before message processing (SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki). Check this linux forum http://nixcraft.com/showthread.php/13389-Read-First-line-of-a-file

Regards

former_member184720
Active Contributor
0 Kudos

Just a note - If you go with this approach, you should also consider moving the file to another directory as soon as you read

Personally, i feel reading the complete file and just ignore the unnecessary records is a better option as you can audit the entire flow using PI tools itself.

iaki_vila
Active Contributor
0 Kudos

Hi Hareesh,

I totally agree with you, even more, i'd rather to do this staff at mapping level better than do it with a batch file and to maintain this file.

Regards.

Former Member
0 Kudos

Thank you so much for your quick reply Hareesh.

Is there any possiblity to do this before it comes to mapping?

former_member184720
Active Contributor
0 Kudos

No. You cannot read the file partially.