‎2009 Oct 28 4:34 PM
Hello ABAP Gurus,
I am trying to write a simple program that takes 'FROM' and 'TO' dates which will be used to generate a report..
However the requirement is that the 'FROM' date should have a default value that is read from a file and the 'TO' date should have a default value of today's date. The Client wants to option of changing these dates if needed.
However, when I wrote the following program, it first doesn't read the text file for the 'FROM' date and therefore it is by default filling only 'TO' date and leaving the 'FROM' field blank. Can some one please let me konw what I am not doing correctly.
The simple code that i have written is
=======================================================================================
REPORT Z_PROGRAM1.
DATA: DAYSTMP(40),
FROMDATE LIKE SY-DATUM.
DAYSTMP = 'C:\EXTRACTEDDATA\ExtractedDate.txt'.
OPEN DATASET DAYSTMP FOR INPUT IN TEXT MODE ENCODING DEFAULT.
READ DATASET DAYSTMP INTO FROMDATE.
CLOSE DATASET DAYSTMP.
SELECTION-SCREEN: BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_DATE FOR SY-DATUM DEFAULT FROMDATE TO SY-DATUM
OPTION BT SIGN I.
SELECTION-SCREEN: END OF BLOCK MAIN.
========================================================================================
Any suggestions/feedback will be greatly appreciated.
Thanks
Ram
Edited by: Prasad Ram on Oct 28, 2009 5:34 PM
‎2009 Oct 28 4:36 PM
You have to put the OPEN DATASET part under event INITIALIZATION, and fill s_date-low and s_date-high there instead of the DEFAULT ... option.
Thomas
‎2009 Oct 28 4:36 PM
You have to put the OPEN DATASET part under event INITIALIZATION, and fill s_date-low and s_date-high there instead of the DEFAULT ... option.
Thomas
‎2009 Oct 28 5:03 PM
Thomas, Thanks a lot for the solution. It did the trick. I don't know what I would have done without SDN :-). I appreciate your help a lot.
Thanks to others for suggestions regarding posting and I will remember to do that in future.
Thanks
Ram
‎2009 Oct 28 4:38 PM
And please dont use ALL CAPS in the subject line.. Please read the forum rules before posting
‎2009 Oct 28 4:59 PM
... and please use the above <<>> code button after selecting the code with the mouse. Then formatting is preserved and readabilty is enabled.
Many people (including me) refuse to read unformatted coding.
Regards,
Clemens