You are on page 1of 10

4/20/2020 Impede Duplicate Files | SAP Blogs

Community

Ask a Question Write a Blog Post

Technical Articles

Santhosh Kumar Vellingiri


July 14, 2008 2 minute read

Impede Duplicate Files


Follow RSS feed Like

0 Likes 272 Views 8 Comments

There are always questions in the forum about How to stop or do not allow the duplicate les to be processed. In this Blog I would exemplify a way to
handle the duplicate les with the RFC functionality.

Approach to the Solution:

1. Create an transparent table in XI to store the lename, date and time of the le processing. This table help us to keep track of the  le names, date
and time it got processed for our reference.

2. Create an RFC enable function module. This function can either query a lename into the table or insert a lename to the table. It has a import
parameter for accepting the lename and an export parameter to respond the called program if the le is a duplicate one.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 1/10
4/20/2020 Impede Duplicate Files | SAP Blogs

Function of RFC.

RFC imports the lename and checks if the le name already exist in the transparent table.

i. If there is no entry for the lename which is passed then the lename is added to the table and the export parameter Z_Duplicate is set to N and
returned. In the othere case i.e.

ii. If there is a entry in the table for the given lename then the parameter Z_Duplicate is set to Y and returned.

Steps:

1. Create a transparent table from SE11.

2. Create a RFC enabled function module with the import parameter Z_FILENAME and the export parameter Z_DUPLICATE.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 2/10
4/20/2020 Impede Duplicate Files | SAP Blogs

3. Add the following code to the function module.

TABLES:ZFILE. CLEAR ZFILE. DATA:LENGTH TYPE I. DATA : FILENAME LIKE ZFILE-


FILENAME. CLEAR LENGTH. Z_DUPLICATE = ‘N’. ZFILE-FILENAME = Z_FILENAME. ZFILE-
AEDTM = SY-DATUM. ZFILE-AETIME = SY-UZEIT. SELECT SINGLE FILENAME FROM ZFILE INTO
FILENAME WHERE FILENAME = Z_FILENAME. IF SY-SUBRC NE 0. INSERT ZFILE.
ELSE. Z_DUPLICATE = ‘Y’. ENDIF.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 3/10
4/20/2020 Impede Duplicate Files | SAP Blogs

4. Import the RFC in to XI.

5. Map the lename to the RFC parameter Z_FILENAME.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 4/10
4/20/2020 Impede Duplicate Files | SAP Blogs

Note: Retrieve the Filename by enabling the Adapter-Speci c Message Attributes in the sender File CC and using the Dynamic Con guration
Parameter in the UDF.

6. Send synchronous message to the RFC in the IP.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 5/10
4/20/2020 Impede Duplicate Files | SAP Blogs

7. In the switch statement check if the Z_DUPLICATE is Y.


a. If yes transform the le name to the mail content and send a rejection mail.
b. If no then send the IDoc to the R3 system.

Alert Moderator

Assigned tags

SAP Process Integration | santhosh kumarv |

Related Blog Posts

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 6/10
4/20/2020 Impede Duplicate Files | SAP Blogs
SFTP Adapter – How to handle File naming convention and extension
By Sekhar Dachepalli , Oct 29, 2019
Zipping of les in PO 7.5 using custom adapter module
By Anupam Ghosh , Jun 17, 2019

B2B Adapters – Updating to JCE Unlimited Strength Jurisdiction Policy


By Former Member , Jul 12, 2012

Related Questions

Duplicate handling Not Working


By Former Member , May 02, 2015

Issue with duplicate le processing SFTP sender channel


By pratibha bhaisora , Dec 12, 2018

Avoiding duplicate les


By Former Member , Aug 13, 2015

8 Comments

Former Member

July 15, 2008 at 2:24 am

Hi,
Good concept..but it this case message will arrive in BPE..

It will be great if we can stop duplicates messages/ le in AE itself.

see this blog also : Adapter Module to stop processing of duplicate le (FTP Location)

Thanks
Farooq.

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 7/10
4/20/2020 Impede Duplicate Files | SAP Blogs
Like (0) Reply Alert Moderator

Santhosh Kumar Vellingiri | Post author

July 15, 2008 at 7:53 pm

Farooq Thanks for the comments.


Yes! Adapter module will stop the le in the AE itself. However how reliable and secure is to store the le name in a text le?

Most importantly requirement in our project was to nd the missing le names. The inbound les were odd numbered like *01.*, *03.*, *05.*….
We had a report to generate the missing le names sensing the processed le names from the transparent table.
Thanks
SaNv…

Like (0) Reply Alert Moderator

Former Member

July 16, 2008 at 11:26 pm

An Adapter module (SessionBean) can work with a JDBC Data Source – and that would be in a single transaction.

Like (0) Reply Alert Moderator

Former Member

July 15, 2008 at 2:26 am

Also if during the processing time(when IP try to do RFC lookup), if RFC calls fails, then it will a ect the whole interface/interfaces.

Like (0) Reply Alert Moderator

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 8/10
4/20/2020 Impede Duplicate Files | SAP Blogs

Former Member

July 15, 2008 at 4:36 am

Good n simple blog…but design issues…


Why do we need a FORK after the receive?
If the le is duplicate why do we need to execute the mapping for IDoc?

Regards,
Sumit

Like (0) Reply Alert Moderator

Former Member

July 15, 2008 at 10:11 am

BTW: some Adapters for PI (especially the EDI Adapters) do duplicate checking themself, or have modules for this. That way you dont need to involve
the Process engine and you are transactionally safe.
Bernd

Like (0) Reply Alert Moderator

Santhosh Kumar Vellingiri | Post author

July 15, 2008 at 7:38 pm

Agree! But the standard le adapter never has this feature. So either user adapter module or RFC look is required.
Thanks
SaNv…

Like (0) Reply Alert Moderator

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 9/10
4/20/2020 Impede Duplicate Files | SAP Blogs

Krishnakumar Ramamoorthy

August 17, 2008 at 6:37 pm

Well, there is always one legacy system that can send only les with static names. Though static le names are not the best design, they do exist. The
only way we can be sure of duplicate processing in case of static les would be to have controls at the application logic level.
Anyway, BPM seems to be a overkill for this. I would go with Adapter module as suggested by some of our folks. If you still think, we go to do RFC look
up, I would do it in the mapping, throw a mapping error and send emails using CCMS instead of using a BPM.

Like (0) Reply Alert Moderator

Add Comment

Find us on

Privacy Terms of Use

Legal Disclosure Copyright

Trademark Cookie Preferences

Newsletter Support

https://blogs.sap.com/2008/07/14/impede-duplicate-files/ 10/10

You might also like