09-23-2009 6:33 AM
HI All,
I have to validate date that needs to be validated before passing it to DB.
Is der any FM for same
I tried CONVERT_DATE_TO_INTERNAL.
But it accepts date only in one specified format.
09-23-2009 6:36 AM
09-23-2009 7:06 AM
09-23-2009 7:34 AM
Use
REPLACE all OCCURRENCES OF '/' in lw_endda with '.'.
REPLACE all OCCURRENCES OF '/' in lw_begda with '.'.
09-23-2009 7:55 AM
Hi,
Try below mentioned logic because SAP is accepting YYYYMMDD format only,
data: a(10) type c value '23/09/2009'.
data: d(2) type n,
m(2) type n,
y(4) type n.
data: date(8).
split a at '/' into d m y.
concatenate y m d into date.
write:/ date.
-Rajneesh Gupta
09-23-2009 10:26 AM
Hi,
This is very simple...try using the below mention steps
1.Declare 3 var of type c with lenght d(2),m(2)and yr(4)
2.split your date at '/ into the above variables
3.concatenate the variables and pass the concatenated values to the FM
This will definetly helps you and solve your problem.
Pooja
09-23-2009 6:37 AM
hi,
try this
Use Function module DATE_CHECK_PLAUSIBILITY to validate a date.
1)If you given a invalidate date then it will ask you to enter a valid date.
2)After changing it to correct value, you can click on SAVE button or if you want to continue with the invalid date then click on USE INVALID VALUE button.
Try with this code.
PARAMETER P_DATE TYPE SYDATUM.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = P_DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE E000(ZI) WITH 'INPUT DATE IS INVALID DATE'.
ENDIF.
Regards,
RItesh J