Please help me check whether this is right
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'
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.
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
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.
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
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