Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

pls help

Former Member
0 Likes
519

Hallo All,

this below shown code shows this output.

User enters F. Usually F+ may not appear. How can

I reach to output not F+ if F is entered. How can I filter

F+ in that case.

Acepro 500 F T Xn

Insektizid F N Xn

Optiplex 3000 F O Xi

Optiplex 3000 F O Xi

Insektizid F N Xn

Diesel, Brennstoff E F+ N

Acepro 500 F T Xn

Optiplex 3000 F O Xi

Acepro 500 F T Xn

Diesel, Brennstoff E F+ N

LOOP AT it_prokat_res INTO wa_prokat_tab.
    IF NOT s_gfsbl-low IS INITIAL.
      CREATE OBJECT regex
        EXPORTING
          pattern      = s_gfsbl-low
          simple_regex = 'X'.
 
      FIND REGEX regex IN wa_prokat_tab-gsymbol
           MATCH OFFSET moff
           MATCH LENGTH mlen.
 
      IF sy-subrc = 4.
        DELETE TABLE it_prokat_res FROM wa_prokat_tab.
      ENDIF.
    ENDIF.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
445

Hi,

Please check this code .


report zars
       no standard page heading
       line-size 255.


data : begin of itab occurs 0.
data : char(50) type c.
data : end of itab.
data : p_regex(80)   type c.

data : regex         type ref to cl_abap_regex,
       matcher       type ref to cl_abap_matcher,
       ls_result     type match_result,
       lt_result     type match_result_tab.

move 'Acepro 500 F T Xn'         to itab-char. append itab.
move 'Insektizid F N Xn'         to itab-char. append itab.
move 'Optiplex 3000 F O Xi'	 to itab-char. append itab.
move 'Optiplex 3000 F O Xi'	 to itab-char. append itab.
move 'Insektizid F N Xn'       to itab-char. append itab.
move 'Diesel, Brennstoff E F+ N' to itab-char. append itab.
move 'Acepro 500 F T Xn' 	 to itab-char. append itab.
move 'Optiplex 3000 F O Xi'    to itab-char. append itab.
move 'Acepro 500 F T Xn'         to itab-char. append itab.
move 'Diesel, Brennstoff E F+ N' to itab-char. append itab.

move '(.)[f+]>' to p_regex.
condense p_regex.
create object regex
  exporting
    pattern     = p_regex
    ignore_case = ''.

* For REGEX match
matcher = cl_abap_matcher=>create(
               pattern     = p_regex
               ignore_case = ' '
               table       = itab[] ).

lt_result = matcher->find_all( ).
loop at lt_result into ls_result.
  read table itab index ls_result-line.
  if sy-subrc eq 0.
    write :/ itab-char.
  endif.
endloop.

result comes out of this report is

ie 6th and 10th Line from the list


Diesel, Brennstoff E F+ N
Diesel, Brennstoff E F+ N

a®s

Edited by: a®s on May 30, 2008 1:48 PM

1 REPLY 1
Read only

former_member194669
Active Contributor
0 Likes
446

Hi,

Please check this code .


report zars
       no standard page heading
       line-size 255.


data : begin of itab occurs 0.
data : char(50) type c.
data : end of itab.
data : p_regex(80)   type c.

data : regex         type ref to cl_abap_regex,
       matcher       type ref to cl_abap_matcher,
       ls_result     type match_result,
       lt_result     type match_result_tab.

move 'Acepro 500 F T Xn'         to itab-char. append itab.
move 'Insektizid F N Xn'         to itab-char. append itab.
move 'Optiplex 3000 F O Xi'	 to itab-char. append itab.
move 'Optiplex 3000 F O Xi'	 to itab-char. append itab.
move 'Insektizid F N Xn'       to itab-char. append itab.
move 'Diesel, Brennstoff E F+ N' to itab-char. append itab.
move 'Acepro 500 F T Xn' 	 to itab-char. append itab.
move 'Optiplex 3000 F O Xi'    to itab-char. append itab.
move 'Acepro 500 F T Xn'         to itab-char. append itab.
move 'Diesel, Brennstoff E F+ N' to itab-char. append itab.

move '(.)[f+]>' to p_regex.
condense p_regex.
create object regex
  exporting
    pattern     = p_regex
    ignore_case = ''.

* For REGEX match
matcher = cl_abap_matcher=>create(
               pattern     = p_regex
               ignore_case = ' '
               table       = itab[] ).

lt_result = matcher->find_all( ).
loop at lt_result into ls_result.
  read table itab index ls_result-line.
  if sy-subrc eq 0.
    write :/ itab-char.
  endif.
endloop.

result comes out of this report is

ie 6th and 10th Line from the list


Diesel, Brennstoff E F+ N
Diesel, Brennstoff E F+ N

a®s

Edited by: a®s on May 30, 2008 1:48 PM