Skip to Content
3 days ago

PROVIDE Statement between filter not working?


Hello everybody,

I have encountered a problem with the PROVIDE Statement which produces really weird results for me...

Basically, I want to filter in the table p2001 entries between begda_pa (01.01.2021) and ennda_pa (31.11.2021) and if the subty equals x, perform something.

While debugging I noticed that the first 6 entries are correctly analyzed and everything runs as expected.

Then after no entries should be left in the given timespan 01.01.2021 - 31.11.2021:

The loop continues with p2001-begda set to 20210101 on EVERY loop cycle! and p2001-ennda gets the correct dates of the following entries in p2001 like 20140130.

There is no entry in p2001 with begda = 20210101 and endda 20140130.

The loop should have stopped after 6 cycles.

I'm thankful for any information to what is happening here!

my program looks sth. like this:

DATA: begda_pa TYPE d.
DATA: endda_pa TYPE d.    
begda_pa = pn-begda.
begda_pa+4 = '0101'.
endda_pa = pn-endda.
endda_pa+4 = '1231'.
PROVIDE subty FROM p2001 BETWEEN begda_pa AND endda_pa.
   IF p2001-subty = '0300' OR
      p2001-subty = '0600' OR
      p2001-subty = '0620' .
        PERFORM ...