Iconet Services Ltd - SAP ABAP / SAPScript Consultant

Home Page
Company Profile
Search Internet for SAP Information
Subscribe to SAP R3 Mailing list
Sample ABAP Programs
ABAP How to
General Purpose layout set

Calculate difference between 2 dates in working days

form CALC_DIFF using p_startdate


changing p_days.

data: day_attributes type table of casdayattr.

* end date must be > start date

check p_enddate > p_startdate.

* check for working days beween 2 dates

call function 'DAY_ATTRIBUTES_GET'


factory_calendar = 'GB'

holiday_calendar = 'GB'

date_from = p_startdate

date_to = p_enddate

language = sy-langu


day_attributes = day_attributes.

if sy-subrc eq 0.

* remove holidays and weekends

delete day_attributes where freeday eq 'X'.

describe table day_attributes.

if sy-tfill ne 0.

p_days = sy-tfill.



* subtract 1

p_days = p_days - 1.

endform. " CALC_DIFF

Back to How To list