HOLIDAY_GET - Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
 
Holiday_Get function is basically used to find the holidays occurring in a prescribed period of time. For this it exports the four parameters holiday calendar, factory calendar, date from and date to. 
 
1) HOLIDAY_CALENDAR
 
The name of the holiday calendar used should be passed in this parameter. The public holidays or any other holidays mentioned in the given calendar will be considered as a holiday.
 
2) FACTORY_CALENDAR
 
The name of the factory calendar is used in this parameter. This type of calendar by default considers Saturdays and Sundays as holidays. Apart from this we include a holiday calendar inside the factory calendar.  So all the holidays mentioned in the include holiday calendar will also occur in the  factory calendar.
 
3) DATE_FROM
 
The starting date from where the holidays have to be calculated should be given in this parameter.
 
4) DATE_TO
 
The ending date to where the holidays have to be calculated should be given in this parameter.
 
All the holidays mentioned in the given calendars will be returned to a table. This table will have the list of all holidays in the given time along with the dates on which they occur.
 
This function can be used in calculation of leave duration.
 
DATA  ITAB_ISCAL_DAY TYPE STANDARD TABLE OF ISCAL_DAY INITIAL SIZE 0.
DATA  rec TYPE I.
 
CALL FUNCTION 'HOLIDAY_GET'
 
EXPORTING
 
  HOLIDAY_CALENDAR                 =  holiday_calendar_name 
  FACTORY_CALENDAR                 = factory_calendar_name
 
  DATE_FROM                        = START_DATE
  DATE_TO                          = END_DATE
 
* IMPORTING
*   YEAR_OF_VALID_FROM               =
* YEAR_OF_VALID_TO                 =
*   RETURNCODE                       = 
 
TABLES
    HOLIDAYS                         = ITAB_ISCAL_DAY           " The list of holidays will be stored here
 
EXCEPTIONS 
  FACTORY_CALENDAR_NOT_FOUND       = 1  
  HOLIDAY_CALENDAR_NOT_FOUND       = 2  
  DATE_HAS_INVALID_FORMAT          = 3  
  DATE_INCONSISTENCY               = 4 
  OTHERS                           = 5     .
 
IF SY-SUBRC <> 0.
 
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO  
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
 
ENDIF.    
 
DESCRIBE TABLE  ITAB_ISCAL_DAY LINES rec.  "This command will give the number of rows in the table  which is also the number of holidays" occurring in the given time in the mentioned calendars.
 
 
Notes:
 
Function Module for List of holidays for given calendar year
 
HOLIDAY_CHECK_AND_GET_INFO
 
Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.


Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com