<?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: Reading Multiple Files From Application Server in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721992#M315047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Kannan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Using FM: &amp;lt;b&amp;gt;EPS_GET_DIRECTORY_LISTING&amp;lt;/b&amp;gt;, we can get the list of files existing in a directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Get the file names into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Now for each entry in the table, open the file append to an internal table of string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Hope this gives you some idea.&lt;/P&gt;&lt;P&gt;&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>Thu, 02 Nov 2006 16:07:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-02T16:07:17Z</dc:date>
    <item>
      <title>Reading Multiple Files From Application Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721990#M315045</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 a requirement to read more than one file that have the name for e.g abc*.txt from the application server. The program has to read all the files one by one that has the name that starts with 'abc' and file type .txt. All the files to be put into one internal table of line type string for further processing. Please suggest me a suitable solution for this req.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help in advance.&lt;/P&gt;&lt;P&gt;Kannan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 15:45:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721990#M315045</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T15:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multiple Files From Application Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721991#M315046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this code will serve your purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF P_AFILE CS '.csv'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LV_FILENAME = P_AFILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    TRANSLATE LV_FILENAME TO LOWER CASE.&lt;/P&gt;&lt;P&gt;    IF P_AFILE CS SY-SYSID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      TRANSLATE LV_FILENAME+SY-FDPOS(3) TO UPPER CASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Open Dataset&lt;/P&gt;&lt;P&gt;    OPEN DATASET LV_FILENAME FOR INPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IT_FILELIST-FILE_NAME = P_AFILE.&lt;/P&gt;&lt;P&gt;      APPEND IT_FILELIST.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ELSEIF  P_AFILE CS '*'.&lt;/P&gt;&lt;P&gt;    DG_UNIX_LOC(9)    = 'ls *.csv '.&lt;/P&gt;&lt;P&gt;    DG_UNIX_LOC+9(45) = P_AFILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA : V_STRING(100) TYPE C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH DT_TABL.&lt;/P&gt;&lt;P&gt;    CALL 'SYSTEM' ID 'COMMAND' FIELD DG_UNIX_LOC&lt;/P&gt;&lt;P&gt;                  ID 'TAB'     FIELD DT_TABL-&lt;STRONG&gt;SYS&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT DT_TABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF DT_TABL-LINE CS 'batch/data/inb/sec-cam/sec-cam'.&lt;/P&gt;&lt;P&gt;        IT_FILELIST-FILE_NAME = DT_TABL-LINE.&lt;/P&gt;&lt;P&gt;        APPEND IT_FILELIST.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MESSAGE I000 WITH 'Either the File Name or File Path'&lt;/P&gt;&lt;P&gt;                      'is Wrong Please check Entry'.&lt;/P&gt;&lt;P&gt;    STOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE IT_FILELIST LINES  V_TOTALFILES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT IT_FILELIST IS INITIAL.&lt;/P&gt;&lt;P&gt;    LOOP AT IT_FILELIST.&lt;/P&gt;&lt;P&gt;      LV_FILENAME = IT_FILELIST-FILE_NAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      TRANSLATE LV_FILENAME TO LOWER CASE.&lt;/P&gt;&lt;P&gt;      IF P_AFILE CS SY-SYSID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        TRANSLATE LV_FILENAME+SY-FDPOS(3) TO UPPER CASE.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;*-- Open Dataset&lt;/P&gt;&lt;P&gt;      OPEN DATASET LV_FILENAME FOR INPUT IN TEXT MODE MESSAGE MSG.&lt;/P&gt;&lt;P&gt;      IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;        REFRESH: IT_DATA2,&lt;/P&gt;&lt;P&gt;                IT_ERROR,&lt;/P&gt;&lt;P&gt;                IT_HISTORY,&lt;/P&gt;&lt;P&gt;                IT_DATA,&lt;/P&gt;&lt;P&gt;                IT_DATA1.&lt;/P&gt;&lt;P&gt;        DO.&lt;/P&gt;&lt;P&gt;*-- Read Dataset and Populate Input file data to Internal Table&lt;/P&gt;&lt;P&gt;          READ DATASET LV_FILENAME INTO IT_DATA2.&lt;/P&gt;&lt;P&gt;          IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;*-- Append and Initialize table&lt;/P&gt;&lt;P&gt;            APPEND IT_DATA2.&lt;/P&gt;&lt;P&gt;            CLEAR  IT_DATA2.&lt;/P&gt;&lt;P&gt;          ELSE.&lt;/P&gt;&lt;P&gt;*-- Exit Out of DO loop if READ is unsuccess&lt;/P&gt;&lt;P&gt;            EXIT.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;        ENDDO.&lt;/P&gt;&lt;P&gt;*-- Close Dataset&lt;/P&gt;&lt;P&gt;        CLOSE DATASET LV_FILENAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete File in Actual Run ONLY&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IF P_TRUN IS INITIAL.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete the File&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          DELETE DATASET LV_FILENAME.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     IF IT_INPUT[] IS INITIAL.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IF IT_DATA2[] IS INITIAL.&lt;/P&gt;&lt;P&gt;          STOP.&lt;/P&gt;&lt;P&gt;        ELSE.&lt;/P&gt;&lt;P&gt;*-- Populate History Table&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       IT_HISTORY[] = IT_INPUT[].&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          PERFORM PROCESS_FILES USING LV_FILENAME.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;*-- Go to the End of Selection&lt;/P&gt;&lt;P&gt;        STOP.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MESSAGE I000 WITH 'Either the Specified file does not exist'&lt;/P&gt;&lt;P&gt;                      'or the Directory is Empty'.&lt;/P&gt;&lt;P&gt;    STOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 16:01:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721991#M315046</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T16:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multiple Files From Application Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721992#M315047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Kannan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Using FM: &amp;lt;b&amp;gt;EPS_GET_DIRECTORY_LISTING&amp;lt;/b&amp;gt;, we can get the list of files existing in a directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Get the file names into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Now for each entry in the table, open the file append to an internal table of string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Hope this gives you some idea.&lt;/P&gt;&lt;P&gt;&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>Thu, 02 Nov 2006 16:07:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721992#M315047</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T16:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multiple Files From Application Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721993#M315048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kannan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check this threads for solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2078320"&gt;&lt;/A&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="246732"&gt;&lt;/A&gt;&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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 16:11:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721993#M315048</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T16:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multiple Files From Application Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721994#M315049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Easwar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I am trying to test this FM but i could not, as it throwe an error message saying invalid directory or read direcoty failed. Can you please provide me some tips on the input parameters of this FM?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Kannan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 16:44:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-multiple-files-from-application-server/m-p/1721994#M315049</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T16:44:41Z</dc:date>
    </item>
  </channel>
</rss>

