X++ code to check Fiscal calendar period in AX 2012 and D365FO 
used to get the period status (Open, On hold and Closed)
  public static boolean checkFiscalCalendarPeriod(TransDate _transDate)
    {
        RecId calendarRecId;
        FiscalCalendarPeriod fiscalCalendarPeriod;
        calendarRecId = Ledger::fiscalCalendar(CompanyInfo::find().RecId);
        fiscalCalendarPeriod = FiscalCalendarPeriod::findPeriodByCalendarDate(calendarRecId, _transDate, FiscalPeriodType::Operating);
        if (_transDate)
        {
            if (!fiscalCalendarPeriod)
            {
                return checkFailed(strFmt("@SYS17614",date2StrUsr(_transDate, DateFlags::FormatAll)));
            }
            if (fiscalCalendarPeriod.currentLedgerPeriodStatus() != FiscalPeriodStatus::Open)
            {
                return checkFailed(strFmt("@SYS17615", date2StrUsr(_transDate, DateFlags::FormatAll)));
            }
        }
        return true;
    }