‎2007 Nov 15 3:51 PM
i am having date field in my input screen in the
format yyyymm.i want to validate this field.if i enter some other text it should show error message.ie i should accept like 200710,200705etc.how can i validate this field.plz help me.
‎2007 Nov 15 3:55 PM
Hi,
Delcare field as sy-datum or any date field.
parameter : date like sy-datum(6).
Validation system will take care of it.
Thanks,
Sriram Ponna.
Message was edited by:
Sriram Ponna
‎2007 Nov 15 4:01 PM
Hi,
parameters:
p_date type sy-datum.
this statement will automatically validate the field,
it will validate according to the system settings.
‎2007 Nov 15 4:11 PM
I had tried to search for something stadnard for this purpose.. but I failed.
So, I developed some small logic. May be this will help you..!
REPORT ZTEST_NP.
DATA: L_MON(2) TYPE N,
L_YEAR(4) TYPE N.
PARAMETERS: P_MONTH(6) TYPE N.
AT SELECTION-SCREEN ON P_MONTH.
CALL FUNCTION 'CONVERSION_EXIT_GJAHR_INPUT'
EXPORTING
INPUT = P_MONTH+2(2)
IMPORTING
OUTPUT = L_YEAR
EXCEPTIONS
WRONG_INPUT = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE E398(00) WITH 'year is not valid'.
ELSE.
P_MONTH+0(4) = L_YEAR.
ENDIF.
L_MON = P_MONTH+4(2).
IF L_MON > 13 OR L_MON < 1.
MESSAGE E398(00) WITH 'Month is not valid'.
ENDIF.Regards,
Naimesh Patel
‎2007 Nov 15 4:13 PM
Hi veera,
DATE_CHECK_PLAUSIBILITY function module checks wrong input in date field...
anyway if you define field LIKE sy-datum then automatically validates..
Thanks
Message was edited by:
Perez C