09-08-2014 8:49 AM
Hello everyone
I would like to find if that day is a holiday or working, I tried with the FM HOLIDAY_CHECK_AND_GET_INFO with this code:
but I do not find anything, I was expecting to Sunday the flag X (and other days..)
please help me
thanks in advance
---------------
CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
EXPORTING
DATE = ZBLD_RDT_CON_RDA-DATUM
HOLIDAY_CALENDAR_ID = FABKL
WITH_HOLIDAY_ATTRIBUTES = ' '
IMPORTING
HOLIDAY_FOUND = HOLID
* TABLES
* HOLIDAY_ATTRIBUTES =
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
HOLIDAY_CALENDAR_ID_MISSING = 5
HOLIDAY_CALENDAR_NOT_FOUND = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
09-08-2014 9:47 AM
Hi
It depends on how the calendar you need to check is defined:
If you use IT as calendar and insert 25.12.2014 the function module returns it's holiday as this day is set as holiday in IT calendar,
but if you insert 07.09.2014 (Sunday) the fm retunrs blank because this day is not set as holiday, it's only not working day.
So if you need to know if a day is holiday you can use fm HOLIDAY_CHECK_AND_GET_INFO, if you need to know if it's working day you can use fm like DATE_CONVERT_TO_FACTORYDATE or DATE_CHECK_WORKINGDAY
Max
09-08-2014 9:47 AM
Hi
It depends on how the calendar you need to check is defined:
If you use IT as calendar and insert 25.12.2014 the function module returns it's holiday as this day is set as holiday in IT calendar,
but if you insert 07.09.2014 (Sunday) the fm retunrs blank because this day is not set as holiday, it's only not working day.
So if you need to know if a day is holiday you can use fm HOLIDAY_CHECK_AND_GET_INFO, if you need to know if it's working day you can use fm like DATE_CONVERT_TO_FACTORYDATE or DATE_CHECK_WORKINGDAY
Max
09-08-2014 10:23 AM
thanks for your help
I tried to use the FM you suggested with the code below
I think everything is correct, when there is a working day, the FM brings me back "+" otherwise blank
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
* CORRECT_OPTION = '+'
DATE = ZBLD_RDT_CON_RDA-DATUM
FACTORY_CALENDAR_ID = FABKL
IMPORTING
* DATE =
* FACTORYDATE =
WORKINGDAY_INDICATOR = HOLID
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
09-08-2014 10:57 AM
Hi
That fm returns thr first working day before or after the date in input, so if you use + it'll return the first working day after the inpu date:
- If the input date is holiday, the output date will be different from the input one and the WORKINGDAY_INDICATOR will be set to + (in according to the input value of correct_option )
- If the input date is a working day, the output date will be the same of the input one, so the WORKINGDAY_INDICATOR will be set to space
You check only WORKINGDAY_INDICATOR, so it can be ok to say if it's + is holiday and if it's blank is working day
Max