Application Development 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: 

date function

Former Member
0 Kudos

is there any function module which could comput difference between two dates specific to a factory calender.

3 REPLIES 3

Former Member
0 Kudos

Function: DAYS_BETWEEN_TWO_DATES

Former Member
0 Kudos

Hi,

U can use

RP_CALC_DATE_IN_INTERVAL

SD_DATETIME_DIFFERENCE

Thanks

Former Member
0 Kudos

We use a combination of FMs

DATE_CONVERT_TO_FACTORYDATE

and

RKE_SELECT_FACTDAYS_FOR_PERIOD

Something like this is the final computation


* get range of working calendar dates
CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
  EXPORTING
    I_DATAB                     = request_date
    I_DATBI                     = action_date
    I_FACTID                    = 'US'
  TABLES
    ETH_DATS                    = wdates
 EXCEPTIONS
   DATE_CONVERSION_ERROR       = 1
   OTHERS                      = 2.


 IF SY-SUBRC <> 0.
   raise dates_error.
 ENDIF.


 LOOP at wdates.
  if wdates-periodat gt request_date.
   add 1 to days.
  endif.
 ENDLOOP.

 days_to_complete = days.