Query to find period status for Inventory General Ledger Purchasing Payables Receivables Fixed Assets

Query to find period status for Inventory General Ledger Purchasing Payables Receivables Fixed Assets
oracle apps sql query for period status
period status backend query for Inventory, General Ledger, Purchasing, Payables, Receivables, Fixed Assets

Period status for Inventory

-- Period status for Inventory
  SELECT DISTINCT opu.name            AS operating_unit,
                  per.organization_id AS inv_org_id,
                  par.organization_code AS inv_org_code,
                  org1.name           AS Organization_name,
                  per.period_name,
                  per.period_year,
                  flv.meaning         AS status
    FROM org_acct_periods           per,
         fnd_lookup_values          flv,
         mtl_parameters             par,
         hr_all_organization_units  org1,
         hr_all_organization_units_tl otl,
         hr_organization_information org2,
         hr_organization_information org3,
         hr_operating_units         opu
   WHERE     1 = 1
         AND flv.lookup_type(+) = 'MTL_ACCT_PERIOD_STATUS'
         AND flv.enabled_flag(+) = 'Y'
         AND per.organization_id = par.organization_id
         AND flv.lookup_code(+) =
                DECODE (
                   NVL (per.period_close_date, SYSDATE),
                   per.period_close_date, DECODE (
                                             per.open_flag,
                                             'N', DECODE (summarized_flag,
                                                          'N', 65,
                                                          66),
                                             'Y', 4,
                                             'P', 2,
                                             4),
                   3)
         AND flv.language = 'US'
         AND UPPER (flv.meaning) != 'CLOSED'
         AND per.organization_id = org1.organization_id
         AND org1.organization_id = otl.organization_id
         AND org1.organization_id = org2.organization_id
         AND org1.organization_id = org3.organization_id
         AND org2.org_information_context = 'Accounting Information'
         AND org3.org_information_context = 'CLASS'
         AND org3.org_information1 = 'INV'
         AND org3.org_information2 = 'Y'
         AND org2.org_information3 = opu.organization_id
         AND PER.PERIOD_NAME IN ('JAN-20', 'FEB-20')
ORDER BY opu.name, per.organization_id;

Period status for GL, PO, AP, AR, FA

--Period status for GL, PO, AP, AR, FA
  SELECT DISTINCT (SELECT sob.NAME
                     FROM gl_sets_of_books sob
                    WHERE sob.set_of_books_id = a.set_of_books_id)
                     "SOB Name",
                  a.period_name "Period Name",
                  a.period_num "Period Number",
                  a.gl_status "GL",
                  b.po_status "PO",
                  c.ap_status "AP",
                  d.ar_status "AR",
                  e.fa_status "FA"
    FROM (SELECT period_name,
                 period_num,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status)
                    gl_status,
                 set_of_books_id
            FROM gl_period_statuses
           WHERE     application_id = 101
                 AND UPPER (period_name) IN ('JAN-20', 'FEB-20')
                 AND 1 = 1) a,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status)
                    po_status,
                 set_of_books_id
            FROM gl_period_statuses
           WHERE     application_id = 201
                 AND UPPER (period_name) IN ('JAN-20', 'FEB-20')
                 AND 1 = 1) b,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status)
                    ap_status,
                 set_of_books_id
            FROM gl_period_statuses
           WHERE     application_id = 200
                 AND UPPER (period_name) IN ('JAN-20', 'FEB-20')
                 AND 1 = 1) c,
         (SELECT period_name,
                 DECODE (closing_status,
                         'O', 'Open',
                         'C', 'Closed',
                         'F', 'Future',
                         'N', 'Never',
                         closing_status)
                    ar_status,
                 set_of_books_id
            FROM gl_period_statuses
           WHERE     application_id = 222
                 AND UPPER (period_name) IN ('JAN-20', 'FEB-20')
                 AND 1 = 1) d,
         (SELECT fdp.period_name,
                 DECODE (fdp.period_close_date, NULL, 'Open', 'Closed')
                    fa_status,
                 fbc.set_of_books_id
            FROM fa_book_controls fbc, fa_deprn_periods fdp
           WHERE     1 = 1
                 AND fbc.book_type_code = fdp.book_type_code
                 AND UPPER (period_name) IN ('JAN-20', 'FEB-20')) e,
         gl_sets_of_books gsob
   WHERE     a.period_name = b.period_name(+)
         AND a.period_name = c.period_name(+)
         AND a.period_name = d.period_name(+)
         AND a.period_name = e.period_name(+)
         AND gsob.set_of_books_id = a.set_of_books_id(+)
         AND a.set_of_books_id = b.set_of_books_id(+)
         AND a.set_of_books_id = c.set_of_books_id(+)
         AND a.set_of_books_id = d.set_of_books_id(+)
         AND a.set_of_books_id = e.set_of_books_id(+)
ORDER BY 1, 2 DESC, 3;

For more reusable queries, click https://tech7.in/category/technologyblog/oracle/

Related posts: Upload your own post and refer it anywhere anytime:

Leave a Reply