<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Validate filenames in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126137#M1618888</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I am not getting your question. Can you please elaborate your problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2011 00:20:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-12T00:20:06Z</dc:date>
    <item>
      <title>Validate filenames</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126136#M1618887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating files with a program that I have created but there is something I can't seem to succeed to fix. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a choice of either doing a logical file, a UNIX file or a physical file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though, I need to check if the name in the appropriate textbox where the file name is written is something valid. For example... In a physical file, you have to write C:\MyDocuments\SAP\test.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I write "anything" instead, I would like it to say "Hey! That's not something valid!" Of course, I saw many things that check the existence of files but I don't want to see if the file exists since if it doesn't exist, it will create one. I just want to see if what is written in the textboxs for the logical file name, the UNIX file name and the Physical file name makes sense...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something (or a few things) in SAP that can help me to validate those filenames for the three files types?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you greatly for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: SBenoit on Aug 11, 2011 9:50 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Aug 2011 19:47:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126136#M1618887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-11T19:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Validate filenames</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126137#M1618888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I am not getting your question. Can you please elaborate your problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 00:20:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126137#M1618888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-12T00:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Validate filenames</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126138#M1618889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Benoit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For local PC file:&lt;/P&gt;&lt;P&gt;I believe SAP will automatically create FILE for you while downloading itself.  So, what you can do is you go for the directory validation instead of File (though File existence check is also available). So you better split the input variable at last '/' and then check directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\MyDocuments\SAP\test.csv ==&amp;gt; Split into lv_dir and lv_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_dir = C:\MyDocuments\SAP&lt;/P&gt;&lt;P&gt;lv_file = test.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use, CL_GUI_FRONTEND_SERVICES=&amp;gt;DIRECTORY_EXIST for checking if lv_dir exist, if yes, proceed to download File.&lt;/P&gt;&lt;P&gt;If it is not existing, use CL_GUI_FRONTEND_SERVICES=&amp;gt;DIRECTORY_CREATE to create it, if you get an error in creation throw error that ' "Hey! That's not something valid!" '. &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i believe for unix file, Directory can't be created at runtime using ABAP and should pre-exist but the File is automatically created if not existing earlier. So, just use open dataset command and raise an error of invalid path if sy-subrc fails. You can also use function like EPS_GET_DIRECTORY_LISTING to validate a path (after splitting away Filename) if you need a validation firsthand.  Other functions in same Fgrp might also interest you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; BR,&lt;/P&gt;&lt;P&gt;Diwakar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 01:59:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126138#M1618889</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-12T01:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Validate filenames</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126139#M1618890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can create a regular expression to check the input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 05:58:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-filenames/m-p/8126139#M1618890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-12T05:58:03Z</dc:date>
    </item>
  </channel>
</rss>

