Skip to Content
author's profile photo Former Member
Former Member

date fromat

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 .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 10, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.