<?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 File Path Validation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881280#M932792</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;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know how can we acheive this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;FS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jun 2008 05:17:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-03T05:17:43Z</dc:date>
    <item>
      <title>File Path Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881280#M932792</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;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know how can we acheive this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;FS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 05:17:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881280#M932792</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T05:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: File Path Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881281#M932793</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;Use this code in action button for upload a file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;InputStream text = null;&lt;/P&gt;&lt;P&gt;int temp = 0;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;File file = new File(wdContext.currentContextElement().getUp().getResourceName());&lt;/P&gt;&lt;P&gt;FileOutputStream op = new FileOutputStream(file);&lt;/P&gt;&lt;P&gt;if(wdContext.currentContextElement().getUp()!=null)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;text = wdContext.currentContextElement().getUp().read(false);&lt;/P&gt;&lt;P&gt;while((temp=text.read())!=-1)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;op.write(temp);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;op.flush();&lt;/P&gt;&lt;P&gt;op.close();&lt;/P&gt;&lt;P&gt;String path = file.getAbsolutePath();&lt;/P&gt;&lt;P&gt;wdComponentAPI.getMessageManager().reportSuccess(path);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;catch(Exception e)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;e.printStackTrace(); &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="478890"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 05:20:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881281#M932793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T05:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: File Path Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881282#M932794</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;     Check this link........ here also same discussion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 05:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881282#M932794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T05:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: File Path Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881283#M932795</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;Two Options:&lt;/P&gt;&lt;P&gt;1.You can hardcode the file path in your program and check it   inside your program .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can move file path to your filename variable inside your program though the user enters it as input in selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. You can create a Ztable with usernames and file paths and then maintain entries and write select queries to validate users and their designated file paths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards Points if useful.&lt;/P&gt;&lt;P&gt;Anita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 05:22:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881283#M932795</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T05:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: File Path Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881284#M932796</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;Validating file path on the Presentation Server&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To validate a file path on the presentation server, use the method directory_exist available in the class cl_gui_frontend_services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo program to validate the file path on the presentation server:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zdir_test.&lt;/P&gt;&lt;P&gt;TYPE-POOLS: abap.&lt;/P&gt;&lt;P&gt;DATA: v_dir TYPE string.&lt;/P&gt;&lt;P&gt;DATA: v_bol TYPE abap_bool.&lt;/P&gt;&lt;P&gt;v_dir = 'c:\sap\'.&lt;/P&gt;&lt;P&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;directory_exist&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    directory            = v_dir&lt;/P&gt;&lt;P&gt;  RECEIVING&lt;/P&gt;&lt;P&gt;    result               = v_bol&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    cntl_error           = 1&lt;/P&gt;&lt;P&gt;    error_no_gui         = 2&lt;/P&gt;&lt;P&gt;    wrong_parameter      = 3&lt;/P&gt;&lt;P&gt;    not_supported_by_gui = 4&lt;/P&gt;&lt;P&gt;    OTHERS               = 5.IF NOT v_bol IS INITIAL.&lt;/P&gt;&lt;P&gt;  WRITE:/ 'Directory exists.'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE:/ 'Directory does not exist.'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLZ reward if helpful,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;S.Gangi reddy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 05:23:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-path-validation/m-p/3881284#M932796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T05:23:16Z</dc:date>
    </item>
  </channel>
</rss>

