Function module to check if a file is already open

Hi All,
Could any one of you tell me a function module which checks whether a given file on the application server is currently being open or not.
Regards
Amit Mishra

Amit,
Try GET DATASET.
Basic form
GET DATASET dsn.
Extras:
1. ... POSITION pos
2. ... ATTRIBUTES attr
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details, see File Interface.
Effect
Used to get the properties of a file already open.
You can use this statement without additions to determine whether the file is open.
If the file is not open, an exception of the type CX_SY_FILE_OPEN_MODE is triggered.
Regards,
Rao A
Message was edited by: Rao Arimilli

Similar Messages

  • How to check a text file is already opened by another process

    Hi All,
      We are facing a requirement to check a simple text file that has been already opened by some other process using java programming.We are using simple file reading concepts to read the content of those text file
      For eg: Let us take sample.txt in any of the system location which is manually opened and we need to check that sample.txt is opened or not using java programming.
                  If it is not opened by any process then only we should  read that file otherwise we shouldn't.
    ANY GUIDANCE WILL BE HELPFUL...
    Thanks & Regards,
    Rumeshbabu

    Hi Christian,
    Thanks. Our scenario is...
    1. We have log files(in.txt) which is scheduled everyday for tracking and the scheduler will be writing the file ,it will be closed by night 11.
    2.So in case if we write any java code to access that log file(using  io file concept in java) we need access to that log file from our standalone java program only after night 11 0 clock.
    3.So we should check a condition whether that log file has been already used by some other process.
    Thanks & Regards.
    Rumeshbabu

  • Function module to check if a given file/folder path is valid or not?

    Hi,
    I am using function modules GUI_DOWNLOAD and GUI_UPLOAD.
    Is there any function module to check if a given file/folder path is valid or not?
    Thanks.

    Hi Kumar ,
    REPORT  zdir_test.
    TYPE-POOLS: abap.
    DATA: v_dir TYPE string.
    DATA: v_bol TYPE abap_bool.
    v_dir = 'c:\sap\'.
    CALL METHOD cl_gui_frontend_services=>directory_exist
      EXPORTING
        directory            = v_dir
      RECEIVING
        result               = v_bol
      EXCEPTIONS
        cntl_error           = 1
        error_no_gui         = 2
        wrong_parameter      = 3
        not_supported_by_gui = 4
        OTHERS               = 5.IF NOT v_bol IS INITIAL.
      WRITE:/ 'Directory exists.'.
    ELSE.
      WRITE:/ 'Directory does not exist.'.
    ENDIF.
    Regards,
    Sachin M M

  • Function module to check whether Goods Receipt of a Purchase Order is done.

    Hi,
    Is there any function module to check whether Goods Receipt of a Purchase Order is already done?
    Taking into consideration reversals.
    Thanks.

    Hi,
    I think u can do this by using a simple select query.
    u have to go in EKBE table.
    put the PO no. in field EBELN + EBELP(line item)  and get the material docuement no.  in field BELNR + BUZEI(line item).
    Thanks
    Jitendra

  • Function Module tto check special characters in a field

    Hi All,
    I have a requriemnt where i need to make sure there are no special characters allowed
    in a paremeter ( is there any functional module to check it)
    r anyway to work with
    Thank in advance for u replies.
    Regards,
    Riyaz.

    DATA: vergleich_string(100) VALUE
              'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
      CONCATENATE vergleich_string ' 1234567890,./!@#$%&*-_+=~|\[{]}()"'
                                                   INTO vergleich_string.
    use condition.
    if var ca vergleich_string.
    raise error message.
    endif.

  • Function module for checking existance of rfc destination?

    hi all,
       is their any function module for checking existance of rfc destination?
    regards
    deepak

    Hi,
    check teh table 'RFCDES'.
    reward if helpful.
    Regards,
    nagaraj

  • Standard function module for checking the sales organization and plant

    Hi all,
        Does have standard function module for checking the relationship between sales organization and plant?
    Thanks a lot!
    Nina

    hi
    good
    check these BAPIS
    BAPI_SALESGROUP_GET_DETAIL     Sales Group: Display Name                                                
    BAPI_SALESOFFICE_GET_DETAIL    Sales Office: Display Name                                               
    BAPI_SALESOFFICE_GRP_EXIST     Sales Office / Sales Group: Existence Check                              
    BAPI_SALESORG_EXIST            Sales Organization: Existence Check                                      
    BAPI_SALESORG_GET_DETAIL       Sales Organization: Display Data                                         
    BAPI_SALESORG_OFFICE_EXIST     Sales Organization / Sales Office: Existence Check                       
    PLANT=>
    BAPI_PROMO_GETSITEPLANNING     Detailed Data for the Plants Involved in a Promotion   
    thanks
    mrutyun^

  • Function Module To read all the Files in a Given UNIX directory.

    Can anyone provide me with a FUNCTION MODULE which reads all the files available in a UNIX directory?
    I have the UNIX directory given. I need to find all the files available in that particular Directory so that I can choose and process accordingly. Probably I can store all files in an Internal Table.
    Thanks in advance.
    Sunil

    Hi Nick,
    Thankyou very much for the response.
    The Function Module /SAPDMC/LSM_F4_SERVER_FILE is interactive wherein we can select only one file.
    But my requirement is I need to collect (probably in an internal table) all the files exixting in the given UNIX directory.
    Can you please find in that direction. I would be very grateful.
    Thanks.
    Sunil

  • Function module to check source system

    Hello
    Can some one help me by providing the name of the function module to check the Source system connection?
    I know that in the source system we can right click and check.
    But i want to know the function module to check the status.
    Thanks in advance
    Kind regards
    M.A
    Edited by: M.A on Aug 19, 2008 12:42 PM

    Hi shasank,
    Thanks for the info.
    I had given the tech name of the source system as an input to the function module.
    But it raises an exception that destination does not exists.
    But the source system connection is ok.
    Regards
    M.A

  • FM For Check File is Already Open in CLIENT.

    Hi Experts,
    I have a program that,
    User gives a file name (file has some rows),
    Program runs with data that included in file,
    and when program finishes, write something to file which user given before using (WS_DOWNLOAD)
    But if user dont close the file when program is running, program cant write something to given file.
    So, i have to check file is already open before program runs.
    Are there any FM to check if File Already Open on <b>Client</b> (Not Application Server so cant use open dataset).
    thanks
    ibrahim

    Hi,
    Please try this FM FILE_OPEN.
    Regards,
    Ferry Lianto

  • How to test if an external file is already opened?

    We have an issue when we write to an external file via the DBOpen and DBAdd functions. When we run two jobs simultaneously, they write to the same file. I know we can write to separate files, but we rather not. When the second job begins to do the write, at that point of entry for the second job, that record gets corrupted.
    I'm not sure if it is a DBOpen issue, or DBAdd issue, so I was wanting to try a test to see if the file is already open and bypass the DBOpen if it is. But I don't see anything that will test that other than the DBOpen function itself. When I capture the return code, the result is successful for both jobs. But I"m not wanting to do another DBOpen if the file is already open.
    How do I test for that?

    In the DBOpen call specification, there is a mode parameter which supports combinations of the following:
    * READ
    * WRITE
    * CREATE_IF_NEW
    * FAIL_IF_EXISTS
    You can combine multiple modes with &, so the 2 ^nd^ job should use DBOpen(table,handler,dfd,"WRITE&FAIL_IF_EXISTS") and you can examine the return code accordingly (1 = success, 0 = fail). That said, I don't think this is going to work. If you want to have multiple processes writing to a single file you're probably better off writing the records to a database table which supports this sort of activity. Otherwise you might consider having each job writing to a separate temp file, and then one of the jobs be responsible for reading both temporary files and writing out a 3 ^rd^ file containing all records.
    -Andy

  • Unable to add picture to Indesign file: error the file is already open.

    I am hoping that someone may have an answer for my question as I can't seem to find a solution anywhere else.
    The Setup:
    We have a primarly windows network with windows servers and network shares. (Yes all the shares are NTFS formated)
    We have six Desktop MACs OS X 10.5.4 added to this network and the MACs have loaded on them the complete Adobe CS4 suite.
    The problem:
    The issue happens when one of our users is attempting to drop a PSD file into an opened Indesign file.
    They user opens the Indesign file first from the network share in folder1, the user the goes to folder2 and attempts to drag and drop a PSD into the Indesign file they get the error the file is already open.
    So my first question what would be the most likly cause of this error?
    Second question is we also have a program called AdmitMac loaded on the MACs for authenication with the servers.
    Could this be interfering in anyway? AdmitMac uses Kerberos authenication, do the Adobe program recognise this Authenication type?

    grmg,
    There is nothing wrong with the ID file or the PSD file.  If the user moves both files to their desktop the drag-n-drop function works just fine.
    Even if just one of the files is on the desktop and the other on the network the drag-n-drop works fine.
    The issue is when both files are on the network server, that is when we get the error.
    Also it doesn't seem to matter what the file type is, the same thing occurs, if both files are on the Windows Server we get the "File already open" error
    The Artist just need to make links in ID to the picture files until the final revision.
    (We would perfer to keep the files on the server for backup purposes.  In the past we have had one to many contractors come in to do work and they do everything on the desktop and when they leave they sometimes delete their desktop.  As such the files never gets backed up.)
    I need to know what tweak, change or update I can apply so that both files can be on the server and the Drag-n-Drop function still works.
    thanks for the reply.

  • This file is already open by another user or another application-

    I am using InDesign CS4 on Mac OS 10.6.4, and sporadically get an error message reading "This file is already open by another user or another application. This file may be stored on a network server and cannot be opened until the other user closes it." This happens when I try to open a saved .indd file. The files are all on my hard drive, I created them, and nobody else has access to them.
    So far I've lost a handful of files' worth of work, as I cannot open the file in InDesign as an original or a copy, nor can I copy the file in the Finder (I get "unknown error: -22"), nor can I copy or move it using Terminal, nor can I zip it up. Time Machine doesn't recognize the file, and Apple Support couldn't help.
    I tried calling Adobe Support, but after telling me it was $40 for the answer the phone tech sent me back to the website instead of letting me pay!
    How do I fix this? I am losing hours of client work every time this happens, and only if I have a pdf version of the file can I recreate the work.
    Many thanks in advance.

    The last time it happened I restarted, cleared both the PRAM and NVRAM, and ran both Disk Utility and Disk Warrior. Nothing fixed it. I changed the permissions a number of times and that did not fix it.
    It's important to note that it doesn't happen to every file I save from InDesign; if it did I would have re-installed CS3 and dealt with that, because this issue never happened before I upgraded. So there's also no way to know if a possible fix is working or not.
    Also, there were no placed images or other artwork in the file this happened to most recently.
    I've checked my FontCase prefs, and if it's not running it's disabled, so that's out. I have some fonts that had been converted from Windows PostScript to TrueType, so I've disabled those.
    As I mentioned in the original post, I am not on a network beyond my home network, which consists of two computers and two routers. The file is on my computer's hard drive, and I am the only person accessing it. While I do use Dropbox, this file is not in that directory.

  • Users open shared files but they get an error that file is already open when actually its not

    we have a windows 2012 r2 environment with a hyper-v cluster with 4 virtual servers (2012r2) that are located on an hp storage.
    users in the office work on windows 7 pc's and sometimes (more than once per day) when they try to open word or excel files from a shared folder they get a message that the file is already open so it opens in read only mode and they cannot save it. we are
    pretty sure and tested that that folder is not open from any other user, because some users tried to open files randomly back from 2012 and they got the same errors again. 
    i cannot reproduce when i want the problem. i may try reopening files for an hour without having problems.
    i tried also to write down the hours that the users may have mostly the problem but i couldnt figure a specific time on the day that the problem occurs.its random.
    i want to also notice that we have symantec backup exec 2014 and taking backup on tapes and on deduplication folder with the advanced open file option set to "let VSS to select automatically the provider"
    the file server does not record any events in system or dfs replication tab. they only events we got once per 1 or 2 days are in the application tab and its exactly this "the volume recovery was not optimized because an error was encountered:
    the file move failed 0x89000016) event id 257,defrag"
    i hope i gave u an accurate description of my problems. i really have to solve this.
    kostask

    Hi Kostak, 
    Have you tried to use Process Explorer?
    More info: https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
    Simple usage: Part 1: Using SysInternals Process Explorer to solve issues
    when trying to clean up files and folders...
    This is what I am using to track file handles when tried to open or deleted. Normally I am finding that backup/vss process has taken, antivirus was scanning, or indexing services were working. 
    I would recommend you to do the next:
    - Disable Windows Search from: Control Panel> All Items> Programs and features> Turn Windows Features On or Off> Uncheck Windows Server. Go to services.msc and Stop Windows Search service.
    - Exclude affected folder(s) or drive(s) from antivirus scan/protection, at least 24h.
    - Disable backup/vss operations on the drive(s) for at least 24h.
    Hope it helps, I know how itchy can be this kind of issue at the office :)

  • "File file path:to:file is already open" how do i close it?

    I am trying to write a script that pops up a dialog box, asks for text and saves this to a .csv and a .txt This is so i can quickly record what i am doing and the times i am doing it, makes quick notes and various things like that. However it is failing with the message "File file path:to:file is already open" so how do i close the file or get around this. Cheers
    Script Below
    tell me to activate
    display dialog "Enter the log message:" default answer "" buttons {"Cancel", "Ok"} default button "Ok"
    copy the result as list to {the log_message, the button_pressed}
    if the button_pressed is not "Cancel" then
    set curTime to (do shell script "date \"+%H:%M:%S\"")
    set curDate to (do shell script "date \"+%Y%m%d\"")
    set new_foldername to curDate
    set this_folder to (path to current user folder) as text
    set fPath2 to this_folder & "Documents:Logs:Date:" as alias
    --set this_folder to "Macintosh HD:Users:username:" as alias
    tell application "Finder"
    if not (exists folder new_foldername of fPath2) then
    make new folder at fPath2 with properties {name:new_foldername}
    end if
    end tell
    set fPath to (path to current user folder as Unicode text) & "Documents:Logs:Date:" & curDate & ":"
    set fName to curDate & ".csv"
    set myFile to open for access file ((fPath as string) & fName) with write permission
    write curTime & "," & log_message & return to myFile starting at eof
    close access myFile
    set fName2 to curDate & ".txt"
    set myFile to open for access file ((fPath as string) & fName2) with write permission
    write curTime & " " & log_message & return to myFile starting at eof
    close access myFile
    end if

    Hi Richard,
    Run this in the script editor:
    set f to choose file
    close access f
    Navigate to the file you left open. Probably there was an error and the file was left open because it never reached the 'close access' command.
    gl,

Maybe you are looking for

  • A script in file EditingUtils.js has been running for a long time CS4

    I'm getting this error in dreamweaver: "A script in file C:\ProgramFiles\Adobe\Aobe Dreamweaver CS4\Configuration\Shared\Spry\DesignTime\EditingUtils.js has been running for a long time. Do you want to continue?" I get the error when I open a page th

  • HT201401 my sleep button doesn't work sometimes

    there is a problem with my sleep button,it doesn't work sometimes can someone tell me how to rectify that problem

  • Error in executing command

    Hello, I am trying to execute nqcmd command in unix envt throgh putty to purge cache but it giving me following error....I went through blog, but its not much helpful. I new to unix: below is the error exec(): 0509-036 Cannot load program nqcmd becau

  • SRM 7.0 , Get company name based on company code

    Hello friends, Is ther any function module or table to read company name based on company code in SRM 7.0 ? Kindly let me know your inputs. Thanks. Preethi.

  • Help puttting a Bridge web display into a muse website

    I generate nice flash image displays with Bridge (web display) and insert them into my website. I'm now redoing my site with Muse and can't seem to find a workable way to insert the flash player and files into Muse. Ideas?