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

Start date and End date

Former Member
0 Likes
5,442

Hi Folks,

In my program user will choose the start date and end date for the particular process.

Now i want to check the start date and end date. The start date should be less than the End date.

For example the END date is 01/12/2007 means the start date should not be 02/12/2007...

How can validate this.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,444

Hi,

In the output screen if there are 2 parameters for the start date and end date. Then if the user gives start date : 01/12/2008

and end date:12/12/2007. In this case, perform a check in the program.

for eg.,

data: sdate like sy-datum,

edate like sy-datum.

if sdate >= edate.

display error mesage saying "Wrong date entered".

endif.

This condition should be given initially in the program.

Reward points if helpful.

Thanks,

Archana

Hi Folks,

In my program user will choose the start date and end date for the particular process.

Now i want to check the start date and end date. The start date should be less than the End date.

For example the END date is 01/12/2007 means the start date should not be 02/12/2007...

How can validate this.

Thanks in advance.

9 REPLIES 9
Read only

Former Member
0 Likes
3,444

Hi,

data: lv_sd type sy-datum,

lv_ed type sy-datum.

if lv_sd > lv_ed.

message e001(zmsg).

endif.

Regards,

Bhanu

Read only

0 Likes
3,444

Hi,

Thanks for the replies.

I have the another silly problem also.

Whats the for mat of Sy-datum.

I defined,

DATA : ST_DATE LIKE SY-DATUM.

ST_DATE = '14/05/2008'.

WRITE : ST_DATE.

I give it in date/month/year format.

But it shows the wrong date.

How can I give the input for this.

Thanks.

Read only

0 Likes
3,444

Hi Jasmine,

Sy-datum format is yyyymmdd.

so you have to follow this format while giving dates internally.

Reward if it helps,

Regards,

TAlwinder

Read only

Former Member
0 Likes
3,444

Hi Jasmine,

in the event at selection-screen do the validation like;

at selection-screen.

if start_data gt end_date.

message 'invalid data' type 'S'.

endif.

Reward if it helps,

Regards,

Talwinder

Read only

Former Member
0 Likes
3,444

Hi,

By adding AT SELECTION-SCREEN. event in your program

Regards

Read only

Former Member
0 Likes
3,445

Hi,

In the output screen if there are 2 parameters for the start date and end date. Then if the user gives start date : 01/12/2008

and end date:12/12/2007. In this case, perform a check in the program.

for eg.,

data: sdate like sy-datum,

edate like sy-datum.

if sdate >= edate.

display error mesage saying "Wrong date entered".

endif.

This condition should be given initially in the program.

Reward points if helpful.

Thanks,

Archana

Read only

Former Member
0 Likes
3,444

AT Selection-screen on To_date.

You can check for

if from_date >= to_date.

message e111(test).

endif.

Read only

Former Member
0 Likes
3,444

Hi,

Goto Transaction code SU3.

and check the DATE FORMAT in Defaults tab.

if you dont have authorization to this tcode,

Use the below function module to know the date format.

SLS_MISC_GET_USER_DATE_FORMAT.

Read only

Former Member
0 Likes
3,444

Thanks for the help