How to validate the file path when downloading.

Hi
How to validate the file path when downloading to Presentation or application Server.

hiii
you can validate file path by following way
REPORT zvalidate.
TYPE-POOLS: abap.
DATA: w_direc TYPE string.
DATA: w_bool TYPE abap_bool.
w_dir = 'c:\Myfolder\'.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = w_direc
RECEIVING
result = w_bool
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF NOT w_bool IS INITIAL.
WRITE:/ 'Directory exists.'.
ELSE.
WRITE:/ 'Directory does not exist.'.
ENDIF.
regards
twinkal

Similar Messages

  • How to get the file path in adf application

    hii all,
    i have a txt file that i am using in my adf application,
    i am passing this txt file through a File Reader, for which i have to mention the file path.
    The file is in web-content and when i am hard coding the complete file path i.e C:/JDeveloper/myApp/ViewController/public_html/log.txt
    the application is working fine when run on integrated weblogic server.
    My requirement is to access this file without giving the static file path, as in case i have to use this application on any other machine..
    for that how to mention the file path-
    i tried using FacesContext to get the context path :-
    FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
    which gives me
    \myApp-ViewController-context-root
    after appending public_html\log.txt
    I am using the following path to access the file :-
    \myApp-ViewController-context-root\public_html\log.txt
    again i am getting the java.io.FileNotFoundException
    Does anyone know how to use file from inside the web-content without giving the complete path..???
    Thanks

    Hi,
    If you put your file under public_html folder, you can use this code to access the file:
    For example file is : log.txt
    FacesContext.getCurrentInstance().getExternalContext().getRealPath('/log.txt').toString().trim();
    Thanks.
    - LSR

  • How to give the file path in adf application

    Hii all,
    I want to use castor xml framework in adf application..
    for which i have to un- marshaller the xml file..
    by using following method-
    Person person = (Person)
    Unmarshaller.unmarshal(Person.class,
    new FileReader("src/com/person.xml"));
    if i use this method in a java class inside a main method directly it works fine,
    but when i try to initiate the java class through a jspx page deployed on integrated server..
    it gives the file not found exception..
    how to define the file path so it can be properly used even when application is deployed on server.
    Thanks

    duplicate {thread:id=2418158} ?
    I guess the path you are using is wrong. It works on your mashiene as the src path is available. When you run the app on a server (jspx file) there is no src path as long as you don't include it in your WAR wich you should not do anyway.
    If you need to access such data you can create a folder in your webroot folder and the the resources from there as /xml_folder_name or if the xml files shouldn't be visible from the outside put the folder under hte web-inf folder.
    Timo
    Edited by: Timo Hahn on 23.07.2012 16:20

  • How to set default file path while downloading alv output

    Hi,
    Can anyone tell me that how to set default file path while downloading the ALV output to system using Local file button on tool bar.
    Please look below screenshots:
    Kindly help me resolve it.
    Thanks in advance.
    Regards,
    Ashutosh Katara

    This information initial value is (maybe) stored in Windows Register (register.exe) at Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer -> PathDownload, you can read it thru class CL_GUI_FRONTEND_SERVICES method GET_UPLOAD_DOWNLOAD_PATH and update it thru method REGISTRY_SET_VALUE. (Else there may be some parameter ID to force data, but I'm no longer sure)
    Regards,
    Raymond

  • FM to validate the file path on the presentation server.

    Hi all,
                  We are downloading a file on to the presentation server.
    Is there any FM to validate the file path of the presentation server?
    Suggestions are also welcome.
    Regards,
    Sreekar

    You can call a class like a function module. See example below:
    TYPE-POOLS: ABAP.
    DATA: L_DIR TYPE STRING.
    DATA: L_BOL TYPE ABAP_BOOL.
    L_DIR = 'c:\windows'.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
      EXPORTING
        DIRECTORY            = L_DIR
      RECEIVING
        RESULT               = L_BOL
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        WRONG_PARAMETER      = 3
        NOT_SUPPORTED_BY_GUI = 4
        others               = 5.
    IF NOT L_BOL IS INITIAL.
      WRITE: / 'Directory exists.'.
    ELSE.
      WRITE: / 'Directory does not exist.'.
    ENDIF.

  • FM to validate the file path on the presenation server.

    Hi all,
    We are downloading a file on to the presentation server.
    Is there any FM to validate the file path of the presentation server?
    Its usgent.
    Thanks and Regards,
    Praveen

    Hi praveen,
    this may probably help you i think
    but its not a fm its a subroutine.
    FORM validate_pre_file USING fp_name TYPE rlgrap-filename.
    DATA : l_result,
    l_filename TYPE string.
    l_filename = fp_name.
    CLEAR l_result.
    CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
    file = l_filename
    RECEIVING
    result = l_result
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    wrong_parameter = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    IF sy-subrc 0.
    MESSAGE s007 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
    ELSEIF l_result IS INITIAL.
    MESSAGE s008 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
    ENDIF.
    ENDFORM. " validate_pre_file_hdr
    regards
    srikanth tulasi.

  • File browse : How to keep the file path in the file browse field?

    Hello,
    I have
    1) file browse field called P2_FILE_PATH.
    2) a select list with submit : P2_REGION
    If i upload some file d:\abc.gif , then select some region in the P2_REGION,
    P2_FILE_PATH will become empty. But in the session, i can find the blob value. but not the "d:\abc.gif "
    Using the following script I could capture the value of P2_FILE_PATH in a field
    P2_TEST.
    onload="javascript:document.getElementById(P2_FILE_PATH').value = document.getElementById('P2_TEST').value;"
    P2_TEST contains d:\abc.gif .
    How to retain the file path, though some other field is selected and submitted?
    Thanks in advance.
    Regards,
    Archana

    Hello Archana,
    You can't do what you want because of some HTML security restrictions – nothing to do with APEX. As you found out, You can capture the value of this item. You can't set it. After submitting the page, the browser is the one to clear the item.
    The only workaround is to work with AJAX and not submit the page until the end of the user input phase.
    Regards,
    Arie.

  • How to set the file path dynamically based on sytem, username, and date

    Hi All,
    My requirement is upload the data into one  structure like xyz that is related to t.code MCSZ.
    file will be in  UNIx SERVER .
    PATH IS: /sapif
    file name is xy789 load .txt
    I have  to write code in one user-exit
    how can i set the file path for this.
    shall i put hard code file path?
    because i have to writecode in user-exit.
    plz tell me how to set the file path based ons syetem, username, date
    Thanks in advance
    Ram.A

    Concatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path

  • FM to select the file path for download into application server

    Hello,
    I need a FM to select the file path for download into application server. It is a F4 help .
    Its functionality should be simmilar to the one used for presentation server i.e. as fol
    CALL METHOD cl_gui_frontend_services=>file_save_dialog

    Hello,
    What about F4_DXFILENAME_TOPRECURSION? You can check other FMs of the group DX_FILE.
    BR,
    Suhas
    PS: I think these FMs are not released by SAP, so need to be cautious while using these

  • How to set the File Path to run a javascript using Plugin Code?

    Hi All,
    Im new to Indesign Plugin Development.Can any one help me out with my problem.
    What i want to do is to run a javascript using Plugin Code.When i went through this forum i was able to find out that i should use the IscriptRunner Class to automate this.I could also figure out that the Member Function to use is "CanHandleFile" &"RunFile".
    The first parameter in CanHandleFile & RunFile Member Function is to specify the path of the JavaScript File i suppose!I could also find out that IDFile has to used to set the file path Information.
    But im clueless how to set the Javascript FilePath using IDFile.Can any one help me how to do this?Any Code Snippets Please?
    Waiting for reply.
    Thanks
    myRiaz

    Hi,  Andreas<br /><br />  Can you explain this in detail? I found it in your post before.<br /><br />  The content of elements are returned through the Characters callback function:<br /><br />From ISaxContentHandler.h:<br /><br />/**<br />        Receives character data<br /><br />The parser will call this method to report each chunk of<br />        character data. SAX parsers may return all contiguous<br />        character data in a single chunk, or they may split it into<br />        several chunks. But all characters in any single<br />        event must come from the same external entity so the<br />        Locator provides useful information.<br /><br />Note some parsers will report whitespace using the<br />        IgnorableWhitespace() method rather than this one (validating<br />        parsers must do so).<br /><br />@param Chars The characters from the XML document.<br />        */<br />virtual void Characters(const PMString& chars) = 0; <br /><br />  What i have done is implement my own SAXContentHandlerServiceBoss, and in my file XXXSAXContentHandler.cpp, I override the fonctions StartElement, EndElement, and Characters() like below: I add the PMString xmlData to collect the file content:<br /><br />class XXXSAXContentHandler : public CSAXContentHandler<br />{<br />void XXXSAXContentHandler::Characters(const WideString& chars)<br />{<br />xmlData.Append(chars);<br />}<br /><br />void XXXSAXContentHandler::StartElement(const WideString& uri, const WideString& localname, const WideString& qname, ISAXAttributes* attrs)<br />{<br />xmlData.Append("<"); xmlData.Append(localname); xmlData.Append(">");<br />}<br />void XXXSAXContentHandler::EndElement(const WideString& uri, const WideString& localname, const WideString& qname)<br />{<br />xmlData.Append("</"); xmlData.Append(localname); xmlData.Append(">");<br />}<br /><br />}<br /><br />and in my program, I use the code below to call the fonction I overrided, but I dont know how I can get the String xmlData I defined in the XXXSAXContentHandler.cpp<br /><br />InterfacePtr<IK2ServiceRegistry> serviceRegistry(gSession, UseDefaultIID());<br /><br />InterfacePtr<IK2ServiceProvider> xmlProvider(serviceRegistry->QueryServiceProviderByClassID(kXMLParserService, kXMLParserServiceBoss));<br /><br />InterfacePtr<ISAXServices> saxServices(xmlProvider, UseDefaultIID());<br />InterfacePtr<ISAXContentHandler> saxHandler(::CreateObject2<ISAXContentHandler>(kXXXSAXContentHandlerServiceBoss));<br />saxHandler->Register(saxServices);<br />bool16 parseFailed = saxServices->ParseStream(readStream, saxHandler);<br /><br />Can you give me any help?<br /><br />Thanks and regards!

  • How to get the file path from HTML input form in Firefox3

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature'.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    Doubleposted and ignored any previous answer: [http://forums.sun.com/thread.jspa?threadID=5342405]. Don't do that. It's rude.
    Regarding to your "problem": why do you need the file path?

  • How to get the file path from HTML input form in Firefox 3...

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature' because it causes all upload forms in my webapp to stop working on Firefox 3.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    As you're posting this in the JSF forum and looking at your [previous topic|http://forums.sun.com/thread.jspa?threadID=5342365], I assume that you're using Tomahawk's t:inputFileUpload. In this case, just use UploadedFile#getInputStream(). You may find this article useful: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
    By the way, are you lazy or just dumb? You wasted one week to this! I've posted the aforementioned article one week ago. How did you stuck?

  • How to force the File Path Control Browser button to the RT Target instead of the host machine?

    I am building an application on a RT PXI system, and for one of the functions I would like the user to be able to use the browser button of the File Path Control to choose a directory on the PXI. However the browser button seems to only want open a file on the host PC, even though the application is fully deployed on the target. Note that I am controlling the PXI from a host PC.
    If anyone has any suggestions that would be great. Thanks.

    Hi,
    Unfortunately, there is not a VI to do this. Are you browsing to these files from your host VI? In order to access the files on your PXI RT target, you'll need to FTP in and browse to them that way. You could programmatically do this, but there is not a simple VI to do so.
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • How to get the file name from downloads folder with the applescript??

    Hi All..
    I am downloading an application to downloads folder, I need to install the same application after downloading programatically.
    So how do I get the filename in runtime while downloading or after downloading from downloads folder with Applescript or Java?
    Also my download URL link doesnot contain full name of the download file.
    Pls suggest.

    Hi,
    The best method is to use curl.
    Other methods are not reliable, but can work, it depends on several factors (what the script does, what the user does).
    Here is an example with the curl command:
    set tUrl to "http://sourceforge.net/projects/vlc/files/2.0.4/macosx/vlc-2.0.4.dmg/download?ac cel_key=60%3A1350656196%3Ahttp%253A//www.videolan.org/vlc/download-macosx.html%3 A7233e4e9%245818d66f39b0576e1e9c4a0f3b46b1991180bfdd&click_id=976a88ee-19f7-11e2 -9a21-0200ac1d1d8e&source=accel"
    set dFolder to path to downloads folder
    tell application "Finder" to set newFolder to (make new folder at dFolder) as string
    set f to quoted form of POSIX path of newFolder
    do shell script "cd " & f & " && curl -L " & tUrl & " -o 'vlc.dmg'" -- download  to file "vlc.dmg"
    set downloadedFile to newFolder & "vlc.dmg" --<-- HFS path
    --do something with the downloadedFile

  • How to get the file path of selected file using JFileChooser

    Hi All,
    I am trying to store the file on my FTP server after selecting the file from the user workstation using JFileChooser. But I am not able to write the file on FTP server or on user local machine where application is running. I am new to this FTP server coding. Can anyone help me in this.
    This is the code I wrote on button click user will able to select the file:
    String filename1;
    File file;
    JFileChooser fc = new JFileChooser();
    fc.showOpenDialog(this);
    file = fc.getSelectedFile();
    filename1 = file.getPath();
    txtFilePath.setText(filename1);
    Below is the code to write the file on my local machine first:
    BufferedWriter outFile = new BufferedWriter( fileName ) );
    outFile.write();
    outFile.flush( );
    outFile.close( );
    Any help will be greatly appriciated

    rp0428 wrote:
    >
    BufferedWriter outFile = new BufferedWriter( fileName ) );
    >
    There is NOTHING named 'fileName' in any of the code you posted so that code can't possibly compile let alone actually run.
    How can anyone help you if you won't post the actual code you are using?Its just a random snippet of other code that is totally irrelevant to this thread if you ask me.

Maybe you are looking for

  • Is there a way to prevent psd from being the default file extension?

    In previous versions, psd was added automatically if the document was layered. Since I don't use psd, I had to manually change to tiff. But I'm finding that even flat (unlayered) files that came in as jpgs have psd inserted as the default. I would ha

  • SXI_MONITOR: Scheduled for Outbound Processing

    Hi folks, After a connection problem with AE, now already fixed. Iu2019m experiencing a strange issue!! It occurs at only one interface where the message gets stuck at SXI_MONITOR with the status u201Cscheduled for outbound processingu201D without an

  • Create one-Many orders in a single forms?

    Hi all, I would like to create a form which is a master and details by using struts. Customer ID: ID Qty Price xxx 12 12 bbb 11 10 The user would like to enter the customer id, then s/he input the details How can I do on the jsp and actionForm? What

  • Can't get windows live id screen to go away

    wjen I try to open forefox from my deaktop a windows live ID screen come up that says MUST ALLOW COOKIES. I can't find the firefox dropdown tab in the left corner

  • Battery Level dropping

    Hi, I use my laptop at home, plugged in to the mains all the time. It is 6 months old. The battery charge level seems to be dropping every day - now it only reads 71%. I have run the battery right down and recharged but it still never reaches 100 (or