<?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: Upload Application Server File...? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542019#M246859</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 use below code to first know the filename and&lt;/P&gt;&lt;P&gt;then you can use for open dataset statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: IT_FILES LIKE EPSFILI OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
  EXPORTING
    DIR_NAME                     = '/dir/subdir'
   FILE_MASK                    = 'smsqry_*'
* IMPORTING
*   DIR_NAME                     =
*   FILE_COUNTER                 =
*   ERROR_COUNTER                =
  TABLES
    DIR_LIST                     = IT_FILES
 EXCEPTIONS
   INVALID_EPS_SUBDIR           = 1
   SAPGPARAM_FAILED             = 2
   BUILD_DIRECTORY_FAILED       = 3
   NO_AUTHORIZATION             = 4
   READ_DIRECTORY_FAILED        = 5
   TOO_MANY_READ_ERRORS         = 6
   EMPTY_DIRECTORY_LIST         = 7
   OTHERS                       = 8.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now in it_files you will have the list of files for the &lt;/P&gt;&lt;P&gt;pattern, basing on your requirement you can filter the details and use the required filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope the above info helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Sep 2006 09:16:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-02T09:16:55Z</dc:date>
    <item>
      <title>Upload Application Server File...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542018#M246858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I have to upload a file from Application server, the file name is "smsqry_20060902_102343.txt", so the file is generated by unix system i.e."smsqry_yyyymmdd_hhmmss.txt"  so I don't know the file name, that at what time file was generated.&lt;/P&gt;&lt;P&gt;So plz. tell me how to solve this issue, plz with example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Sep 2006 05:24:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542018#M246858</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-02T05:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Upload Application Server File...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542019#M246859</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 use below code to first know the filename and&lt;/P&gt;&lt;P&gt;then you can use for open dataset statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: IT_FILES LIKE EPSFILI OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
  EXPORTING
    DIR_NAME                     = '/dir/subdir'
   FILE_MASK                    = 'smsqry_*'
* IMPORTING
*   DIR_NAME                     =
*   FILE_COUNTER                 =
*   ERROR_COUNTER                =
  TABLES
    DIR_LIST                     = IT_FILES
 EXCEPTIONS
   INVALID_EPS_SUBDIR           = 1
   SAPGPARAM_FAILED             = 2
   BUILD_DIRECTORY_FAILED       = 3
   NO_AUTHORIZATION             = 4
   READ_DIRECTORY_FAILED        = 5
   TOO_MANY_READ_ERRORS         = 6
   EMPTY_DIRECTORY_LIST         = 7
   OTHERS                       = 8.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now in it_files you will have the list of files for the &lt;/P&gt;&lt;P&gt;pattern, basing on your requirement you can filter the details and use the required filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope the above info helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Sep 2006 09:16:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542019#M246859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-02T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Upload Application Server File...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542020#M246860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as given by Eswar, you can use the function module,&lt;/P&gt;&lt;P&gt;'EPS_GET_DIRECTORY_LISTING' to get all the files starting with 'smsqry_' into itab  IT_FILES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first confirm how many files will be placed per day. if its 1 , then no problem,you can use the below logic.&lt;/P&gt;&lt;P&gt;smsqry_20060902_102343.txt&lt;/P&gt;&lt;P&gt;LOOP AT IT_FILES.&lt;/P&gt;&lt;P&gt;  IF IT_FILES-FILENAME+7(8)  = SY-DATUM.&lt;/P&gt;&lt;P&gt;    V_FILENAME = IT_FILES-FILENAME.&lt;/P&gt;&lt;P&gt;   EXIT. &lt;/P&gt;&lt;P&gt;" you got the file name here,so come out of loop.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now V_FILENAME is the file you are seeking for.&lt;/P&gt;&lt;P&gt;here i am checking 8th position to 15th position values of the file to check the date is current date or not.&lt;/P&gt;&lt;P&gt;smsqry_&amp;lt;b&amp;gt;20060902&amp;lt;/b&amp;gt;_102343.txt&lt;/P&gt;&lt;P&gt;this value i am comparing above in IF condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually i am not infront of SAP,so couldnot remember the field names in IT_FILES internal table. just i mentioned FILENAME (as a field of IT_FILES). you check it and replace it if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Sep 2006 10:30:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-application-server-file/m-p/1542020#M246860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-02T10:30:56Z</dc:date>
    </item>
  </channel>
</rss>

