Posts tonen met het label GL. Alle posts tonen
Posts tonen met het label GL. Alle posts tonen

zondag 13 december 2015

Fetch GL Period based on date

To fetch the period name based on a specific date you can use a query like below. In The period statuses table you'll find a record for each application that is using it, so make sure you add this to your where clause (could be AR, SQLAP, etc).

SELECT  L.Ledger_Id
,       L.Period_Set_Name
,       P.Show_Status
,       P.Start_Date
,       P.End_Date
,       P.Period_Name
,       P.Adjustment_Period_Flag
,       A.Application_Short_Name
FROM    GL_LEDGERS L
,       GL_PERIOD_STATUSES_V P
,       FND_APPLICATION A
WHERE   L.Name            = mo_utils.Get_Ledger_Name(fnd_profile.value ('ORG_ID') )
AND     L.Ledger_Id       = P.Ledger_Id
AND     P.Application_Id  = A.Application_Id
AND     P.Period_Type     = L.Accounted_Period_Type
AND     Sysdate BETWEEN P.Start_Date AND P.End_Date
AND     A.Application_Short_Name = 'SQLGL'
AND     P.Adjustment_Period_Flag = 'N'
;