Skip to Content
0
Former Member
Mar 27, 2006 at 05:05 PM

problem with factory calender days calculation

30 Views

Hi

I have created a simple test program for calculating the number of working days between two dates:

report ztestalok.

data : to_date_fact like SCAL-FACDATE,

from_date_fact like SCAL-FACDATE.

parameters: fr_date like SCAL-DATE,

to_date like SCAL-DATE.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

CORRECT_OPTION = '+'

DATE = fr_date

FACTORY_CALENDAR_ID = '01'

IMPORTING

FACTORYDATE = from_date_fact

.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

CORRECT_OPTION = '+'

DATE = to_date

FACTORY_CALENDAR_ID = '01'

IMPORTING

FACTORYDATE = to_date_fact

.

data: days type i.

days = to_date_fact - from_date_fact.

Write: 'The number of days = ', days.

The output is correct if i run this report for the whole year of 2006, however if i run this for january, feb month wise, the report is not giving the correct number of days.

I am totally puzzled. Pl help with your inputs.

Regards

Alok Pathak