How to validate a Particular Directory or file path in Presentation server.

Hi SAP gurus,
I am having a requirement where I want to download a file into the Presentation server.
The file path to download will be provided in a parameter.
What I want to do is to throw a message to the user if He/She provides a wrong Directory or File path.
For example :
Say the user is providing the file download path as " E:\test.txt", but there is no "E" drive or such directory in the presentation. So in this case I should be able to check the wrong Directory provided by the user and throw some message to the user saying there is no such Directory present. Please give a proper directory or similar messages.
I have found a FM: PFL_CHECK_DIRECTORY but i am not able to use it properly.
So do you have any FM or any method and its explanation to fulfill my requirement .

Do it this way:
tables:
  spfli.
parameters:
  p_file type rlgrap-filename          " File name
                   obligatory.
Data:
  t_final_data like table of spfli.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
   exporting
     program_name        = syst-cprog
     dynpro_number       = syst-dynnr
     field_name          = ' '
   importing
     file_name           = p_file.
at selection-screen.
  data:
    lw_file  type string.              " File Path
  lw_file = p_file.
select * from spfli into table t_final_data.
CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filename                        = lw_file
   tables
     data_tab                        = t_final_data.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
  if sy-subrc <> 0.
    message 'File not found' type 'E'.
  endif.
With luck,
Pritam.

Similar Messages

  • How to delete a local file in the presentation server.

    Hi All,
    How to delete a local file in the presentation server. As we do using 'delete dataset dsn' in application server. How can i achieve this. My requirement is after uploading file using gui_upload, i want to delete that source file. Please let me know, how can i achieve this.
    Thanks in advance.
    Regards,
    Vishal

    data: l_rc type i.
      data: f_name type string.
        move 'c:\YourFile.txt' to f_name.
        CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE
          EXPORTING
            FILENAME             = f_name
          CHANGING
            RC                   = l_rc
         EXCEPTIONS
           FILE_DELETE_FAILED   = 1
           CNTL_ERROR           = 2
           ERROR_NO_GUI         = 3
           FILE_NOT_FOUND       = 4
           ACCESS_DENIED        = 5
           UNKNOWN_ERROR        = 6
           NOT_SUPPORTED_BY_GUI = 7
           WRONG_PARAMETER      = 8
           others               = 9
        IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • How can I run a a class file on the Apache server?

    Hi Guys and Gurus,
    I am seeking some favor all of experienced gurus, i.e.
    How can I run a a class file on the Apache server?
    Actually, I want to extract some records from a MySQL Database running on Apache Server. I wrote a program just to select the columns and show them. It is now a Class file, Now how can I run this class file from the Server???
    Please advise...
    VJ

    cross posted
    http://forum.java.sun.com/thread.jsp?thread=299137&forum=31&message=1184025

  • How do I setup permission to transfer files to the MacMini Server. I thought I had it setup to do such but apparently not as I get an error message?

    How do I setup permission to transfer files to the MacMini Server. I thought I had it setup to do such but apparently not as I get an error message that I don't have permission?

    Both the Mac and Windows units we are usinghave connectivity to the MacMiniServer (on the same network) to open and edit files but cannot transfer new files to the MacMini. FileSharing is on. I went to File Sharing on the MacMini and added the appropriate users and checked FileSharing. Is there something else I needed to do?

  • URGENT PLEASE:How can I run a a class file on the Apache server?

    Hi Guys and Gurus,
    I am seeking some favor all of experienced gurus, i.e.
    How can I run a a class file on the Apache server? Can I run through an Applet?
    How can I set Environment variables in Windows2000 Professional Environment?
    Actually, I want to extract some records from a MySQL Database running on Apache Server. I wrote a program just to select the columns and show them. It is now a Class file, Now how can I run this class file from the Server???
    The code is here
    import java.sql.*;
    public class RecordShow {
    public static void main(String args[]) {
    String url = "jdbc:mysql://localhost/myhost";
    Connection con;
    String query = "select mytable.column," +
    "from mytable " +
    "where mytable.column = 1";
    Statement stmt;
    try {
    Class.forName("com.mysql.jdbc.Driver");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url,
    "myuser", "mypassword");
    stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    int rowCount = 1;
    while (rs.next()) {
    System.out.println("Row " + rowCount + ": ");
    for (int i = 1; i <= numberOfColumns; i++) {
    System.out.print(" Column " + i + ": ");
    System.out.println(rs.getString(i));
    System.out.println("");
    rowCount++;
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.print("SQLException: ");
    System.err.println(ex.getMessage());
    Please advise... THANKS
    VJ

    Ehm, I wasn't referring to you at all... read up,
    there's a comment by jschell saying that CGI might be
    easier/better for his purposes.
    Yep.
    I know PHP/Perl/whatever might be easier for some
    purposes, but only if you happen to know them and want
    to/are able to use them. Ok. But you aren't the one asking the question are you. And the person who asked the question seems to have absolutely no familiarity with Apache or applets.
    So whatever they do they are going to have to learn a lot.
    And that does indeed suggest that in all likelyhood they have not investigated the alternatives.
    And for the vast majority of internet applications, especially with smaller projects (obvious this person is not working with a large team), using perl, or something besides java, is going to be the best business solution. It is simpler, and more secure (probably due to the fact that it is simpler.)
    Since this is a Java forum, I
    answer under the assumption that people have made a
    choice one way or another to use a Java solution to
    their problem, so I try to solve it in Java first, and
    only when that fails (very seldom) do I turn to other
    solutions.You approach problems by arbritrarily deciding to try to solve it in java first and only if you fail do you then look to other solutions?
    My first step is to try to figure out which of the various avenues is going to cost less. (And a secondary, but non-trivial concern, is then to convince the customer that just because they have heard of a buzz word like 'enterprise bean' that it doesn't mean that is a cost effective solution.) We must come from different worlds.

  • How to get the loaded client sequence file path/name?

    I added a step in Process model, and wanted to get currently loaded client sequence file name/path. I used the variable of "SequenceFile.Path" but then I realized what I would get is the process model file path, not loaded client sequence file path/name. How can I get loaded client sequence file path/name?
    Thanks!
    Jacky

    I dont understand what you are trying to achieve.  Can you provide more information.
    If you are trying to dynamically load and run a client sequence file at run time you need to make a couple of calls to the TS API from inside the process model, Engine.GetSequenceFileEx to get a reference to your sequence identified by its pathname, and then Execution.ClientFile to tell the process model which sequence you want to run.
    Steve
    There are 10 types of people in the world that understand binary, those that do and those that don't.

  • How can I make Spotlight show the file path

    How can I make Spotlight show the file path in the Spotlight menu for selected file?

    Via Finder certainly, but not in the menu.  You can view the file path in the Spotlight search results display by pressing the ⌘ key (while hovering over a file in the results), though.  The path will display at the bottom of the Quick Look output, or cycle through that location.

  • Reading file from the presentation server in the background

    Hi,
    I am trying to read a .csv file from the presentation server into an internal table in the background. what should I do for it? In the foreground it works fine.
    I have declared a selection parameter 'p_file' that has the path of the file. It wokrs fine in the foreground and how to set it up in the background?
    Any thoughts would be helpful. Thanks in advance,
    VG

    hii
    did you achieved the required functionality , i,e, accessing presentation server file i nbackground .
    I too got the same requirement, can you explain the process.
    There is no way you can do it... The best method is to put the file on Appln server and then call it in the background mode.
    Regards,
    Vishwa.

  • Convert file path in application server as link

    How can we convert file path in application server as link to send email.
    Thanks
    Suresh

    Your app server folders have a mappable location on your network, e.g,
    server\path\filename.  Use an HTML anchor tag and build the link with code.  You'd be better off storing files on a file server (write to a mapped location from the app server) and link to there (same process).

  • "Bad data format" when reading txt file from the presentation server

    Hello,
    I have a piece of code which reads a txt file from the presentation server to an internal table like below:
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME              = lv_filename
    CHANGING
       DATA_TAB            = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
    When running this code, exception BAD_DATA_FORMAT is issued.
    Is it because of the file encoding or delimiter or other reason?
    Thanks,
    Yang

    Hello,
    If its tab delimited then use the has_field_seperator parameter and check
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME                = lv_filename
       FILETYPE                 = 'ASC'
       HAS_FIELD_SEPARATOR          = u2018Xu2019
    CHANGING
       DATA_TAB            = lt_tsd.
    Vikranth

  • How can I get the directory.xml file for WL6.0?

    I have installed the ALBPM Enterprise WL6.01 and started it in my server.But I get the error message when I login.
    directory configuration runtime fails to initilize with
    resource:/Aqualogic/j2eewl/tomcate/webapps/../../webapps/webconsole/WEB-INF/directory.xml
    How can I get the XML file?

    aaa, ok i misunderstood your first post, i thought you are talking about unable to use the directory.xml from your application.
    Ok, well the directory.xml file that ALBPM uses is allways in /albpm6.0/j2eewl/conf/directory.xml if we are not talking about Standalone. And when you start your albpm server it picks up the directory.xml file from there. But it picks him up only when you start it...so if you made any changes to it, you have to restart the server.
    You should check the instalation folder of your ALBPM.
    If you want to change the user/pass in the directory.xml change it in that folder and restart ALBPM.
    If you don't know how to enter new password you have to use this sintax:
    <encrypt>newPassword</encrypt>
    Because if you open the xml file you have only <encrypted> tags, and you can't change those.
    I don't know what the xml file is doing in that tomcat folder though...maybe it get's copied to that location when you start the albpm WL
    Hope this helps
    Edited by Lex_ at 12/13/2007 10:27 PM

  • How to set a root directory for file management in web application

    Is it possible to set a default root directory for file management for a web application ?
    We would upload some files and store them in the web server.
    When we write the uploaded files without any path, the files are written in the config directory into the jdeveloper embedded oc4j directory.
    When we write the uploaded with a relative path ("/somedir/filename"), the files are written in C:/somedir/filename.
    We would like that all file management with relative path into the web application refer automatically to a given root directory (for example defined in web.xml).
    Is it possible ?

    I'm using the standard upload in adf faces.
    The problem is not during upload. This is managed in a temporay directory defined in web.xml. The problem is for writing the file that was uploaded (upload give us an inputStream we have to write somewhere, eventually after unzipping).
    Here is an example of our current code.
    if (mimeType.equals("application/x-zip-compressed") |
    mimeType.equals("application/zip")) {
    File destZipFile =
    new File(rootDirectory + "/" + parametersDirectory +
    "/" + uploadedFile.getFilename());
    BufferedInputStream isZipFile =
    new BufferedInputStream(uploadedFile.getInputStream());
    FileOutputStream fosZipFile =
    new FileOutputStream(destZipFile);
    BufferedOutputStream bosZipFile =
    new BufferedOutputStream(fosZipFile, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = isZipFile.read(data, 0, BUFFER)) !=
    -1) {
    bosZipFile.write(data, 0, currentByte);
    }

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • How to get creation date of a file created in application server?

    Dear experts ,
    I have some txt files in a particular path in application server .Suppose path is - \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt.
    I want to fetch  the creation date of this txt file - test.txt . I tried with fm -  ADS2KIPUPL_GET_FILE_ATTRIBUTES , but this will give proper out put.
    I need to get file creation date. If today I am creating file - abc.txt, so according to this file I should get today's date as creation date.
    Please suggest me.  

                        BEGIN OF ty_file,
                        line(400)   TYPE c,                                      "File names
                      END   OF ty_file,
    This is the structure declaration.
    l_v_unixcom would be ls -l \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt
    now call
    CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
                    ID 'TAB'     FIELD i_file[].
    and see contents of i_file[] it should have the details, post results so we can help further

  • How to add a locally stored video file to a presentation

    Hi all ,
    I want to add a locally stored video file to a presentation .What is the url that i need to use..
    Ur help is much appreciated
    Thanks

    The recommended procedure is to create the presentation on the DMM (upload the video to the DMM) then create a deployment package using the presentation created on the DMM. Once you deploy it to the DMP, the DMM will FTP the video along with presentation files to the DMP which will contain the links to play the video that will be stored locally on the DMP.
    You may want to review the following thread to see how to trigger the local presentation to play and how to update it later:
    https://supportforums.cisco.com/message/3289668
    Regards,
    Fabio Bergamo
    Cisco TAC

Maybe you are looking for

  • Error Trapping for Report

    I have a access 2013 database.  I am trying to automate generation of 3K+ pdf reports.  I have the following code. It was working in a previous iteration of the code pictured here, but due to some "illegal" characters, was canceling the outputTo comm

  • My stories are displaying from highest to lowest in story view in Incopy but layout view displays correctly

    My linked stories are named Note pg1, Note pg2, Note pg3, etc. but in InCopy in story view, they display as Note pg3, Note pg2, Note pg1 etc. In layout view they display correctly. I need them to sort as 1, 2, 3, etc in story view. Please help!!

  • Help my program

    I am a beginning programmer and I want to make a program that accepts weight to track weight loss for my own benefit How would you program this: Enter weight: (input here) I like to have everything in one line I was thinking: System.out.println("Ente

  • Problems with certain keys...

    Hello everyone. I am having someo problems with my keyboard on my ibook g4, using os 10.3.5, and was wondering if anyone has experienced this and what might be wrong. e " key creates è, and to get a quote i have to type shift and the right angle brac

  • How do you fix a white screen on a ipod touch

    how do you fix a white screen on a ipod touch