ABAP – Calculating the weekends for a particular period

In ABAP we can calculate the weekend information for a particular period using the function module CATSXT_GET_HOLIDAYS.

This function module will give all the details of the weekends between a BEGDA and ENDDA.

Syntax with example:

data: it_wday         type catsxt_iscal_day_itab,

count type i.

CALL FUNCTION ‘CATSXT_GET_HOLIDAYS’
EXPORTING
IM_PERSONNEL_NUMBER = pernr-pernr
IM_BEGIN_DATE       = begda
IM_END_DATE         = endda
IM_GET_WEEKEND_DAYS = ‘X’
IMPORTING
EX_HOLIDAYS         = it_wday.

count = lines( it_wday ).

 

Here the internal table it_wday will contains all the details of the weekends,

and the variable count will contains the number of weekends between the period BEGDA and ENDDA.

Note: Give “X” value for the variable IM_GET_WEEKEND_DAYS, if not you will not get the weekends details in the internal table.

 

 

0 Comments

Leave A Reply