Error in Duplicate file Handling

Hi All,
      We want to avoid duplicate files in XI for that we used below code in  UDF in mapping
try{
String processedFileDatabase = processedFile[0];
String sourceFileName;
DynamicConfiguration attrib = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey fileKey = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");
attrib.put(fileKey,attrib.get(fileKey));
sourceFileName = attrib.get(fileKey);
File fileDB=new File(processedFileDatabase);
if (!(fileDB.exists() && fileDB.canWrite() && fileDB.canRead())){
fileDB.createNewFile();
Vector fileNameList = new Vector();
BufferedReader br = null;
br = new BufferedReader(new FileReader(processedFileDatabase));
String name = new String();
//loop and read a line from the file as long as we dont get null
while ((name = br.readLine()) != null)
//add the read word to the wordList
fileNameList.add(name);
br.close();
boolean fileAlreadyProcessed = fileNameList.contains(sourceFileName);
if (!fileAlreadyProcessed) {
Writer output = new BufferedWriter(new FileWriter(new File(processedFileDatabase),true));
output.write(sourceFileName + "\r\n");
output.flush();
output.close();
result.addValue("" + !fileAlreadyProcessed);
}catch(java.io.IOException e){
            e.printStackTrace();
But this is not working ..its unable to Map....
Plz help us in this regard,

The file name is not going to fileDB and hence it is unable to create the target element.
I followed the below link solution 2
http://wiki.sdn.sap.com/wiki/display/XI/DifferentwaystokeepyourInterfacefromprocessingduplicate+files
I seen that fileDB file is empty ,

Similar Messages

  • Duplicate File Handling Issues - Sender File Adapter - SAP PO 7.31 - Single Stack

    Hi All,
    We have a requirement to avoid processing of duplicate files. Our system is PI 7.31 Enh. Pack 1 SP 23. I tried using the 'Duplicate File Handling' feature in Sender File Adapter but things are not working out as expected. I processed same file again and again and PO is creating successful messages everytime rather than generating alerts/warnings or deactivating the channel.
    I went through the link  Michal's PI tips: Duplicate handling in file adapter - 7.31  . I have maintained similar setting but unable to get the functionality achieved. Is there anything I am missing or any setting that is required apart from the Duplicate file handling check box and a threshold count??
    Any help will be highly appreciated.
    Thanks,
    Abhishek

    Hello Sarvjeet,
    I'd to write a UDF in message mapping to identify duplicate files and throw an exception. In my case, I had to compare with the file load directory (source directory) with the archive directory to identify whether the new file is a duplicate or not. I'm not sure if this is the same case with you. See if below helps: (I used parameterized mapping to input the file locations in integration directory rather than hard-coding it in the mapping)
    AbstractTrace trace;
        trace = container.getTrace();
        double archiveFileSize = 0;
        double newFileSizeDouble = Double.parseDouble(newFileSize);
        String archiveFile = "";
        String archiveFileTrimmed = "";
        int var2 = 0;
        File directory = new File(directoryName);
        File[] fList = directory.listFiles();
        Arrays.sort(fList, Collections.reverseOrder());
        // Traversing through all the files
        for (File file : fList){   
            // If the directory element is a file
            if (file.isFile()){       
                            trace.addInfo("Filename: " + file.getName()+ ":: Archive File Time: "+ Long.toString(file.lastModified()));
                            archiveFile = file.getName();
                          archiveFileTrimmed = archiveFile.substring(20);       
                          archiveFileSize = file.length();
                            if (archiveFileTrimmed.equals(newFile) && archiveFileSize == newFileSizeDouble ) {
                                    var2 = var2 + 1;
                                    trace.addInfo("Duplicate File Found."+newFile);
                                    if (var2 == 2) {
                                            break;
                            else {
                                    continue;
        if (var2 == 2) {
            var2 = 0;
            throw new StreamTransformationException("Duplicate File Found. Processing for the current file is stopped. File: "+newFile+", File Size: "+newFileSize);
    return Integer.toString(var2);
    Regards,
    Abhishek

  • Regarding Adapter Module for Duplicate file handling at Sender side

    Hi All
    my requirement is to develop a adapter module . Source is FTP  target is R/3  .source Commuincation cahnnel is File sender .
    want to handle duplicate files
    can any one provide  me what are all the steps being used for the same .
    any step-via -step doc will be helpful for me ......and adapetr module will be written in NetWeaver Developer studio or which s/W ????
    also where to put the ejb or import the ejb s...
    Pls help
    Regards
    Priya

    Hi Priya,
    YES YOU NEED SAP NetWeaver Developer studio to develop Adapter Modules,or you can use any othe IDEs like Eclipse ....many documents available in sdn ,how to develop AM,refer below link it explaines clearly
    let me know which version of XI u working on,if it PI7.1 jar files different.
    http://wiki.sdn.sap.com/wiki/display/stage/AdapterModuleToReadExcelFilewithMultipleRowsandMultiple+Columns
    Regards,
    Raj

  • Duplicate file handling using Module

    Hi All
    The Scenario is like this------
    XI is picking a files from FTP location.
    Duplicate files are also getting picked by XI.
    To handle this i have written a module using NWDS which is finding it out wheather the file is duplicate or not. If the file is not duplicate then it is getting processed.
    Now the problem i am facing is
    I dont want to process the file if it is found duplicate, then what code i should write.
    What are the ways i can stop the processing of duplicate file.
    Regards
    Dheeraj Kumar

    Hi
    I have implemented a module in which i can find out wheather the file is duplicate or not. If the file is not duplicate process the file.
    now the problem is --- if file is duplicate then i dont want to process the file.
    How can i achieve this?
    Regards
    Dheeraj Kumar
    Edited by: Dheeraj Kumar on Nov 30, 2009 3:21 PM

  • Duplicate File Handling using Adapter Module

    Hi All
    The Scenario is like this------
    XI is picking a files from FTP location.
    Duplicate files are also getting picked by XI.
    To handle this i have written a module which is finding it out wheather the file is duplicate or not. If the file is not duplicate then it is getting processed.
    Now the problem i am facing is -
    I dont want to process the file if it is found duplicate, then what code i should write.
    What are the ways i can stop the processing of duplicate file. 
    Regards
    Dheeraj Kumar

    Hi
    I have implemented a module in which i can find out wheather the file is duplicate or not. If the file is not duplicate process the file.
    now the problem is --- if file is duplicate then i dont want to process the file.
    How can i achieve this?
    Regards
    Dheeraj Kumar
    Edited by: Dheeraj Kumar on Nov 30, 2009 3:21 PM

  • Podcasts broken in 9.2 with error "A duplicate file name was specified"

    Ever since the 9.2 upgrade my podcasts have not been able to update. The following error message is displayed when I click the icon next to the podcast:
    +There was a problem downloading "... podcast name ...". A duplicate file name was specified.+
    Digging in the iTunes download directory I see that a directory entry is created for each podcast (with a .tmp suffix). Inside there is a download.mp3 that is zero bytes in size.
    I've tried reorganizing the library, restarting, reinstalling, etc.
    Not sure if this matters, but I've been mounting my itunes library via nfs for the past five years or so without any issue.
    I tried to see what iTunes was up to via dtrace/iosnoop but it appears that they've gone and restricted that at the OS level -- so no luck there. Any luck here?

    Close iTunes, delete the download directory, and restart.
    tt2

  • Error Message- Duplicate File name was specified

    I am trying to purchase and download some music for the past month now and am unable to do so. When I go to buy something it says "Could Not Purchase "song". A duplicate File name was specified.
    Then Below it says
    There was an error in the Itunes Store. Please Try Again Later.
    And when I go to authorize computer I get an error message stating "There was an error storing your authorization information on this computer."
    Then below it says
    Try doing a repair install on ITunes from the "add or remove programs" control pane.
    I did this and am still having the same error messages that I was having before. This is getting extremely irritating and I would really appreciate if someone could help me get this figured out!
    Thanks in advance!

    I DID IT! I FIXED IT, FINALLY!!! At least it worked for me. Here's what I did: from Control Panel/Programs/Programs and Features/Uninstall or Change Program, I right-clicked on iTunes and selected Repair. After that ran and completed, I went to Computer/Local Disk (C:)/Program Files. From the list, I right-clicked on iTunes and selected “Run as Administrator.” After that I tried to purchase music from iTunes, and it worked! I hope this makes sense and works for you. Good luck!

  • Error: A duplicate file name was specifice

    I am getting this message now when synchronizing my iPad to my Win7 x64 computer. I haven't been able to locate a solution. Can anyone assist?

    Was eventually forced to do a restore and the error went away afterward.

  • Duplicate message handling in the sender file adapter

    Hi,
    I enabled duplicate file handling check in the sender file adapter so that whenever there is a duplicate file it should send me an alert also it should disable the channel so that i do not get that duplicate file alert message again and again.
    My question is will it activate the channel again as soon as a new file arrives or do i need to manually do that.
    Michal's PI tips: Duplicate handling in file adapter - 7.31

    Hi Hema,
    You will have to activate the channel manually. The idea behind the 'disable' functionality is to avoid further file processing through that channel which can only start once the channel is activated again manually.
    Regards,
    Abhishek

  • Help with iTunes ERROR: duplicate file name specified - where/how?

    When starting up iTunes (version 10.6.1) I get an error message:
    Duplicate file name was specified.
    Needless to say, no clue as to what file name it is referring to. Furthermore, there are 5 songs which I can not play, bought from the iTiunes store. Contacted the iTunes store - they "enabled" the download for those 5 songs. When I connect to the iTunes store, login and check for downloads etc. I get the error message:
    Unable to check for available downloads. Duplicate file name was specified.

    The way to fix this is
    1. Go to Computer
    2. Click Operating System Hard-Drive (C:)
    3. Scroll to Program Files (or) Program Files (x86)
    4. Scroll to iTunes, open it
    5. Find iTunes.exe
    6. Right Click and go to Properties
    7. Click Compatibility you will see something that stats
    Privilege level
    Run this program as an administrator.
    8. Click this and Click Apply and then Ok NOW Open iTunes
    This worked on mine let me know if it doesnt!

  • "Too many file handles open" Error

    I have archived my data from my current VSS database.
    I tried to restore the archived data on different database, but it showed error "Too many file handles".
    Please suggest me proper steps to avoid this error.

    hi, i am also experiencing the same problem with my whatsapp. and i have tried to reinstall my whatsapp many times...nothing seems to work

  • HT201210 i cant update my ipad 2 because a duplicate file name was specified

    i cant update my ipad 2 because of an error a duplicate file name was specified

    OK, read this thread... https://discussions.apple.com/thread/3928453
    tt2

  • Can't purchase music - duplicate file name specified

    Recently I started having a problem with iTunes.  When I open iTunes I get an error message "Duplicate file name specified".  I can close the message window and iTunes seems to function normally for most activities, however, if I try to buy a song from the iTunes store, I get the following message:
    "Could not purchase "song name". A duplicate file name was specified. There was an error in the iTunes store.  Please try again later."  Even after repeated tries I cannot purchase.
    After doing a little internet research, I tried restoring an older iTunes library file that predated the problem, but no change.  I did a complete uninstall/reinstall of iTunes and got the error message upon first opening of the new version even before I directed it to my existing library.
    I'm hoping someone has another suggestion since I cannot make iTunes purchases now. Thanks.
    Sony Vaio VPCCW

    Start here:
    http://support.apple.com/kb/TS3430

  • Error in creating IO file handles for job (number 3152513)

    Hi All -
    I am using Tidal 5.3.1.307. And the Windows agent that is running these jobs is at 3.0.2.05.
    Basically the error in the subject was received when starting a particular job once it was cancelled and a couple of other different jobs a few days before. These jobs have run successfully in the past.
    This particular job was running for 500+ minutes when it should run at an estimated 40 minutes. At that time it would not allow for a re-start of the job, it just stayed in a launched status.
    Trying to figure out what causes this error.
    Error in creating IO file handles for job 3152513
    Note - from that being said we were to see 2 instances of this process running at the same time, we noticed some blocking on the DB side of things.
    Trying to figure out if this is a known tidal issue or a coding issue or both.
    Another side note, after cancelling the 2nd rerun attempt the following error was encountered: Error activating job, Duplicate.
    When we did receive the Error creating IO file, the job did actually restart, but Tidal actually lost hooks into it and the query was still running as an orphan on the db server.
    Thanks All!

    The server to reboot is the agent server.  You can try stopping the agent and then manually deleting the file.  That may work.  When the agent is running the agent process may keep the file locked, so rebooting may not be sufficient.
    The numerical folders are found as sub-directories off of the services directory I mentioned.  I think the numbers correspond to the job type, so one number corresponds to standard jobs, another to FTP jobs.  I'd just look in the numbered directories until you find a filename matching the job number.
    The extensions don't really matter since you will want to delete all files that match your job number.  There should only be one or two files that you need to delete and they should all be in the same numbered sub-directory.
    As to the root cause of the problem, I can't really say since it doesn't happen very often.  My recollection is that it is either caused by a job blowing up spectacularly (e.g. a memory leak in the program being launched by Tidal) or someone doing something atypical with the client.

  • Can't delete file after renaming due to Word file handle still present. Error staes document is still in use but it's really not. Worked fine in 2007 but not in 2010.

    I have some code associated with a Word Template. The template is opened, filled out and saved via a routing in vba. This all works fine in older 2007 version (which is version it was originally created in). Once this file is saved, the user can change the
    date in a text box and re-save document. The code saves using the new date for part of new file name and then deletes that older file from the server. It fails at the delete function because the newer version of word is not dropping the file handle from the
    first named file when user saves it to the new filename. In older version (2007) this handle was released as soon as file was saved to a different name. I can't seem to figure out how to release the old document filename so the old document file can be deleted.
    I hope I explained this well enough.
    Here's the code that woeked in version 2007 but fails in version 2010.
    Option Explicit
    Dim CAPEX01 As MSForms.ComboBox
    Dim CAPEX02 As MSForms.ComboBox
    Dim LocalPath As String
    Dim NetPath As String
    Dim OldPath As String
    Dim OldPathNet As String
    Dim DocName01 As String
    Dim DocName02 As String
    Dim DocName03 As String
    Dim DocName04 As String
    Dim DocName As String
    Dim DocNameold As String
    Dim TestDocName As String
    Dim filesys
    Dim newfolder
    Sub AutoOpen()
    ActiveDocument.ActiveWindow.View.Type = wdPrintView
    TestDocName = ActiveDocument.TextBox2
    OldPathNet = "\\yourPath\" & TestDocName & "\"
    End Sub
    Sub AutoNew()
    TestDocName = ActiveDocument.TextBox2
    OldPathNet = "\\yourPath\" & TestDocName & "\"
     ComboBox1.Locked = False
     ComboBox1.Enabled = True
     FillList1
     FillList2
     End Sub
    Sub DeleteOldDoc()
    OldPathNet = "\\yourPath\" & TestDocName ' & "\"
    DocNameold = OldPathNet & TestDocName & "-" & DocName02 & "-" & DocName03 & "-" & DocName04 & ".doc"
        If Not TestDocName = DocName01 Then
            Set filesys = CreateObject("Scripting.FileSystemObject")
        If filesys.FileExists(DocNameold) Then
            filesys.DeleteFile (DocNameold), True      
     'I get file permission error here
        End If
        End If
    If DocName01 <> "" Then
    If Not TestDocName = DocName01 Then
    If Not TestDocName = "" Then
        MsgBox "Project Proposal Has Been Moved From Year " & TestDocName & " To " & DocName01 & ""
    End If
    End If
    End If
    TestDocName = DocName01
    End Sub
    '''''''Document path functions''''''
    Sub chkpath()
    Set filesys = CreateObject("Scripting.FileSystemObject")
    If Not filesys.FolderExists("\\yourPath\") Then
       newfolder = filesys.CreateFolder("\\yourPath\")
    End If
    If Not filesys.FolderExists("\\yourPath\" & DocName01 & "\") Then
        newfolder = filesys.CreateFolder("\\yourPath\" & DocName01 & "\")
    End If
    End Sub
    ''''''Save Function''''''
    Private Sub CommandButton1_Click()
    DocName01 = ActiveDocument.TextBox2
    DocName02 = ActiveDocument.TextBox4
    DocName03 = ActiveDocument.TextBox1
    DocName04 = ActiveDocument.ComboBox1.Value
    chkpath
    NetPath = "\\yourPath\" & DocName01 & "\"
    DocName = NetPath & DocName01 & "-" & DocName02 & "-" & DocName03 & "-" & DocName04
    ActiveDocument.SaveAs2 FileName:=DocName, FileFormat:=wdFormatDocument
     ComboBox1.Locked = True
     ComboBox1.Enabled = False
     ComboBox2.Locked = True
     ComboBox2.Enabled = False
     TextBox1.Locked = True
     TextBox1.Enabled = False
     TextBox3.Locked = True
     TextBox3.Enabled = False
     TextBox4.Locked = True
     TextBox4.Enabled = False
     DeleteOldDoc
    End Sub
    Sub FillList1()
    Set CAPEX02 = ActiveDocument.ComboBox2
      With CAPEX02
          .AddItem "CASTING", 0
          .AddItem "HOT ROLLING", 1
          .AddItem "COLD ROLLING", 2
          .AddItem "FINISHING", 3
          .AddItem "PLANT GENERAL", 4
          .AddItem "MOBILE EQUIPMENT", 5
      End With
    End Sub
     Sub FillList2()
     Set CAPEX01 = ActiveDocument.ComboBox1
      With CAPEX01
          .AddItem "A Name", 0
          .AddItem "Another Name", 1
      End With
    End Sub
    Private Sub CommandButton2_Click()
        UserForm1.Show
    End Sub

    mogulman52 and Don,
    I went back and looked at my code and had already updated it to SaveAs in the new docx format. It still holds the lock handle in place until Word closes, unlike earlier versions which released the lock handle when you did a SaveAs.
    As a note, all my Word and Excel macro-enabled (dotm & xltm) templates are read only and are never filled in, prompting the user for a file name on any close event or if they run the code gets auto-named. I do the SaveAs and concatenate the file name
    from data on the document (or sheet) that has been filled in. During the SaveAs the docx gets saved to a network folder and also on a local folder. The lock gets renamed to the filename and remains until Word is closed.
    So my code still fails at the point noted below while trying to delete an old filename version after the file has been saved as a new filename in a new folder. So....
    The code is looking in the last folder where the docx file was saved for the older filename so it can be deleted. The newest docx version has already been saved in a different folder and has a new lock handle of its own. That lock is not my problem, it's
    the older file lock which really exists in the same folder as the first filename that the docx was saved to. It does not release that lock until I exit Word. My work around has been to instruct all users to manually delete the older version file.
    The other odd thing is this only happens when I run it from code, if you manually go through these steps with the SaveAs menu drop-downs in Word it will release the lock handle???
    Hope this isn't to confusing and thanks for all your suggestions and help.
    Sub DeleteOldDoc()
    OldPathNet = "\\yourPath\" & TestDocName ' & "\"
    DocNameold = OldPathNet & TestDocName & "-" & DocName02 & "-" & DocName03 & "-" & DocName04 & ".doc"
    If Not TestDocName = DocName01 Then
    Set filesys = CreateObject("Scripting.FileSystemObject")
    If filesys.FileExists(DocNameold) Then
    filesys.DeleteFile (DocNameold), True 'I get file permission error here- lock handle is still present from last SaveAs command in last folder where previous version of file was saved.
    End If
    End If
    If DocName01 <> "" Then
    If Not TestDocName = DocName01 Then
    If Not TestDocName = "" Then
    MsgBox "Project Proposal Has Been Moved From Year " & TestDocName & " To " & DocName01 & ""
    End If
    End If
    End If
    TestDocName = DocName01
    End Sub
    Glenn

Maybe you are looking for

  • How to embed an OpenType font in Beta 2?

    Hi Folks I'm trying to embed an OpenType font into a Flash Builder Beta 2 project and haven't been successful yet. What I've tried so far: 1. changing the order of the font managers in the flex-config.xml file, to put the one that handles OpenType fi

  • I keep getting "Mail Not Responding" and have to force quit

    I can't even get to "Mail Doctor" because the spinning beachball starts up instantly.  I have to force quit to get it to stop.  Mail is working on all my other eight devices but not my primary iMac.  What the heck?

  • Report for Savings

    Hi Gurus, I need to build a report for savings in SCM. The savings are calculated by this way: actual quantity * (reference price – actual price). Does anyone knows if there's any standard query or at least a cube or DSO that can provide this informa

  • Inverted Outputs using DAQMX

    We have been using traditional daq with an SCXI 1163.  We have an interface that uses an inverted digital output on odd channels.  Using traditonal DAQ we could set any of the bits to be inverted in the properties.  Using DAQMX it looks like you can

  • Connect to Oracle Database from Windows Mobile

    Is there any Oracle Client product that will allow Windows mobile powered devices to connect to an oracle database? I'm using .net and the compact framework 2.0. Anyone have a clue? Regards, Andras Eliassen