01-10-2007 6:16 AM
Hi ,
I have a date field in my selection screen
<b>paramater : pr_date type bsid-bldat default sy-datum .</b>
my pr_date in debug mode is of format yyyymmdd.
I have to validate the pr_date field such that the value entered is not of format yyyymmdd .
01-10-2007 6:18 AM
hi,
DATA: v_date TYPE sydatum.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = v_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'INvalid date'.
ELSE.
WRITE: / 'Correct date'.
ENDIF.
Regards
Anver
01-10-2007 6:30 AM
paramater : pr_date type bsid-bldat default sy-datum .
write:pr_date.
it will work fine.
also u can use FM
'RP_CALC_DATE_IN_INTERVAL'
01-10-2007 6:35 AM
Hi,
This not working it simply changing
yyyymmdd to yy.yy.mmdd
Is there any other way ?
01-10-2007 6:38 AM
Hi,
I tried but this is not working .
It is changing yyyymmdd to yy.yy.mmdd
Can you suggest any other method .
01-10-2007 6:22 AM
Which format do you want to validate as?
It doesnt matter which format you take as sy-datum attributes has:
Internal lenght is 8 (yyyymmdd) and
external length is 10(dd.mm.yyyy).
It dosent matter if you enter date as 10.01.2007 or 10012007, internally the conversion takes place.
01-10-2007 6:26 AM
the date type is automatically converted into yyyymmdd.
dont bother about that and in selection screen you dont have to enter like that
just you have to enter normal date like 10.01.2007.
so what is your difficulty in that?
regards
shiba dutta
01-10-2007 6:30 AM
Hi ,
Yes the date fromat is automatically converted but the requirement is that the user should not enter this date format 'yyyymmdd'.
01-10-2007 6:33 AM
use Fm -
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = itab-bdate
IMPORTING
DATE_INTERNAL = itab1-bdate.
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2 .
01-10-2007 6:35 AM
Anyway system dosent process the date field as YYYYMMDD when u refferred it to sy-datum
give the input as 20070109 and it prompts error as invalid date ..
so no probs.
please pass ur code so that we can look into that ..
regards,
vijay.
01-10-2007 6:42 AM
sorry i cannot get your point if you are reffering the bldat field then it will automatically check the format in selection screen it will only accepts the correct format.
regards
shiba dutta