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

table for calender

Former Member
0 Likes
1,077

Hi Techies,

1>could anybody help me where the calender is stored(table) ?

2>how holiday is found if i had a calender id

calender id is SCAl-FCALID this is structure-field

thanks in advance

5 REPLIES 5
Read only

anversha_s
Active Contributor
0 Likes
676

hi,

chk this sample code.

there is a good FM>

REPORT Z_HOLIDAY.

  • ABAP Program to check for holidays using the factory calendar

  • include zday .

  • substitute tdate = 'yyyymmdd'.

  • tholiday_found = 'X' -> Holiday

TABLES THOCS.

DATA: BEGIN OF INT_THOCS OCCURS 100,

THOCS LIKE THOCS.

DATA: END OF INT_THOCS.

DATA: TDAY(1),

  • TDATE LIKE SY-DATUM,

THOLIDAY_ATTRIBUTES,

THOLIDAY_FOUND(1).

PARAMETERS: P_DATE LIKE SY-DATUM DEFAULT SY-DATUM.

*&------- Selection -


START-OF-SELECTION.

PERFORM HOLIDAY.

FORM HOLIDAY.

CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'

EXPORTING

DATE = P_DATE

HOLIDAY_CALENDAR_ID = 'XX'

  • WITH_HOLIDAY_ATTRIBUTES = ' '

IMPORTING

HOLIDAY_FOUND = THOLIDAY_FOUND

TABLES

HOLIDAY_ATTRIBUTES = INT_THOCS

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.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = P_DATE

IMPORTING

DAY = TDAY

EXCEPTIONS

OTHERS = 1.

  • For checking.

if tholiday_found = 'X'.

write: /1 'Holiday ', P_DATE.

else.

write: /1 'Not Holiday ', P_DATE.

endif.

case sy-subrc.

when 0.

write: /1 P_DATE, 'is', tday, 'day of the week.'.

when others.

write: /1 'Unknown day ', P_DATE.

endcase.

ENDFORM.

rgds

anver

Read only

0 Likes
676

dear buddy,

thanks for this ans

i've to find num of holidays betn 2 dates

i've a fm to find a holiday or not for a perticular date

i.e, 'DATE_CONVERT_TO_FACTORYDATE'

Read only

Former Member
0 Likes
676

hi

good

check with these tables

T015M Month names

TTZZ Time zones

T247 Month names

TFACD Factory calendar definition

thanks

mrutyun^

Read only

anversha_s
Active Contributor
0 Likes
676

hi

Check out this code.

it_holidays gives the no. of holidays between the a given period.

x_date will give the no. of working days.

REPORT ZTEST NO STANDARD PAGE HEADING LINE-COUNT 65

LINE-SIZE 132

MESSAGE-ID ZZ.

PARAMETER : P_DATE LIKE SY-DATUM.

data: it_holidays like iscal_day occurs 0 with header line.

DATA: T_DATE LIKE SY-DATUM.

data : x_date(4) type c.

data: cnt type i.

REFRESH : IT_HOLIDAYS.

CLEAR : IT_HOLIDAYS.

T_DATE = SY-DATUM.

CALL FUNCTION 'HOLIDAY_GET'

EXPORTING

HOLIDAY_CALENDAR = 'US'

  • FACTORY_CALENDAR = ' '

DATE_FROM = P_DATE

DATE_TO = T_DATE

  • IMPORTING

  • YEAR_OF_VALID_FROM =

  • YEAR_OF_VALID_TO =

  • RETURNCODE =

TABLES

HOLIDAYS = IT_HOLIDAYS

EXCEPTIONS

FACTORY_CALENDAR_NOT_FOUND = 1

HOLIDAY_CALENDAR_NOT_FOUND = 2

DATE_HAS_INVALID_FORMAT = 3

DATE_INCONSISTENCY = 4

OTHERS = 5.

cnt = 0.

loop at it_holidays.

write 😕 it_holidays.

cnt = cnt + 1.

endloop.

x_date = t_date - p_date - cnt.

write 😕 x_date.

Regards,

anver

Read only

Former Member
0 Likes
676

Giri,

try TFACD table

FM 'CO2Z_FACT_CALENDAR_CHECK_DATE' gives you whether it's a holiday or not including weekend.

-Anu

Message was edited by: Anupama Reddy