<?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: Function/method for getting directory list in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225102#M769199</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The system command doesn't return a proper result. &lt;/P&gt;&lt;P&gt;I'm going to try to rewrite the function RZL_READ_DIR_LOCAL for filename with lenght 128 or so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Jan 2008 09:56:19 GMT</pubDate>
    <dc:creator>h_senden2</dc:creator>
    <dc:date>2008-01-04T09:56:19Z</dc:date>
    <item>
      <title>Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225099#M769196</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'm looking for a function module or class method for getting all files (or with a filter) from a directory on the application server. I have found the function EPS_GET_DIRECTORY_LISTING and RZL_READ_DIR_LOCAL, but both are not working for files with names longer than 32. And my filenames are at least 50 characters long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 09:04:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225099#M769196</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2008-01-04T09:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225100#M769197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hans,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try sth like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION Y_GET_DIRECTORY_LISTING_HP_UX.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Lokale Schnittstelle:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(DIR) LIKE  RLGRAP-FILENAME OPTIONAL&lt;/P&gt;&lt;P&gt;*"     VALUE(FILE_MASK) LIKE  RLGRAP-FILENAME DEFAULT SPACE&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(DIR_NAME) LIKE  RLGRAP-FILENAME&lt;/P&gt;&lt;P&gt;*"     VALUE(FILE_COUNTER) LIKE  EPSF-EPSFILSIZ&lt;/P&gt;&lt;P&gt;*"     VALUE(COMMAND) LIKE  RLGRAP-FILENAME&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      DIR_LIST&lt;/P&gt;&lt;P&gt;*"  EXCEPTIONS&lt;/P&gt;&lt;P&gt;*"      DIR_NOT_EXIST&lt;/P&gt;&lt;P&gt;*"      NO_AUTHORIZATION&lt;/P&gt;&lt;P&gt;*"      READ_DIRECTORY_FAILED&lt;/P&gt;&lt;P&gt;*"      EMPTY_DIRECTORY_LIST&lt;/P&gt;&lt;P&gt;*"      FALSE_OS&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: NAME like rlgrap-filename.&lt;/P&gt;&lt;P&gt;  data: lv_mgr_user            type as4user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: BEGIN OF TABL OCCURS 0,          "Table for system-call&lt;/P&gt;&lt;P&gt;            LINE type string,&lt;/P&gt;&lt;P&gt;        END OF TABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;authority check&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'TMS_CI_GET_USER_INFO'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            ev_mgr_user = lv_mgr_user.&lt;/P&gt;&lt;P&gt;  call function 'TR_AUTHORITY_CHECK_ADMIN'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            iv_user          = lv_mgr_user&lt;/P&gt;&lt;P&gt;            iv_adminfunction = 'EPS1'&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            others           = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    RAISE NO_AUTHORIZATION.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*nur für HP-UX und AIX&lt;/P&gt;&lt;P&gt;  if sy-OPSYS &amp;lt;&amp;gt; 'HP-UX'.&lt;/P&gt;&lt;P&gt;    raise false_os.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    dir_name = dir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate dir_name file_mask into name separated by '/'.&lt;/P&gt;&lt;P&gt;  concatenate 'ls' name into command separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND&lt;/P&gt;&lt;P&gt;                ID 'TAB'     FIELD TABL-&lt;STRONG&gt;SYS&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  dir_list[] = tabl[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  describe table dir_list lines file_counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF FILE_COUNTER &amp;gt; 0.&lt;/P&gt;&lt;P&gt;    SORT DIR_LIST.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    RAISE EMPTY_DIRECTORY_LIST.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;greetings Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 09:29:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225100#M769197</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2008-01-04T09:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225101#M769198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andreas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. It seems that are no standard SAP functions to do this job ?&lt;/P&gt;&lt;P&gt;I believe that we don't have a HPUX system but Linux. Is it still working ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i'm going to try it &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 09:35:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225101#M769198</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2008-01-04T09:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225102#M769199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The system command doesn't return a proper result. &lt;/P&gt;&lt;P&gt;I'm going to try to rewrite the function RZL_READ_DIR_LOCAL for filename with lenght 128 or so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 09:56:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225102#M769199</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2008-01-04T09:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225103#M769200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;...or try without these line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;DEL&gt;raise false_os.&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Andreas Mann on Jan 4, 2008 11:04 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 10:02:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225103#M769200</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2008-01-04T10:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225104#M769201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andreas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i had tried that already. Didn't work &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 10:29:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225104#M769201</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2008-01-04T10:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225105#M769202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use function module &lt;STRONG&gt;TMP_GUI_DIRECTORY_LIST_FILES&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sample Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:    &lt;/P&gt;&lt;P&gt;DIR_NAME LIKE  RLGRAP-FILENAME,&lt;/P&gt;&lt;P&gt;FILE_MASK TYPE  C DEFAULT SPACE,&lt;/P&gt;&lt;P&gt;        file_table        TYPE sdokpath OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;        dir_table         TYPE sdokpath OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;        fullpath          TYPE sdokpath.&lt;/P&gt;&lt;P&gt;REFRESH file_paths.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              directory  = dir_name&lt;/P&gt;&lt;P&gt;              filter     = file_mask&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           FILE_COUNT =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          DIR_COUNT  =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;         TABLES&lt;/P&gt;&lt;P&gt;              file_table = file_table&lt;/P&gt;&lt;P&gt;              dir_table  = dir_table&lt;/P&gt;&lt;P&gt;         EXCEPTIONS&lt;/P&gt;&lt;P&gt;              cntl_error = 1&lt;/P&gt;&lt;P&gt;              OTHERS     = 2.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*No_file_exists&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF ( NOT dir_name CP '*\' ).&lt;/P&gt;&lt;P&gt;      CONCATENATE dir_name '\' INTO dir_name.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT file_table.&lt;/P&gt;&lt;P&gt;      CONCATENATE dir_name file_table-pathname INTO fullpath.&lt;/P&gt;&lt;P&gt;      APPEND fullpath TO file_paths.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT dir_table.&lt;/P&gt;&lt;P&gt;      CONCATENATE dir_name dir_table-pathname INTO fullpath.&lt;/P&gt;&lt;P&gt;      APPEND fullpath TO file_paths.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;___________________________________________________________________________________&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                                                   Or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use function module &lt;STRONG&gt;'RZL_READ_DIR_LOCAL'&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sample code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      rec(1000) type c,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;data: wa(1000) type c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;data: p_file type localfile.&lt;/P&gt;&lt;P&gt;data: ifile type table of  salfldir with header line.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;parameters: p_path type salfile-longname&lt;/P&gt;&lt;P&gt;                    default '/usr/sap/TST/DVEBMGS01/data/'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;call function 'RZL_READ_DIR_LOCAL'&lt;/P&gt;&lt;P&gt;     exporting&lt;/P&gt;&lt;P&gt;          name           = p_path&lt;/P&gt;&lt;P&gt;     tables&lt;/P&gt;&lt;P&gt;          file_tbl       = ifile&lt;/P&gt;&lt;P&gt;     exceptions&lt;/P&gt;&lt;P&gt;          argument_error = 1&lt;/P&gt;&lt;P&gt;          not_found      = 2&lt;/P&gt;&lt;P&gt;          others         = 3.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;loop at ifile.&lt;/P&gt;&lt;P&gt;  format hotspot on.&lt;/P&gt;&lt;P&gt;  write:/ ifile-name.&lt;/P&gt;&lt;P&gt;  hide ifile-name.&lt;/P&gt;&lt;P&gt;  format hotspot off.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;at line-selection.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  concatenate p_path ifile-name into p_file.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  clear itab.  refresh itab.&lt;/P&gt;&lt;P&gt;  open dataset p_file for input in text mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    do.&lt;/P&gt;&lt;P&gt;      read dataset p_file into wa.&lt;/P&gt;&lt;P&gt;      if sy-subrc  0.&lt;/P&gt;&lt;P&gt;        exit.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      itab-rec = wa.&lt;/P&gt;&lt;P&gt;      append itab.&lt;/P&gt;&lt;P&gt;    enddo.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  close dataset p_file.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  loop at itab.&lt;/P&gt;&lt;P&gt;    write:/ itab.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: for unicode (ECC 6.0), we have to add "ENCODING DEFAULT" with "open dataset ".&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 11:10:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225105#M769202</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-04T11:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Function/method for getting directory list</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225106#M769203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;problem solved&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2008 11:19:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-method-for-getting-directory-list/m-p/3225106#M769203</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2008-01-04T11:19:15Z</dc:date>
    </item>
  </channel>
</rss>

