<?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: Regular Expressions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127714#M1512032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Neelima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think Marcin's way will work, BUT the character A is hardcoded,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I have another way to do the same thing,&lt;/P&gt;&lt;P&gt;please try this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select *
  from kna1
  into TABLE lt_kna1
  WHERE NAME1 NE ''.

IF LT_KNA1[] IS NOT INITIAL.

loop at LT_KNA1 INTO WA_KNA1.
  IF WA_KNA1-name1+1(1) = '_'.
    WA2_KNA1 = WA_KNA1.
    APPEND WA2_KNA1 TO LT2_KNA1.
    CLEAR WA2_KNA1.

  ENDIF.
ENDLOOP.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jul 2010 12:35:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-23T12:35:25Z</dc:date>
    <item>
      <title>Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127711#M1512029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;   Is it possible to use Regular Expressions in select queries? I need to give condition for a field in the select query like "which begin with a character followed by an undercore". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks and regards&lt;/P&gt;&lt;P&gt;neelima&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 11:09:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127711#M1512029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-23T11:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127712#M1512030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think it is possible on  DB side. In queries you can only use &lt;STRONG&gt;LIKE&lt;/STRONG&gt; or &lt;STRONG&gt;IN&lt;/STRONG&gt; directly, but no regex. &lt;/P&gt;&lt;P&gt;You can however validate the entry with regex on Application Server side (once data are transported from the DB to a target structure). This however may have impact on query performance as you need to transport each single line from the table and skip those unnecessary. If the table is not too large and you do such query not to often then can you try it though. So you would need&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select .... from table .... into wa_structure where ...
    ..."here validate wa_structure field against regex 
    check valid = 'X'.
   ....
endselect.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 11:26:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127712#M1512030</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-07-23T11:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127713#M1512031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Neelima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use a range and CP operator for this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a select example to read KNA1-NAME1 field beginning with A and underscore :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RANGES :&lt;/P&gt;&lt;P&gt;r_name1 FOR kna1-name1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  r_name1-sign = 'I'.&lt;/P&gt;&lt;P&gt;  r_name1-option  = 'CP'.   "&amp;lt;--- this is "covers pattern" operator&lt;/P&gt;&lt;P&gt;  r_name1-low = 'A_* '.      "&amp;lt;--- here is A_* search pattern&lt;/P&gt;&lt;P&gt;  APPEND r_name1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT * FROM kna1&lt;/P&gt;&lt;P&gt;  WHERE name1 IN r_name1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     "Your selection code&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bulent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bulent Balci on Jul 23, 2010 1:34 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 11:32:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127713#M1512031</guid>
      <dc:creator>bbalci</dc:creator>
      <dc:date>2010-07-23T11:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127714#M1512032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Neelima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think Marcin's way will work, BUT the character A is hardcoded,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I have another way to do the same thing,&lt;/P&gt;&lt;P&gt;please try this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select *
  from kna1
  into TABLE lt_kna1
  WHERE NAME1 NE ''.

IF LT_KNA1[] IS NOT INITIAL.

loop at LT_KNA1 INTO WA_KNA1.
  IF WA_KNA1-name1+1(1) = '_'.
    WA2_KNA1 = WA_KNA1.
    APPEND WA2_KNA1 TO LT2_KNA1.
    CLEAR WA2_KNA1.

  ENDIF.
ENDLOOP.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 12:35:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127714#M1512032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-23T12:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127715#M1512033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;   thanks for the reply. I cant get all the details n do validation in appl serever as the DB table having large data n frequently changed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 12:37:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127715#M1512033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-23T12:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127716#M1512034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Small modification using Bulent's code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
r_name1-sign = 'I'.
r_name1-option = 'CP'. 
" + represents any character, _ - must be on second position, * - any number of character string
r_name1-low = '+_*'.   
APPEND r_name1.
...
select ....
   where field in r_name1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try it out. Likely to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 12:53:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127716#M1512034</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-07-23T12:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127717#M1512035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcin&lt;/P&gt;&lt;P&gt;   Its working.. But the problem is its taking even  if the first character is number also. like '1_********'. I need to avoid this also.. any suggestion?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 12:57:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127717#M1512035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-23T12:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127718#M1512036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you already have a pattern which filters out all unmatched entries, you can validate this one at App Serv side as the number for such result entries will be significantly lower. So In fact major filter will be on DB side, but number filtering at that position on App Serv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 13:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127718#M1512036</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-07-23T13:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127719#M1512037</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 resctrict it in  your select statement like that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM kna1&lt;/P&gt;&lt;P&gt;WHERE name1 IN r_name1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if not (&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '1' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '2' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '3'' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '4' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '5' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '6' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '7' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '8' or&lt;/P&gt;&lt;P&gt;  kna1-name1(1) eq '9' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;append somewhere&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bulent Balci on Jul 23, 2010 3:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 13:11:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127719#M1512037</guid>
      <dc:creator>bbalci</dc:creator>
      <dc:date>2010-07-23T13:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127720#M1512038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&amp;lt;div style="text-align:left"&amp;gt;Is it possible to use Regular Expressions in select queries?&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As there's already quite a few discussions going on alternatives, let me come back to your original question: It is not possible to use &lt;EM&gt;regular expressions&lt;/EM&gt; with [open SQL|http://help.sap.com/abapdocu_70/en/ABENOPENSQL.htm]. However, depending on your underlying database you might actually have this feature if you use [native SQL|http://help.sap.com/abapdocu_70/en/ABENNATIVESQL.htm]. E.g. Oracle introduced with 10g the condition [regexp_like|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/conditions018.htm].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However,use of regular expressions (if available for the database you're using) with native SQL might actually not be better than a well crafted alternative without it. So as always, try different alternatives and pick the one that performs best given your optimization requirements (e.g. time, disk IO, etc.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jul 2010 02:35:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expressions/m-p/7127720#M1512038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-24T02:35:34Z</dc:date>
    </item>
  </channel>
</rss>

