Please help me check whether this is right

Question:
HI all abap experts,
Please help me check the code below...
Please help me check the last line of the code. Seems like me getting a dump for it. My objective is to have fill ocalday like a select-option , choosing records which is more than 21days ago to future and older than 3 years ago.
DATA:
21days = sy-datlo - 21.
3years = sy-datlo .
subtract 3 from 3years+0(4).
CALL FUNCTION 'XXX'
EXPORTING
I_THX_SEL ='0CALDAY >= 21 days AND < 3years'
Answer:
you could use a self maintaining Variant that way you could take your dates straight from the Select-option and not be messing around like this.
Answer:
I was thinking that I am not able to do that because the values changes by the day. depending on sy-datlo. Please advise any other simpler way to get this done
Answer:
you can set a select-option to display todays date whenever you access the variant hence self-maintaining variant.
To do this click on Variable for the field when creating the variant then click on variable selections and choose the option that suits you best. For you 3 year one you could set up and ofset from todays date this too would always be current when used.
Good luck.
Answer:
The reason for your code error is that R/3 holds dates in an internal format that is numeric and not date.
try the following
DATA:
21days like sy-datlo,
3years  like sy-datlo,
datechar(10) type c.
21days = sy-datlo - 21.
write sy-datlo to datechar.
subtract 3 from datechar+6(4).
3years  =  datechar.
CALL FUNCTION 'XXX'
EXPORTING
I_THX_SEL ='0CALDAY >= 21 days AND < 3years'
MattG
Answer:
Dear Blur:
I don't know which FM you want to call and what the structure of the field is. But no record is >=21 days AND < 3 years. Try OR...
Regards,
Wolfgang

More Articles:

search help problem?
business connectors?
CONVERT_TO_FOREIGN_CURRENCY?
Add items to Menu in 4.6 C?
How to get Cum. balance of a general Account from tables?
How to get Cum balance of a general acc for specified month?