2008 Mar 27 4:16 AM
HI
I want to valid the Given Data is Vaild and not vaild using function module .
Enter date : 21032007
Output : Vaild Date:
Enter Date : 99999991
Output : invaild date
enter Date : aa93111b
Output : invaild format
2008 Mar 27 4:22 AM
Hi,
You can define date field of type numeric.So that it will not accept characters.I have done like that in my requirement.
Reward points
Regards
Shibin
HI
I want to valid the Given Data is Vaild and not vaild using function module .
Enter date : 21032007
Output : Vaild Date:
Enter Date : 99999991
Output : invaild date
enter Date : aa93111b
Output : invaild format
2008 Mar 27 4:22 AM
Hi,
You can define date field of type numeric.So that it will not accept characters.I have done like that in my requirement.
Reward points
Regards
Shibin
2008 Mar 27 4:22 AM
Hi Jayendra,
You can chk this Function Module,
/OSP/VALIDATE_DATE_TIME
Regards,
Samson Rodrigues.
2008 Mar 27 4:25 AM
Hi,
Use this FM in SE37
DATE_CHECK_PLAUSIBILITYHave a nice day
Reward if useful
~Lakshmiraj~
Edited by: LAKSHMIRAJ on Mar 27, 2008 5:26 AM
2008 Mar 27 4:29 AM
2008 Mar 27 4:28 AM
Hi,
Declare your filed like below .Automatically it will take care all validatins.
SELECT-OPTIONS : s_date FOR sy-datum.
Pls. reward if useful
2008 Mar 27 4:32 AM
2008 Mar 27 4:35 AM
2008 Mar 27 4:39 AM
2008 Mar 27 4:45 AM
its simple yaar
give the date to the import parameter of the function module .
the FM itself check the date and gives the output.
or
the other way is that u need to take the given input and split using the offset and then check them wheather the given values r in valid range or not
reward if helpful
raam
2008 Mar 27 4:54 AM
Still i 'm not getting clearly
please explain step by step..
2008 Mar 27 4:59 AM
DATA: CHECK_YEAR_1 TYPE P.
DATA: CHECK_YEAR_2 TYPE P.
IF DATE CN '0123456789'.
MESSAGE S011 WITH DATE RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
IF DATE+4(2) LT '01'
OR DATE+4(2) GT '12'.
MESSAGE S003 WITH DATE+4(2) RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
IF DATE+6(2) LT '01'
OR DATE+6(2) GT '31'.
MESSAGE S006 WITH DATE+6(2) RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
IF DATE+4(2) EQ '01'
OR DATE+4(2) EQ '03'
OR DATE+4(2) EQ '05'
OR DATE+4(2) EQ '07'
OR DATE+4(2) EQ '08'
OR DATE+4(2) EQ '10'
OR DATE+4(2) EQ '12'.
IF DATE+6(2) GT '31'.
MESSAGE S004 WITH DATE6(2) DATE4(2)
RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
ELSEIF DATE+4(2) EQ '04'
OR DATE+4(2) EQ '06'
OR DATE+4(2) EQ '09'
OR DATE+4(2) EQ '11'.
IF DATE+6(2) GT '30'.
MESSAGE S004 WITH DATE6(2) DATE4(2)
RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
ELSE.
CHECK_YEAR_1 = DATE(4) MOD 4. " alle 4 Jahre ist schaltjahr
IF CHECK_YEAR_1 EQ 0.
CHECK_YEAR_1 = DATE(4) MOD 100. " aber nicht alle 100 Jahre
CHECK_YEAR_2 = DATE(4) MOD 400. " aber alle 400 Jahre
IF CHECK_YEAR_1 EQ 0
AND CHECK_YEAR_2 NE 0.
IF DATE+6(2) GT '28'.
MESSAGE S004 WITH DATE6(2) DATE4(2)
RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
ELSE.
IF DATE+6(2) GT '29'.
MESSAGE S004 WITH DATE6(2) DATE4(2)
RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
ENDIF.
ELSE.
IF DATE+6(2) GT '28'.
MESSAGE S004 WITH DATE6(2) DATE4(2)
RAISING PLAUSIBILITY_CHECK_FAILED.
ENDIF.
ENDIF.
ENDIF.
reward if helpful
raam
2008 Mar 27 5:32 AM
Hi
don't Copied and put here . Pl explain in OWN example .that Should be very simple and useful..
Step by step
1.....Define FM module
Interface (exporting and importing ) .....exception (if any)
declaration( local )
.............
In Report I want to Pass parameter
Enter Date : 23032007 : Output Value : Vaild Date
Enter Date:99992111 Output Value : invaild Date
Enter Date: aaaadddd OutPut Value: invaild Format
2008 Mar 27 4:29 AM
Hi,
Use the type for date as SY-DATUM.
after that Use FM :
DATE_CHECK_PLAUSIBILITY
Reward if useful.
Regards,
Abhishek
2008 Mar 27 4:38 AM
Hi,
You can define a constant k_date with value 99999991.
at selection-screen on p_date
If p_date > k_date.
Error message ........................
Endif.
Hope this will help
Reward points
Regards
Shibin
2008 Mar 27 5:33 AM
2008 Mar 27 5:52 AM
Hi,
As i said early,if you define date field(P_Date) of type numeric,it will not accept characters.If you want to stop the program from further processing when date is invalid,then give error message at selection-screen on p_date event.if you want to display it on the screen,then use write statement in the start-of-selection event.
Reward points if helpful
Regards
Shibin
2008 Mar 27 5:59 AM
Hi ,
You have to declare the type of date as Sy-datum.After that no need to use any FM
2016 May 09 1:47 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |