Skip to Content

How to handle duplicate files (Sender File Adapter scenarios) in Process Integration

Recently I worked on one requirement in my project, to stop the processing of duplicate files if the file has been already processed earlier. There was a chance that client might place a file at FTP location more than ones.

  

This requirement can be achieved using different ways

Using adapter module to stop processing duplicate files at adapter level.  Refer below link which explains how to deal with this kind of requirements using Adapter module and really good design.

  

http://scn.sap.com/people/sandeep.jaiswal/blog/2008/05/13/adapter-module-to-stop-processing-of-duplicate-file-ftp-location

  

But due to certain limitations from my client end (no adapter modules) decided to use other design.

 

Design Approach:

Step1:

 

  • Created one function module in ECC and written logic like BAPI has one request /response parameter and request parameter value is Sender File name from PI.
  • After executing an interface for new file (Eg: Inventory.xml) first time it will store file name in SAP Table and return response as “NE”(not exists).
  • If same file (Eg:Inventory.xml) placed in FTP then RFC lookup checks against entries in table
    and returns response as “E”(Exists).

Below is the function module code.

/wp-content/uploads/2012/06/1_108247.jpg

Step2:

RFC lookup

PI7.1 onwards we can perform RFC look up using standard graphical function.

http://scn.sap.com/people/jin.shin/blog/2008/02/15/sap-pi-71-mapping-enhancements-series-graphical-support-for-jdbc-and-rfc-lookups

/wp-content/uploads/2012/06/2_108311.jpg

  

Step3:

 

Dynamic configuration UDF used to retrieve sender file name and provide as a request to the RFC lookup.

/wp-content/uploads/2012/06/3_108312.jpg

Step4:

Throwing exception at mapping level for already processed files,used simple UDF code used to check the RFC look up response beased on that manually failed message mapping with custom message.

/wp-content/uploads/2012/06/4_108313.jpg  

PS:

 

1) This design has certain limitation like if RFC lookup fails due to RFC adapter issue or ECC-PI connectivity issue then it won’t check against table entries in SAP.

2) I provided this sulution as a temporary and requested my client to fix the problem from bussiness end.

3)I prefered this design because the load going to  be very less and only5 files per day.

6 Comments
You must be Logged on to comment or reply to a post.
  • Good Work Around.I think now with SAP SFTP adapter we no need to worry about the duplicate files handling.By default SFTP adapter will check the duplication of files.

    What if my interface runs every day for 1hr with the same file name with different data?Mapping fails as per the BAPI logic and may be BAPI logic has to be modified with the combination of SYDATUM and FILENAME

    Cheers

    Pawan

    • Hi Shakti,

      I have requirement to validate duplicate files by content of file say two fields in CSV file in sender system,pls suggest me the ways.

      Thnx,Nithin.

  • I followed your blog to check duplicate file name but getting exception error: the input parameter file does not exist. It seems not passing file name to UDF. I have checked in CC for File Name. Is there any missing steps?