cancel
Showing results for 
Search instead for 
Did you mean: 

write error info in a file into ftp, when file sender CC has errors

former_member188019
Active Participant
0 Kudos

Hi,

we are using ftp sender adapter, with file content conversion. (flatfile to xml file, using fixedLengths).

it is polling a directory /folderOne/, for the filenames: MyFile.txt

in certain cases, when sender application puts file in incorrect format, the sender communication channel is failing its polling and i can see an error like:

Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR converting document line no. 65 according to structure 'TestRequest':java.lang.Exception: Consistency error: field(s) missing - specify 'lastFieldsOptional' parameter to allow this

we configured alerts, so we are getting the alerts.

But our sender application user cannot get emails from our company, due to some policy restrictions.

the sender application user wants to be alerted in some manner, so that he can know the error info.

when something is failing, the sender application wants PI to write the error info back to the same directory with a filename error.txt.

is there any way, to place an error info in a file into the same ftp server.

Thanks,

Madhu_1980

Accepted Solutions (0)

Answers (4)

Answers (4)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Madhu,

                There is another round about way in which you can achieve this.

Now you know what may be the reasons of failure when a flat file arrives in PI server. There may be extra commas or field separators , lack of proper " marks in file etc. The steps are

1. change the FCC in the channel such that files even with problems are accepted. Thus I would suggest devise your FCC in such a way such that a file such as this

a,b,"c",d

e,f,g,"h"

should be converted into XML like this

<mt_src>

<ROW>a,b,"c",d</ROW>

<ROW>e,f,g,"h"</ROW>

</mt_src>

Thus even if there are fields missing adapter engine would not throw any errors.

Let this flow to integration engine.

2. In the first mapping check each <ROW> of data. Either you use an UDF or use java mapping to do so. Thus the UDF checks if a particular line has required number of fields, all quotes have been closed properly etc.

3. If you find in some line there is error then write the proper reason of error to destination FTP server directly from UDF. If are wondering how to do this? then please  check this thread

http://scn.sap.com/thread/316570

4. In case you have got an error in step 3 above from the same UDF raise exception to stop the mapping and further flow of the scenario. Check this blog http://scn.sap.com/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphi...

(One small request please kindly rate the blog if you find it useful ).

5. In case there are no errors in Step 3 you need UDF/java mapping code to extract each field of the <ROW> into proper target field. This part is little complicated as you have to write codes which is done by FCC.

I would recommend single java mapping code to carry on above steps. Otherwise you can use UDF too.

Hope this resolves your problem.

let us know, if you need further information on this.

Regards

Anupam

naveen_chichili
Active Contributor
0 Kudos

Hi,

Your sender system people can only know if you add them in the recepients list in alerts.

Also you can only send the generic error about the file, but not what data is exactly causing the error.

Regards,

Naveen.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>is there any way, to place an error info in a file into the same ftp server.

There is no standard way to achieve this using PI. This is purely data issue at the sender system.

rajasekhar_reddy14
Active Contributor
0 Kudos

Work on limitation and convice your customer to add sender system people in receipient list for this interface.

or

ask them to write a validation at their end before placing file on FTP.