Views:

SQl quarry to check fiscal year setup window in SY40101.  Sometimes a user accidently put the new fiscal year setup over top of a history year and here are some sql quarries to check the SY401010 table to make sure everything for each year is setup correctly.

All fiscal years:

SELECT
   YEAR1 [Year],
   FSTFSCDY First_Day,
   LSTFSCDY Last_Day,
   NUMOFPER Number_of_Periods,
   CASE HISTORYR
     WHEN 0 THEN 'Open Year'
     WHEN 1 THEN 'Historical Year'
     END Year_Status
FROM SY40101
ORDER BY YEAR1

Sample results:

Fiscal periods for the current year:

SELECT
   D.PERIODID Period_Number,
   D.PERNAME Period_Name,
   D.PERIODDT Starting_Date,
   D.PERDENDT Ending_Date,
   D.YEAR1 Fiscal_Year
FROM SY40100 D
INNER JOIN
   SY40101 H
   ON H.YEAR1 = D.YEAR1
WHERE
   D.FORIGIN = 1 AND D.PERIODID <> 0
   and GETDATE() between H.FSTFSCDY and H.LSTFSCDY
ORDER BY D.PERIODID

You can change the line in blue above if you need to see a different year. Sample results: