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

ABAP Expression FILTER not working

Former Member
0 Likes
1,234

Hello folks,

I really like the new expressions in ABAP. Especially the "FILTER" Statement. But unfortunatly, it doesn't work everytime. If you start this code here, it will result in an endless loop at the filter statement.


TYPES: BEGIN OF ty_s_itab,

          artgrp    TYPE char4,

          datum_von TYPE dats,

          datum_bis TYPE dats,

        END OF ty_s_itab,

        ty_t_itab TYPE SORTED TABLE OF ty_s_itab

WITH UNIQUE KEY artgrp datum_von datum_bis

        .

DATA: lv_datum TYPE dats VALUE '20160304'.

DATA(lt_data= VALUE ty_t_itab( artgrp = 'EC  '

                                    datum_von = '20160304'

                                    datum_bis = '20160501 ')

                                  ( artgrp = 'EC  '

                                    datum_von = '20160101'

                                    datum_bis = '20160301 ')

).

DATA(lt_filter= FILTER #( lt_data WHERE artgrp = 'EC  '

                                        AND datum_von <= lv_datum

                                        AND datum_bis >= lv_datum ).

LOOP AT lt_filter INTO DATA(ls_filter).

   WRITE: ls_filter-artgrp, ls_filter-datum_von.

ENDLOOP.

Could someone verify this or, even better, have an explanation for it? I don't understand it...

Kind regards

Bastian Stritt

4 REPLIES 4
Read only

ThomasKruegl
Participant
0 Likes
1,015

I can confirm this, endless loop at the filter statement. I have no explanations but a bug in the filter implementation.

I played around a bit:

- change second condition to "AND datum_von < lv_datum" (removing the 😃 -> code executes

- remove third condition -> code executes

- only remove "=" in third condition -> still broken.

- change lv_datum to a variable with another value for the third condition -> code executes.

No idea what exactly the problem is.

regards,

Thomas

Read only

ChristianGnter
Contributor
0 Likes
1,015

quite interesting.

Maybe Horst Keller can bring some light into the dark

Read only

0 Likes
1,015

In a 7.50 system, the process is hanging.

In a 7.51 system I get the runtime error ABAP_ASSERT.

-> Clearly a bug in the FILTER expression,  Forwarded to development.

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,015

Indeed, it is a bug that will be corrected in an upcoming kernel patch.

Thanks for notifying!