‎2007 Apr 09 7:32 AM
Hi Experts,
I want to know that
how to verify the date entered by user is as per the current user settings date format ?
Is there any function module?
‎2007 Apr 09 7:38 AM
‎2007 Apr 09 7:38 AM
‎2007 Apr 09 7:43 AM
Hi..,
here is the sample code that i have used in a program..
datfm -- Date format
dcpfm -- Decimal format
select single datfm dcpfm
from usr01
into (wa_datfm, wa_dcpfm )
where bname eq sy-uname.
case wa_datfm.
when 1.
concatenate lw_date6 lw_date3(2) lw_date+0(2) into lw_date.
when 2 or 3.
concatenate lw_date6 lw_date0(2) lw_date+3(2) into lw_date.
when 4 or 5 or 6.
translate lw_date using '. / - '.
condense lw_date no-gaps.
endcase.
reward if it helps u..
sai ramesh
‎2007 Apr 09 7:43 AM
Hi,
chk the Functuon module:
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
regards,
keerthi
‎2007 Apr 09 8:09 AM
Hi Keerthi,
Thanks a lot for reply.
I already acheived this by using one FM "SLS_MISC_CONVERT_TO_DATE".
My program is working fine. But my requirement is that when user enters the date irrespective of it's user setting then the program behaves as per the results I shown in bold below.For such results I have to match the user setting and as it's not proper (as shown in bold) I need to show an error message message.
So if there is any FM or logic that I want to know.
User settings DD.MM.YYYY
l_date before 18.04.2007
l_date after 18.04.2007
l_date before 18042007
l_date after 18.04.2007
<b>l_date before 04/18/2007
l_date after 00.2.418
l_date before 04182007
l_date after 7 .00.4182</b>
-
User settings MM/DD/YYYY
l_date before 04/18/2007
l_date after 04182007
l_date before 04182007
l_date after 04182007
<b>l_date before 18.04.2007
l_date after 4.2018.0
l_date before 18042007
l_date after 20071804</b>
-
Thanks,
Yogesh
‎2007 Apr 09 8:13 AM
first convert all the data into only one format that YYYYMMDD
by using key word WRITE to.
check documentation by pressing F1 on write,
after that u can call FMs.
Regards
Prabhu
‎2007 Apr 09 9:41 AM
Hi Keerthi,
Thanks a lot.FM:- DATE_CHECK_PLAUSIBILITY
is applicable to my requirement.
Thanks,
Yogesh