Skip to Content
avatar image
Former Member

How to check the Input date that is correct or not

Hai,

How to check the date is correct or not.

for ex my input(format yyymmdd) is 200060428, i want to check the input date.

if it is 20060231, means no such date is available in Feburary month. how to check this and any standard function module is available?

please, suggest me.

thanks,

elamaran

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 30, 2006 at 01:56 AM

    sorry ,Rao

    But like a data type SY-DATUM won't be helpful to check the DATE validation.

    If you set XXXX0231 to a SY-DATUM in programming, no alert will occur.

    Some Function can help us to achieve the requirement, E.G. DATE_CHECK_PLAUSIBILITY.

    thanks

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      True i agree with you. I thought when i read "Input Date" in Elam's message i thought it is for the selection screen field.

      Agree with you if its within the code then we need additional code to check the same.

      Cheers

      VJ

  • Apr 30, 2006 at 02:05 AM

    Hi Elam,

    You can also use this FM to validate input date format.

    <b>CONVERT_DATE_FORMAT

    ISU_DATE_FORMAT_CHECK</b>

    Hope this will help.

    Regards,

    Ferry Lianto

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 29, 2006 at 07:09 PM

    Hi,

    Try DATE_CHECK_PLAUSIBILITY FUNCTION.

    PARAMETERS : P_DATE LIKE SY-DATUM.

    START-OF-SELECTION.

    end-of-selection.

    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

    EXPORTING

    DATE = P_DATE

    EXCEPTIONS

    PLAUSIBILITY_CHECK_FAILED = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    WRITE :/ P_DATE, ' is Invalid Date'.

    ELSE.

    WRITE :/ P_DATE, ' is a valid day'.

    ENDIF.

    If you want the OO way of doing the same, you can use this.

    CALL METHOD CL_RECA_DATE=>CHECK_DATE

    EXPORTING

    ID_DATE =

    • EXCEPTIONS

    • DATE_INVALID = 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.

    ENDIF.

    Internally, it calls the above function module.

    Regards,

    Ravi

    Note : Please close the thread, if the question is answered

    Message was edited by: Ravikumar Allampallam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 30, 2006 at 01:46 AM

    Hi Elam,

    I think if you define the date field as SY-DATUM the system will automatically do the checkings and you dont need to write additional code unless you would want to do additional checks on that date.

    For the example you have provided that to check for 31st of FEB. I dont think you need to do any additional coding. Define the variable as SY-DATUM and i believe it should work.

    Let me know if it does not work.

    Cheers

    VJ

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2007 at 06:25 AM

    Hi evry body,

    I am new to xi and would like to know if i can check the incoming message.

    For eg i have a field 'type' and i cannot accept any data in it only 'H' is a valid data.

    How do i implement this in sap xi.I also need to display an error or raise an exception when the input on this field is other then 'H'

    Please mail me the details or links where i can find information at aditya.komatil@hotmail.com

    Aditya

    Add comment
    10|10000 characters needed characters exceeded