Validation of file path

Hi all,
I need to validate the filepath while downloading the excel file. To elaborate this, When user is given a space on screen to put on the path where the he wants to save the excel file, I need to check that path, whether its valid or not.
Please tell me if there is any FM or any method to do it?
Regards,
Nikita
Edited by: Nikita Jain on Oct 17, 2008 2:29 PM

Hi
Check the following Code
types for data to be downloaded
types: begin of tp_kna1,
KUNNR type kna1-kunnr, " customer number
LAND1 type kna1-land1, " Country Key
NAME1 type kna1-name1, " customer name
ORT01 type kna1-ort01, " city
PSTLZ type kna1-pstlz, " postal code
REGIO type kna1-regio, " region
end of tp_kna1.
I n t e r n a l T a b l e s
Internal table for data to be downloaded
data: it_kna1 type standard table of tp_kna1 with header line.
S e l e c t i o n S c r e e n
selection-screen begin of block b1 with frame title text-001.
parameters: p_afile type rlgrap-filename
default 'customer.txt'.
selection-screen end of block b1.
At selection screen on value request
at selection-screen on value-request for p_afile.
*--Get the F4 help for Sales Deal File
perform get_val_help changing p_afile .----
S t a r t o f s e l e c t i o n
start-of-selection.
Upload the data from Sales Deal file
perform upload_app_file.
end-of-selection.
perform write_data.
*& Form upload_app_file
Upload the application server file data
form upload_app_file.
data: l_msg(100). " error message
open dataset p_afile for input in text mode encoding default message
l_msg.
if sy-subrc 0.
message i004 with l_msg.
else.
do.
read dataset p_afile into it_kna1.
if sy-subrc = 0.
append it_kna1.
clear it_kna1.
else.
exit.
endif.
enddo.
close dataset p_afile.
endif.
endform. " upload_app_file
*& Form write_data
text
--> p1 text
<-- p2 text
FORM write_data .
loop at it_kna1.
write:/ it_kna1-kunnr,
it_kna1-land1,
it_kna1-name1,
it_kna1-ort01,
it_kna1-pstlz,
it_kna1-regio.
endloop.
ENDFORM. " write_data
*& Form get_val_help
Get F4 help for the File name
form get_val_help changing p_file type rlgrap-filename.
call function 'F4_FILENAME'
importing
file_name = p_file
exceptions
others = 1.
if sy-subrc 0.
message e001. " File Open Error
endif.
endform. " get_val_help
Regards
Rajesh

Similar Messages

  • File path validation in the background fails - Urgent

    Hi,
    my program is to download files in the presentation server. so iam validating the file path using method CALL METHOD cl_gui_frontend_services=>directory_exist
    but when i execute the program in the back ground its giving dump with a runtime error as OBJECTS_OBJREF_NOT_ASSIGNED.
    could some body help on this
    Neha

    Hi.. neha,
    use this function module..
    EPS_OPEN_INPUT_FILE
    give the file name and directory path as input to this function module..
    if any exception raised like OPEN_FAILED then the file doesnot exist..(sy-subrc value will be set to 6 for this exception )..
    so you can write the code as
    call function '<b>EPS_OPEN_INPUT_FILE</b>'
      exporting
        file_name                    = '<b>ASDA</b>'
       DIR_NAME                     = '<b>D:\usr\sap\R3S\DVEBMGS02\work</b>'
      TEXT_MODE                    = ' '
    IMPORTING
      DIR_NAME                     =
      FILE_PATH                    =
      FILE_SIZE                    =
    EXCEPTIONS
       INVALID_EPS_SUBDIR           = 1
       SAPGPARAM_FAILED             = 2
       BUILD_DIRECTORY_FAILED       = 3
       NO_AUTHORIZATION             = 4
       BUILD_PATH_FAILED            = 5
       OPEN_FAILED                  = 6
       READ_DIRECTORY_FAILED        = 7
       READ_ATTRIBUTES_FAILED       = 8
       OTHERS                       = 9
    <b>if sy-subrc eq 6.
      message 'file does not exist' type 'E'.
    else.
      write : 'file exists.'.
    endif.</b>
    ASDA is an existing file in my application server in the specified directory.. so am getting the message as FILE EXISTS.
    you can see all the directories in Application server in transaction code AL11.
    reward all helpful answers,
    sai ramesh

  • Lightroom wont start says tempoary file path not valid

    Believe this is due to an (windows 7) update.Says Lightroom cannot operate without a valid temporary file path.

    Go to the new folder location for Lightroom
    Find Lightroom.exe
    Right click Lightroom.exe
    select make "new short cut".
    drag shortcut file to desktop
    delete old LR icon
    rename shortcut you just created to what ever you want by right clicking icon and selecting rename.
    You should be good to go.
    Jim

  • Invalid File Path Names in Mac OS X

    Hello,
    I am trying to create a Javascript in Mac OS X 10.4.11, however I am having some trouble with what characters are valid in file path names in Mac OS X. Does anybody know where I can get a list of invalid characters that cannot be used in a file name?
    Thanks,
    james

    Any character other than a colon can be used in the name, but additional characters and names may be handled differently if you are interacting with the UNIX shell in the script.
    (30221)

  • The specified UNC path does not contain a valid WIM file or you do not have permission to access it. please specify a valid path

    I loaded 4 captured images into SCCM via the Add Operating System Image Wizard 2 months ago.
    I have since captured another image to the same location (which is the SCCM site server) and tried to add it to the server.
    I am getting error
    the specified UNC path does not contain a valid WIM file or you do not have permission to access it.  please specify a valid path
    nothing has changed on the site server that i can think of.
    i am domain admin and permissions have not changed.
    anyone got any answers?
    please help i am baffled

    I am having similer issues.
    Win 2003 SP2 - SCCM2007 SP2 R2 single site with MDT2010 intergrated but can not get a MDT2010 TS Captured WIM to import into SCCM OS Images "Invalid WIM". allso i tried to mount the MDT WIM image without luck (Invalid Image). however a SCCM TS
    will Capture and I can Import it into OS Images. it seems like something is amiss with MDT or WAIK possibly.

  • File Path Validation

    Hi,
    I have to move my data from my program to a flat file on the Application/ Presentation Server. Now i need to validate whether the path provided by user is a valid one or not.
    For eg. If the User enter \usr\sap\ in the presentation server path. The file shd not be saved there instead the user shd get a message to give the correct file path.
    And in case of Application Server if the user enters c:\temp it shd not accept. Also if the user gives some random value ksdjfhakf.txt in the file path it shd not take.
    Please let me know how can we acheive this.
    Regards,
    FS

    Hi
    Validating file path on the Presentation Server
    To validate a file path on the presentation server, use the method directory_exist available in the class cl_gui_frontend_services.
    Demo program to validate the file path on the presentation server:
    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.
    PLZ reward if helpful,
    Thanks,
    S.Gangi reddy.

  • Acrobat Reader won't read pdfs: "file path not valid"

    I thought that my PlayBook would be the perfect device to read pdfs in the Adobe Reader. The only problem is when I download a pdf from the internet, or copy a pdf from my computer, and click on the file icon from within the Reader, all I get is a cryptic error message that reads "The file path is not valid". No hints at what to do.
    At first I thought it was a problem with the file. But every file suffers from the same ill fate. Do you have any suggestions?

    Article ID: KB26744
    Unable to open any PDF documents on BlackBerry PlayBook
    Type: Support Content
    Last Modified: 06-17-2011
    Product(s) Affected:
        BlackBerry® PlayBook™
    Overview
    When attempting to open locally saved or attached Adobe® PDF document the following error is returned:
    The file path is not valid
    Environment
        BlackBerry® PlayBook™ tablet
    Cause
    The error is returned due to application permissions to of the Adobe® Reader application on the BlackBerry® Playbook™. The 'files' option within Adobe Reader application is set to 'Denied'.
    Resolution
    Edit the application permissions file access rights for the Adobe Reader application.
    1.  On BlackBerry Playbook open Options
    2.  Select Security -> Application Permissions
    3.  Select Adobe Reader application
    4.  Edit file permissions setting to allow the application to access files stored on BlackBerry PlayBook
    5.  Save settings by selecting Back button after making changes
    rabbitupnorth:
    This solution works! Problem solved.

  • Opening PDFs get "file path is not valid" errmsg

    very strange...
    I dumped a bunch of PDFs, word, excel & ppt files onto the documents folder. 
    All the PDFs give me "file path is not valid" errmsg and cannot be opened.
    But the word, excel & ppt files can be opened.
    Can someone help me figure it out? 
    Thanks.
    Solved!
    Go to Solution.

    solution is here: http://forums.crackberry.com/showthread.php?t=607769
    I feel also compelled to mention that I've had a ticket open at rim for this issue since 04/21 and have been escalated numerous times and yet all this time rim support has had no clue how simple the problem is to fix. This solution was posted >2 full days ago.

  • The temporary file path is not valid.  Lightroom cannot start

    Windows XP, SP3, Lightroom 2.5.
    External hard drive starts acting funny.  Round here we expect hard drive failure, so I order a new drive and when it arrives copy the backup onto the new drive.  The new drive has the same drive letter as the old one, but not the same name.  When I try to open a catalog I get: "The temporary file path is not valid.  Lightroom cannot start."  The catalogs seem to be fine, as when I open lightroom directly, not by clicking the .lrcat file, catalogs look normal.  If I copy the lrcat file to my internal hard drive it opens.  If I create a new catalog on the external drive I get the same problem.
    I have tried deleting the preferences file.  I have tried deleteing and reinstalling lightroom.  I have used the external HD on another computer with lightroom and it opens normally.
    All I can imagine is that there is some setting, somewhere in the registry which does not get erased when the lightroom gets re-installed.  Any guesses?
    I am at a loss!  Please hope me!

    Could be your Windows tempfile path is messed up. You could try going to Control Panel/Advanced and pushing the Environment Variables button.See what the TEMP and TMP variables are set to.
    Under "User Variables", both of mine are set to C:\Documents and Settings\<my name>\Local Settings\Temp.
    Under "System Variables", both are set to C:\Windows\Temp.
    Make sure that the directories referred to are legal and on accessible drives. Make sure they aren't read-only. It wouldn't hurt to create them if they don't exist.
    It's worth a try, I think.
    Hal

  • Archos 7: the file path is not valid

    Hi,
    I installed Adobe Readwe on my Archos 7 Tablet (Android 2.1).
    Every time I try to open a file the message "the file path is not valid" shows.
    Could you please help me ?
    Regards
    Konstantin Tzovanis

    Hey,
    I'm having the same problem.
    I just recently downloaded and installed the Acrobat Reader on my Archos 7 (home tablet). The installation run without any problems. But whenever I try to open a PDF file, a message shows up, telling me "Error: The file path is not valid".
    I have tried almost every single folder on my tablet. Does the PDF file need a specific file name? Do I have to create a folder (what would be it's name)?
    I haven't tried to download PDFs from the internet... it might work, but it would be great, if I can copy some PDFs from my computer to my tablet, too.
    Please Help!
    Thanks
    Matt

  • Update vault path gives "Not a valid vault file".

    Recently i've copied my vault file(s) to a larger disk.When trying to update the vault path (selecting gear below vaults) it gives me an error that it is not a valid vault file.
    The disks are both formatted as Mac OS Extended (journaled) and I received no error's during the copying.
    I know I could create a new vault file. But it should work. What Could I do to fix this?
    Thanks if you can help.
    P

    It seems your VI has been corrupted. This may have been a LabVIEW error, or a disk file I/O error. You will need to revert to a backup. You should also do a disk scan to rule out any problems with the disk.

  • Validation and F4 help on an application server file path parameter

    Hi
    I have a field on a selection screen called File Path and it is for a download program where the user needs to specify the path for the download (NOT THE ACTUAL FILENAME).
    I am trying to find a function or method that allows a user to use F4 help to browse for a directory rather than a specific file. There are lots of posts out there asking this question but all of the answers point to functions that allow you to browse for a particular file rather than just the file path/directory.
    Does anyone know of a function that provides F4 help to browse for a file path on the Server (NOT PC). I would want the user to just be able to select the directory or path and have the path returned. They should not need to pick a specific file.
    F4_DXFILENAME_TOPRECURSION is a very good function but unfortunately it makes the user pick a file rather than just a directory.
    In addition to this, does anyone know of a function or method that allows you to then validate the path\directory that is entered?
    Thanks for your help
    Nicole

    Hi,
      You can try with the FM 'EPS_GET_DIRECTORY_LISTING'. With this Fm module you will get you the list of files of a particular path in an internal table. Then you can populate this internal table in F4 help.
    Hope this solves your problem. If any difficulty, come back to me about that.
    Below are some other FM related to application server directory. Hope these Helps.
    EPS_GET_DIRECTORY_LISTING
    EPS_GET_DIRECTORY_PATH
    EPS_GET_FILE_ATTRIBUTES
    EPS_GET_FTP_SYSTEM_INFO
    Regards,
    Shailesh Jadhav

  • Application server file path vaidation

    I have written the code for application server file path validation.
      DATA : l_fname TYPE filename-fileintern." type c.
      DATA : l_filpath TYPE filename-fileintern,
             l_filname(40) TYPE c.
    PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
    AT SELECTION-SCREEN ON p_sucfil.
    l_fname = p_sucfil.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      CLIENT                        = SY-MANDT
        logical_filename              = l_fname
       OPERATING_SYSTEM              = SY-OPSYS
      PARAMETER_1                   = ' '
      PARAMETER_2                   = ' '
      PARAMETER_3                   = ' '
      USE_PRESENTATION_SERVER       = ' '
       WITH_FILE_EXTENSION           = 'X'
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
    IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
       FILE_NAME                     = l_filpath
    EXCEPTIONS
       FILE_NOT_FOUND                = 1
       OTHERS                        = 2
    IF sy-subrc <> 0.
      message 'Invalid file name' type 'E'.
    ENDIF.
    But always i will get Invalid file name.
    Y is it so.
    pls help me.

    Praveen,
    I have checked ur code and I found that if i give a logical file name from
    tran. FILE under folder 'Logical file name definition, cross client' then ur code works. Pl. check.
    Regards,
    Joy.
    DATA : l_fname TYPE filename-fileintern." type c.
    DATA : l_filpath TYPE filename-fileintern,
    l_filname(40) TYPE c.
    PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
    AT SELECTION-SCREEN ON p_sucfil.
      l_fname = p_sucfil.
      CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      logical_filename = l_fname
    operating_system = sy-opsys
      with_file_extension = 'X'
      IMPORTING
      file_name = l_filpath
      EXCEPTIONS
      file_not_found = 1
      OTHERS = 2
      IF sy-subrc <> 0.
        MESSAGE 'Invalid file name' TYPE 'E'.
      ENDIF.

  • File path of open data storage

    Hello all!
    Now I'm using the blocks of open data storage, write data and close data storage for storing and extracting result data. For the file path issue, before I
    set the data path by double clicking the "open data storage" block and inserting the file location in the indicated place, and that worked!
    Now since I made a stand alone application of this program and shall use it in other computers, the file location I inserted in open data storage block isn't
    valid any more in other PCs. So I modified my source code by connecting a "current vi path" to the open data storage block's file path node instead of
    inserting it inside the block, and this doesn't work! During running there shows an error in the write data block saying that the storage refnum isn't valid!
    I'm wondering why I couldn't specify the file path like this. Any way to allow me to specify the file path as the current vi path?
    Thanks!
    Chao
    Solved!
    Go to Solution.

    You need to account for the path changes when built in to an application, have a look at this example.
    https://decibel.ni.com/content/docs/DOC-4212
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • "not a valid short file name" and "invalid character" install errors

    Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.
    Symptoms
    While upgrading or uninstalling a Windows software application (such as iTunes for Windows or QuickTime for Windows), you may receive one of the following error messages:
    file name is not a valid short file name
    The folder path 'folder name' contains an invalid character.
    ... where file name could be the name of any file, and folder name could be the name of any folder.
    In the case of software that uses advertised shortcuts (such as recent versions of iTunes for Windows or Safari for Windows), the messages may also appear when attempting to launch software that has already been installed.
    Resolution
    The error messages are usually caused by damage to the installation database for the application. Clearing the installation database for the application by using the Windows Installer CleanUp utility can usually get you past the error message.
    (1) Click [here|http://support.microsoft.com/kb/290301] first, and read the important information about the utility.
    (2) Click the *Download the Windows Installer Cleanup Utility package now* link on that page to download a file titled msicuu2.exe.
    (3) Open the msicuu2.exe file and follow the prompts to install it.
    (4) In your Start menu click *All Programs* and then click *Windows Install Clean Up.* The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (5) Select the software you're getting the "not a valid short file name" or "invalid character" message for from the list and click Remove.
    (6) Click OK in the confirmation dialog that appears.
    (7) If you have multiple entries for the software you're getting the "not a valid short file name" or "invalid character" message for, repeat steps 5 and 6 for the other entries for the software.
    (8) Click Exit.
    (9) Restart the computer.
    If you were getting the "not a valid short file name" or "invalid character" message when trying to upgrade or launch software, now try reinstalling the latest version of the software.
    If you were getting the "not a valid short file name" or "invalid character" message when just trying to uninstall software, program files for the software in question will remain on the PC after it has been removed by the Windows Installer CleanUp utility. If you want to remove leftover program files, check in at the appropriate forum at [Apple Discussions|http://discussions.apple.com/index.jspa?categoryID=1] and ask which files can be safely removed.
    This is the 1st version of this tip. It was submitted on March 24, 2010 by b noir.
    Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.

    Go to Microsoft website to fix installer file problems.
    Click "Run now" from Fix it to remove all iTunes & related installer files:
    http://support.microsoft.com/mats/Program_Install_and_Uninstall
    Be aware that Windows Installer CleanUp Utility will not remove the actual program from your computer. However, it will remove the installation files so that you can start the installation, upgrade, or uninstall over.
    Download and Install iTunes

Maybe you are looking for