2008 Nov 25 2:39 AM
HI Experts,
please help me how to validate the date field.
<<Text removed by moderator>>
Regards,
Sunita
Edited by: Matt on Nov 25, 2008 8:31 AM
2008 Nov 25 2:53 AM
HI,
Try this.
tables : bkpf.
Select-options : v_budat for bkpf-budat.(this is u r selection-screen field.)
select single * from bkpf where budat in v_budat.
2008 Nov 25 2:53 AM
2008 Nov 25 3:11 AM
Hi,
Use select stmt
AT SELECTION-SCREEN ON s_date.
SELECT SINGLE *
FROM table_name
WHERE data_field IN s_date.
IF sy-subrc <> 0.
message 'Error Message.' type 'E'.
endif.
Thanks,
Krishna...
2008 Nov 25 3:15 AM
Hi
i tried this but its not working
any more inputs.
regards
sunita
2008 Nov 25 4:52 AM
HI,
Try this.
tables : bkpf.
Select-options : v_budat for bkpf-budat.(this is u r selection-screen field.)
select single * from bkpf where budat in v_budat.
2008 Nov 25 6:56 AM
hi,
tried this.it definitely works.
REPORT ZEX_DATEVALIDATE .
Parameters p_date like sy-datum.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = p_date
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Write:/ sy-subrc.
If the value of Sy-subrc is 0 that means the date field has a valid value.
If the input is 01/01/2008 then the output of the above program is as follows.
Validate the date
0
If the input is 31/31/2008 then the output is as follows.
Validate the date
1
thanks,
shanthi.k
2008 Nov 25 3:14 AM
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = l_select_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
date invalid
ENDIF.
Regards
Neha
2008 Nov 25 4:54 AM
HI,
For date field validation you need not to do much
Just declare date field as type sy-datum and every validation will be managed internaly.
Syntax:
data:
v_date type sy-datum.OR
parameters:
v_date type sy-datum.
Regards,
Anirban
2008 Nov 25 6:58 AM
Hi,
Wat exactly you want to validate for date filed?
If you input any wrong data(including format) in the date field, system will throw an error.
Thanks,
Sriram Ponna.
2008 Nov 25 7:08 AM
Hi,
As also said by others use the FM DATE_CHECK_PLAUSIBILITY:
If you are using a sekection screen than write it under the event at selection-screen on w_date, where w_date is your date field.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = p_date
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.if sy-subrc is 0 then the date field is valid otherwise show a message to enter date in correct format.
With luck,
Pritam.
2008 Nov 25 7:12 AM
HI sunitha,
Sriram has said rightly,
if you enter a wrong format system throws an error.
let us know what validation you are looking for.
regards
Ramchander Rao.K
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |