Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

date fromat

Former Member
0 Kudos

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 .

10 REPLIES 10

anversha_s
Active Contributor
0 Kudos

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

0 Kudos

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'

0 Kudos

Hi,

This not working it simply changing

yyyymmdd to yy.yy.mmdd

Is there any other way ?

0 Kudos

Hi,

I tried but this is not working .

It is changing yyyymmdd to yy.yy.mmdd

Can you suggest any other method .

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

Hi ,

Yes the date fromat is automatically converted but the requirement is that the user should not enter this date format 'yyyymmdd'.

0 Kudos

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 .

0 Kudos

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.

Former Member
0 Kudos

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