Application Development and Automation 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: 
Read only

date

Former Member
0 Likes
927

Hi all,

How can I restrict my output so that my end date is always greater than my start date.

E.g. 01/01/06 to 01/01/07 -


> should work

01/01/06 to 01/01/01 -


> shouldn't work

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
894

Hi,

I hope by default itself it will check for the low value should not be greater than high value. if it is not then try this.

select-options: s_date for <fieldname>.

At selection-screen on s_date.

If s_date-high < s_date-low then

message i000(00) with 'End date cannot be less than Start date'.

endif.

Hope this will help u.

Regards,

U. Uma

6 REPLIES 6
Read only

Former Member
0 Likes
894

Hi,

Check if ENDDA > BEGDA....

You can check the dates directly.

Regards

Subramanian

Read only

Former Member
0 Likes
894

Use this code:

IF enddate GE begindate.

  • Continue

ELSE.

  • Error

ENDIF.

Read only

Former Member
0 Likes
894

Hi,

Check this..

If the variable is date type..Then you can directly compare..

Example

DATA: V_DATE_FROM TYPE SYDATUM.

DATA: V_DATE_TO TYPE SYDATUM.

V_DATE_FROM = SY-DATUM.

V_DATE_TO = SY-DATUM + 1.

IF V_DATE_FROM > V_DATE_TO.

WRITE: / 'V_DATE_FROM IS GREATER'.

ELSE.

WRITE: / 'V_DATE_TO IS GREATER'.

ENDIF.

Thanks,

Naren

Read only

Former Member
0 Likes
894

Hi,

system wont accept the low value in higher range

It will give an error message like this

Lower limit is greater than upper limit

Regards

Shiva

Read only

Former Member
0 Likes
894

Hi,

If you are getting values through select options and need to use then you need no thave to do anything the select options takes care.

if this is not the case and if you want to code or check it then put a if condition there if begda LE endda.

.................

else.

exit.

endif.

Thanks,

Prashanth

Read only

Former Member
0 Likes
895

Hi,

I hope by default itself it will check for the low value should not be greater than high value. if it is not then try this.

select-options: s_date for <fieldname>.

At selection-screen on s_date.

If s_date-high < s_date-low then

message i000(00) with 'End date cannot be less than Start date'.

endif.

Hope this will help u.

Regards,

U. Uma