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

check date

Former Member
0 Likes
743

hi friends,

i am working on loom weekly report, i have a select option for date.

now since it is weekly report i have to check whether the dates entered are proper,i mean if the difference between them is 7 days then its fine,else i have to give an error.

my problem is during month end,is there any function module which will return me the number of days between the dates entered.

pls ask for clarification if u have not understood my problem

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
703

Subract first date from second, you will get the delta in days.

SO_DATE-HIGH - SO_DATE-LOW = nbr_of_days.

send an error if not 6

Regards

6 REPLIES 6
Read only

Former Member
0 Likes
703

I think no need to go for FM

just check first date and add7 in that SAP will do automatically and give date after 7 th day and check that date if not for second date by user then give error message

FUNCTION MODULES

http://www.erpgenie.com/abap/functions.htm

http://www.sapdevelopment.co.uk/fmodules/fmssap.htm

http://www.erpgenie.com/abap/index.htm

http://www.geocities.com/victorav15/sapr3/abapfun.html

Rewards if useful............

Minal Nampalliwar

Read only

RaymondGiuseppi
Active Contributor
0 Likes
704

Subract first date from second, you will get the delta in days.

SO_DATE-HIGH - SO_DATE-LOW = nbr_of_days.

send an error if not 6

Regards

Read only

Former Member
0 Likes
703

use SD_DATETIME_DIFFERENCE to get the date diff...

the input to this FM are as follows...

DATE1 10.02.2007

TIME1 00:00:01

DATE2 01.03.2007

TIME2 23:59:59

output for this is

DATEDIFF 19

TIMEDIFF 24

EARLIEST 1

Read only

Former Member
0 Likes
703

DATA : CHECK_DAYS type I.

AT SELECTION SCREEN OUTPUT.

Clear CHECK_DAYS.

CHECK_DAYS = P_DATE2 -P_DATE1.

IF CHECK_DAYS NE ' 7'.

Error.

ENDIF.

Read only

Former Member
0 Likes
703

hi amit,

check out the number of days by:

no_of_days = s_date1 - s_date2.

if no_of_days <> 7.

write : ERROR.

endif.

regards,

sohi

Read only

former_member386202
Active Contributor
0 Likes
703

Hi ,

Use Function module " HR_HK_DIFF_BT_2_DATES " and give output format

is ' 02 ' as a import parameters.

Regards,

Prashant