‎2005 Sep 20 4:37 AM
Hai.
In my report i have date fields as inputfields, i am using 8 char type to print date.
data: t_date(8) type c.
user have to enter date in this format MM/DD/YY. But its a character field user can enter any type. I am validating this field using READ LINE option but to validate one date field. I am giving more than 20 conditions.
Is there any possibility validating input field in screen it self or what is the best way to display date field as input field and date format should be in above format. And I will have more than 100 date input fields depends on user selection in selection screen..
Could somebody tell best way to do this..
Thanks
Sunil
‎2005 Sep 20 4:46 AM
Declare your date fields in the selection screen as SY-DATUM. This way the users can enter the date in the format they want(controlled by their user profile). Internally in your program, you will have the date in internal format YYYYMMDD which will help you do all kinds of date validations and selections. Then when you output the date, you can use the options for WRITE statement like EDIT MASK. Check the WRITE help.
Srinivas
‎2005 Sep 20 4:53 AM
Hi,
for the input fields you define type as D, then the date will display as standard format.
at the time of processing the date you change the format into mm/dd/yy. by using offset and concatenate method
data: p_date type d,
p_disp(8) type c,
then p_date will be 20051231
concatenate p_date2(2) '/' p_date4(2) '/' p_date+6(2)
into p_disp.
the validatation of the date is not possible by doing manually.
cheers,
sasi
‎2005 Sep 21 4:46 AM
Hi,
Declare the date field in selection screen ad sy-datum it will automatically validate the dates that user enters no need to do any validation.
If u want to do so u can validate in
AT SELECTION SCREEN ON s_date.
perform validate_date.Hope this helps.
Kindly reward points and close the thread.
‎2005 Sep 21 5:33 AM
there is a function module to check if a given date is valid....its DATE_CHECK_PLAUSIBILITY...
see if it helps you....of course declaring as sy-datum will still be a better option...
rgds,
PJ
‎2005 Sep 21 6:14 AM
Hi Sunil,
If your requirement is to enter date in the format MM/DD/YY, then which century will you consider for YY?
After confirming the century, format the date into 'DD.MM.YYYY' format and then pass it to the FM, 'DATE_CHECK_PLAUSIBILITY', which will check whether the given date is valid or not?
You can write this in a subroutine and you can call the same for all the date fields...
Regards,
Phani
‎2005 Sep 22 9:13 AM
Hi,
Try This -
data: v_date(8) type c.
write sy-datum to v_date.
concatenate v_date0(2) '/' v_date2(2) '/' v_date+6(2) into v_date.
write:/ v_date.