<?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: file pattern (string) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862140#M671189</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;Please try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: l_datum like sy-datum,
      l_date1 like sy-datum,
      l_date2 like sy-datum.     

l_date1 = '20071002'.
l_date2 = '20071004'.

loop at itab.
  clear l_datum.
  l_datum = itab-file+9(8). 
 
  if l_datum between l_date1 and l_date2.  
    move itab-file to itab2-file.
    append itab2.
  endif.

endloop.
&lt;/CODE&gt;&lt;/PRE&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, 04 Oct 2007 22:30:27 GMT</pubDate>
    <dc:creator>ferry_lianto</dc:creator>
    <dc:date>2007-10-04T22:30:27Z</dc:date>
    <item>
      <title>file pattern (string)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862138#M671187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to find out the files from the internal table which are in the given date range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example Files will be in the following format,&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; fielname_YYYYMMDD&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;here &amp;lt;b&amp;gt;yyyymmdd&amp;lt;/b&amp;gt; is the date. If the date range is 20071002 to 20071004 then i need to fetch 3 files from the internal table. the files are&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;filename_20071002&lt;/P&gt;&lt;P&gt;filename_20071003&lt;/P&gt;&lt;P&gt;filename_20071004&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can someone help me how to do this in an efficient way.&lt;/P&gt;&lt;P&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;Amal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 21:53:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862138#M671187</guid>
      <dc:creator>former_member671224</dc:creator>
      <dc:date>2007-10-04T21:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: file pattern (string)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862139#M671188</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;Let's assume if you have v_date_low and v_date_high&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


* Create a new intenral table to have the dates.
  DATA: t_date type standard table of sydatum.
  data: s_date type sydatum.  

  DO.

    if sy-index = 1.
      s_date = v_date_low.
      append s_date to t_date.
      continue.
    endif.

    v_date_low = v_date_ low + 1.    " Increment the date low

    s_date = v_date_low.
    append s_date to t_date.

* Exit condition.
    if v_date_low = v_date_high.
      exit.
    endif.    


  ENDDO.

***Now you have all the dates in the intenral table T_DATE.

  LOOP AT t_date into s_date.

* concatenate to get the filename.
    CONCATENATE 'FILENAME' s_date INTO v_filename.

* Call the function module RZL_READ_DIR_LOCAL with the variable v_filename
* to get the file contents.


  ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 22:29:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862139#M671188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-04T22:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: file pattern (string)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862140#M671189</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;Please try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: l_datum like sy-datum,
      l_date1 like sy-datum,
      l_date2 like sy-datum.     

l_date1 = '20071002'.
l_date2 = '20071004'.

loop at itab.
  clear l_datum.
  l_datum = itab-file+9(8). 
 
  if l_datum between l_date1 and l_date2.  
    move itab-file to itab2-file.
    append itab2.
  endif.

endloop.
&lt;/CODE&gt;&lt;/PRE&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, 04 Oct 2007 22:30:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862140#M671189</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2007-10-04T22:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: file pattern (string)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862141#M671190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ferry,&lt;/P&gt;&lt;P&gt;Your Suggestion solved my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Oct 2007 21:45:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-pattern-string/m-p/2862141#M671190</guid>
      <dc:creator>former_member671224</dc:creator>
      <dc:date>2007-10-08T21:45:22Z</dc:date>
    </item>
  </channel>
</rss>

