‎2009 Jun 23 10:14 PM
Hi everyone.
I have a very basic report where I have two date fields as parameters, 'From Date' and 'To Date'.
I want the From date to default to yesterday, and the To date to default to today.
I can set todays date simply by adding DEFAULT sy-datum to the parameter.
But I've been unable to figure out how to set yesterdays date.
I tried adding some code before the parameters eg:
lv_yesterday = sy-datum - 1.
and then add DEFAULT lv_yesterday to the parameter but it doesn't do anything.
Anybody able to help here? Seems rather trivial but no luck so far!
Moderator message - You're right, this is a pretty basic question. Please search before asking - post locked
Edited by: Rob Burbank on Jun 23, 2009 5:21 PM
Moderator message - OK - I'm going to unlock it long enough so that you can mark David's solution as - solved your problem (I'd use INITIALIZATION rather than LOAD-OF-PROGRAM though
Edited by: Rob Burbank on Jun 23, 2009 5:23 PM
‎2009 Jun 23 10:21 PM
Hello Kieran,
I think you need to calculate the date in the LOAD-OF-PROGRAM event block:
REPORT z_test.
DATA: gv_yesterday TYPE d.
PARAMETERS:
pa_date TYPE d DEFAULT gv_yesterday.
LOAD-OF-PROGRAM.
gv_yesterday = sy-datum - 1.
Best regards
David
‎2009 Jun 23 10:21 PM
Hello Kieran,
I think you need to calculate the date in the LOAD-OF-PROGRAM event block:
REPORT z_test.
DATA: gv_yesterday TYPE d.
PARAMETERS:
pa_date TYPE d DEFAULT gv_yesterday.
LOAD-OF-PROGRAM.
gv_yesterday = sy-datum - 1.
Best regards
David
‎2009 Jun 23 10:29 PM
Thanks very much. I was searching all yesterday, and really didn't want to ask on here but was left with no choice!
Problem solved.
‎2009 Jun 24 5:06 PM
David - try:
PARAMETERS:
pa_date TYPE d.
INITIALIZATION.
pa_date = sy-datum - 1.Rob