Skip to Content

Compare Dates

Hi,

would like to check that a "from"-date is lower than a "to"-date.

***

DATA: l_date_from TYPE d,

l_date_to TYPE d.

IF l_date_from GE l_date_to.

// return error message

ENDIF.

***

Above you find the code that I have used so far, but it is not working correctly with some country specific date types. Is there anybody who have some suggestions how I can solve the problem?

Thank you in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 13, 2004 at 09:31 AM

    What about typing them as

    dats

    datum

    or sy-datum?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2004 at 10:53 AM

    You might need to convert them the Universial Times before comparison.

    convert date syst_date time syst_time

    into time stamp tstmp time zone ' '.

    Kind Regards

    Klaus

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2004 at 12:11 PM

    Hi Elvez

    Your code should work since SAP stores all date data as 'yyyymmdd' and this is convenient for comparisons. However, there might be problems transfering date inputs from screen to these date variables.

    Did you check out the contents of those fields by debugging?

    *--Serdar

    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.