Record in pa0000 / pa0001 has two records as follows:
Begda Endda
[03.07.2017 - 31.12.9999]
[03.01.2017 - 02.07.2017]
Selection screen has the date range: Low: 01/07/2017 and High: 31/07/2017
ABAP Code has written as follows:
Select data from Pa0001 table
SELECT PERNR
ENDDA
BEGDA
PERSG
PERSK
FROM PA0001
INTO TABLE T_PA0001
WHERE PERNR IN S_PERNR[] AND
BEGDA <= S_BUDAT-LOW AND
ENDDA >= S_BUDAT-HIGH AND
PERSG IN S_EMPGR[] AND
PERSK IN S_EMPSG[] AND
GSBER IN S_WERKS AND
BTRTL = 'FURC' .
The aforesaid two records are not captured.
I would like to re-write the code by using the method "Exclude all wrong options" instead of present method "enlist all acceptable options", as follows.
WHERE NOT ( pa0001-begda > s_budat-high or pa0001-endda < s_budat-low)
Any help in this regard will be highly appreciated.
It probably does not work because
S_BUDAT
is a header of the internal table with header lineS_BUDAT[]
so in other words it is a structure. You should rather split select optionS_BUDAT
to two parameters eg.P_LOW
andP_HIGH
and rephrase your query.The other option would be to write simply
NOT IN S_BUDAT[]
.