04-19-2007 2:38 PM
On the selection-screen I want it to default to today's date - 90 days. So I have the fllowing code that works:
SELECTION-SCREEN BEGIN OF BLOCK process WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETER: s_datum LIKE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK process.
AT SELECTION-SCREEN OUTPUT.
s_datum = sy-datum - 90.
The problem is I also want the user to be able to enter a date. But it keeps getting wiped out by my AT SELECTION-SCREEN OUTPUT event.
How do I work around this so it either defaults to sy-datum - 90 days, or the user can enter his own date?
Thank-You.
04-19-2007 3:32 PM
For example, test this short program.
REPORT zrich_0001.
PARAMETERS: p_datum TYPE sy-datum.
INITIALIZATION.
p_datum = sy-datum - 90.
START-OF-SELECTION.
WRITE:/ p_datum.
It defaults the date 90 days ago, you can then change it to whatever, and execute the report. It will then write whatever date you had entered in the parameter.
Regards
RIch HEilman
04-19-2007 2:41 PM
Hi,
data:date type sy-datum.
date = sy-datum - 90.
use PARAMETER: s_datum LIKE sy-datum OBLIGATORY default date.
rgds,
bharat.
04-19-2007 2:41 PM
Hi,
Write like this and see
s_datum = sy-datum - 90.
SELECTION-SCREEN BEGIN OF BLOCK process WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETER: s_datum LIKE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK process.
Initialization:
s_datum = sy-datum - 90.
reward if useful
regards,
Anji
04-19-2007 2:41 PM
Hi
SELECTION-SCREEN BEGIN OF BLOCK process WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETER: s_datum LIKE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK process.
<b>INITIALIZATION.</b>
s_datum = sy-datum - 90.
instead of At selection screen output put ur code in initilization part.
Regards
Haritha.
04-19-2007 2:42 PM
04-19-2007 2:47 PM
hi,
change your code as below
SELECTION-SCREEN BEGIN OF BLOCK process WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETER: s_datum LIKE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK process.
AT SELECTION-SCREEN OUTPUT.
<b> LOOP AT SCREEN.
if s_datum is initial.
s_datum = sy-datum - 90.
endif.
MODIFY SCREEN.
ENDLOOP.</b>
hope it solves your problem
regards,
Navneeth.K
04-19-2007 2:54 PM
04-19-2007 2:59 PM
Hello Navneeth.
It did partially in that this will work.
My only contention is that when the user sees the selection screen, the sy-datum - 90 is not displayed it ionly gerts displayed i the background when the field is empty. I am thinking it is probably just as easy to create a transaction that uses a variant with sy-datum - 90, and they can replace the date if they want to.
04-19-2007 3:06 PM
Hi Tom,
currently wat happens is when the selection screen comes the value for s_datum is given by default and when the user changes it then the s_datum is assigned that value. now, what is your proper reqmnt can u give me some example how you want it.
regards,
Navneeth.K
04-19-2007 3:13 PM
I am going with a custom transaction for the user to execute with the date logic in the variant, then the date (date - 90 days) displayed on the screen at execution, and the date can be over written and stay that way by the user if they want.
Thank-You Everybody!
04-19-2007 3:17 PM
Tom, I am ready confused as to why you are jumping thru hoops on this one. If you simply want to default the date in the parameter as sy-datum - 90, then simply do so in the INITIALIZATION event of your report program, this is set once, and then the user could change it to whatever, but could simply execpt the default date. Is this not the requirement?
Regards,
Rich Heilman
04-19-2007 3:23 PM
Rich,
Your code does populate the date as sy-datum - 90 days on the selection screen. However, when I execute the job, and put my own date in the selection screen, it gets wiped out and goes back to sy-datum - 90 days during initialization.
Thank-You.
04-19-2007 3:26 PM
did you append the select option
INITIALIZATION.
s_datum = sy-datum - 90.
append s_datum. "<----here
04-19-2007 3:27 PM
04-19-2007 3:31 PM
04-19-2007 3:43 PM
Rich,
It worked....elementary mistake...."start-of-selection" was missing.
Thank-You!
04-19-2007 3:52 PM
04-19-2007 3:02 PM
You should only need to do it in the INITIALIZATION event.
REPORT zrich_0001.
SELECTION-SCREEN BEGIN OF BLOCK process WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETER: s_datum LIKE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK process.
INITIALIZATION. "<-- HERE
s_datum = sy-datum - 90.
Regards,
RIch Heilman
04-19-2007 3:32 PM
For example, test this short program.
REPORT zrich_0001.
PARAMETERS: p_datum TYPE sy-datum.
INITIALIZATION.
p_datum = sy-datum - 90.
START-OF-SELECTION.
WRITE:/ p_datum.
It defaults the date 90 days ago, you can then change it to whatever, and execute the report. It will then write whatever date you had entered in the parameter.
Regards
RIch HEilman