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

dates validation

hi all,

i am accepting a file from presentation server and updating the same in DB. if i give special characters also it is accepting. can anybody tell me how to validate the dates.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 05:01 AM

    Hi Ateeq,

    U can use the FM, 'DATE_CHECK_PLAUSIBILITY' to check whether a date is valid or not.

    Regards,

    Phani

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 05:00 AM

    hi,

    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

    EXPORTING

    DATE_EXTERNAL = file_date

    IMPORTING

    DATE_INTERNAL = l_date

    EXCEPTIONS

    DATE_EXTERNAL_IS_INVALID = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    date is invalid

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 05:05 AM

    u can use FM DATE_CHECK_PLAUSIBILITY

    rgds,

    PJ

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi,

      l_date type d

      CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

      EXPORTING

      date_external = '10023/39'

      IMPORTING

      DATE_INTERNAL = l_date

      EXCEPTIONS

      DATE_EXTERNAL_IS_INVALID = 1

      OTHERS = 2

      i don't thing so it give error

      after this fm using sy-subrc you check whether the date is value or not

      If sy-subrc <> 0

      move to error table

      endif

      cheers,

      sasi

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 05:36 AM

    You can call the FM 'CONVERT_DATE_TO_INTERNAL' as described by sasi earlier, and if the FM returns an error, you can send that record to the corresponding error table that you maintain.

    This is what you would have to do:

    if sy-subrc <> 0.

    <move record to error itab>

    endif.

    Hope this helps.

    Sudha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 05:49 AM

    Hi Ateeq,

    Try this...

    data: lv_date type sy-datum,
          lv_msg(50) type c.
    lv_date = '20051314'.
    
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        DATE                            = lv_date
     EXCEPTIONS
       PLAUSIBILITY_CHECK_FAILED       = 1
       OTHERS                          = 2
              .
    IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 into lv_msg.
     write: lv_msg.
    ENDIF.

    The above said FM is used to check whether the date is valid or not.

    As sasikumar said you can also use the FM, 'CONVERT_DATE_TO_INTERNAL' to check the validity of date.

    hope this might help you.

    Regards,

    Phani

    Message was edited by: Phani Kumar Sivapuram

    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.