Query to find open period in inventory

Hi all,
Please help me to create an sql statement to find the periods that are open in inventory. I created the script below but it gives me duplicate values. Is there any other way other than putting DISTINCT keyword to get rid of these duplicates. Do i miss some conditions?
select DISTINCT o.name, d.inventory_enabled_flag, a.period_name, to_number(a.period_year || lpad(a.period_num,4,'0'))
from hr.hr_organization_information h, apps.org_acct_periods a, hr.hr_all_organization_units o, apps.org_organization_definitions d
where period_name != TO_CHAR(SYSDATE,'MON')||'-'||TO_CHAR(SYSDATE,'RR')
and h.organization_id = a.organization_id
and a.organization_id = d.organization_id
and o.organization_id = d.operating_unit
and a.open_flag = 'Y'
and h.org_information1 = 'INV'
ORDER BY 1, 4 DESCThanks

Try this ...
Regards,
Jon
SELECT
opu.name as operating_unit
, per.organization_id as inv_org_id
, par.organization_code as inv_org_code
, per.period_name
, per.period_year
, per.period_num
, flv.meaning as status
, per.period_start_date
, per.schedule_close_date
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
ORDER BY opu.name, per.organization_id, per.period_year desc, per.period_num desc

Similar Messages

  • FM to find Open Periods

    Hi all,
    Is there Function Module to find the Open Periods for a specific Company Code.
    Thanks in Advance
    Johann

    Hi,
    Please check this FM.
    MR_PERIOD_DETERMINE
    FI_PERIOD_DETERMINE
    Also you can go to transaction codes MMRV and OB52.
    Regards,
    Ferry Lianto

  • Query to find the Custom Workflow Inventory

    Hello all,
    Is there anyway i can find out the list of Custom or all the workflows which have not been initialized or used since last 2 years? We are trying to clean our inventory of custom workflows.
    Thank You
    KK

    Hi,
    You can check
    select name,display_name
    from wf_item_types_vl wit
    where not exists (select 1
                  from wf_item_activity_statuses
                  where item_type = wit.name
                  and  trunc(begin_date) >= trunc(sysdate -720));this table will give all transaction data by passing name as internal name of Workflow .
    select * from wf_item_activity_statuses where item_type = <YourCustomItemType>;
    Thanks,
    Jit

  • Function Module to find out detail of open period of Finance (FI)

    Hi  All,
    I have a query that I want to know the existing function module to find out
    FI period detail thatis detail of opened period in FI.
    Regards,
    Rishi

    Hi Rishi
    Go to transaction SE37 and you can see the list of FM.
    Thanks
    Ashok
    Assign points for useful answer

  • Unable to find the months in Inventory Accounting Periods

    Hi All,
    1) Created a new calendar.
    2) Created a new organization "ABC".
    3) Attached calendar to it.
    Now i am trying to open period for the new org "ABC".
    But i am unable to find any month?
    Also it gives message "no list of values" for "ABC" org.
    Is there any setup missing for this?
    Regards,
    SYR

    Hi All,
    1) Created a new calendar.
    2) Created a new organization "ABC".
    3) Attached calendar to it.
    Now i am trying to open period for the new org "ABC".
    But i am unable to find any month?
    Also it gives message "no list of values" for "ABC" org.
    Is there any setup missing for this?
    Regards,
    SYR

  • How To Overcome When User Incorrectly Opened The First Inventory Accounting Period As Next Month

    Hi,
    User has opened the wrong first inventory account period. Instead of Aug-14, next period Sep-14 has been opened. There are transactions which need to be posted in Aug-14. How can I rectify this?
    During my search in oracle support, I found below information but the note is not accessible.
    "Internal Note 400900.1 How To Overcome When User Incorrectly Opened The First Inventory Accounting Period As Next Month"
    Regards,
    Ahmed

    Hi ,
    Try This Way...
       If you want to use the uesr exit in two places...
          If area = xyz
           variable1
         else
             variable2.
    same function module you can use in different places...
    If still not clear send me the full details where you want to use then i can send it to you with sample code.
    Thanks..
    Siri N

  • Need query to find out the sum till a period

    Hi,
    I need to write one query to find out the cumulative sum of raw_cost of table pa_budget_lines till the specified period, I tried to do this by analytical function, but that is not working in Report 10g. Can anybody help me in this.
    Thanks

    not familiar with report but could you do something like this
    with t as
      select 1 grp, 10 * level the_cost, add_months (sysdate,  level) effective_dt from dual connect by  level < 11 union all
      select 2 grp, 5 * level the_cost, add_months (sysdate,  level) effective_dt from dual connect by  level < 11
    input as
      ( select null grp, null the_cost, null running_total,  v_eff_dt effective_dt   from dual)
    select * from(
    select t.grp, t.the_cost, sum(t.the_cost) over (partition by t.grp order by t.effective_dt) running_total, t.effective_dt,
           lead(t.effective_dt) over (partition by t.grp order by t.effective_dt) next_effective_dt,
           input.effective_dt  inp_eff_dt
    from t, input
    where inp_eff_dt between effective_dt and next_effective_dtv_eff_dt would be the input date you are interested in

  • Query to find status of all module periods.

    Does any one have a query that can check the open periods in all modules.
    I'm looking for an out put like this
    Module Set of Books Operating Unit Period Name Period Number Closing Status Start Date End Date
    Thanks.

    Hi Anil,
    May I ask that if I can correct the periods status to auto generate the correct system by update the tables of you mentioned, because our company staff change the date of those period to be 'Adjusting' periods and then open them, but found those periods were 'missing' then, the detail problem is on this thread,
    Re: Change adjusting period to non-adjusting period
    Thanks!

  • Create a query to find the open PO

    Hi all,
    I want to create a query to find the Open PO which GR is not complete or Open invoice.
    But I don't know how can I get the value: still to be invocied ,still to be delivery .
    I want to know which table I can find these information.
    I know a T-code :ME2L can run this report, but the format is not user friendly,so I want to create a new query .

    Hi
    No need to create any query to find an Open PO.
    You can use ME2N or ME2L or ME2N with proper scope of list and selection parameter.
    In scope of list you can use the ALV one to get the user friendly report, if you do not have the ALV then you can
    create your own scope of list by following the steps.
    1) press F1 and click on the customizing icon
    2) Click the button W/O specifying the project
    3) Click Define scope of list
    4) Copy any scope of list for example BEST and rename it as BEST_ALV and Tick the check box AL on the Bottom
    5) You can get this new scope of list in the tcods mentioned above and execute thereports.
    6) Once you get the output you can modify the layoout  to get the user friendly format. Also you can download into excel sheet.
    Hope it helps
    Thanks/karthik

  • Can't Find Periods In Inventory Accounting Periods

    Hi -
    Inventory Superuser > Accounting Close Cycle > Inventory Accounting Periods 
    I can find here just periods from JUL , can't find earlier periods ..Although All periods are defined in General Ledger Calendar .
    What could be Missing ?
    Regards

    I Logged SR ..
    The problem Now Solved

  • How to find open query executed once on SQL server

    Hi Experts ,
    Is there any way to identify that open query executed once on Db server using any DMv's ? we are planning enabale opimized for ad-hoc queries on SQL server ?
    Shivraj Patil.

    Hi,
    You can use below query  to find the plans that have been used only once.
    SELECT text, cp.objtype, cp.size_in_bytes
    FROM sys.dm_exec_cached_plans AS cp
    CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st
    WHERE cp.cacheobjtype = N'Compiled Plan'
    AND cp.objtype IN(N'Adhoc', N'Prepared')
    AND cp.usecounts = 1
    ORDER BY cp.size_in_bytes DESC
    OPTION (RECOMPILE);
    additionally you can also refer below articles.
    http://sqlmag.com/database-performance-tuning/sql-server-plan-cache-junk-drawer-your-queries
    Plan cache and optimizing for adhoc workloads
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page

  • How to create a query to see Opening stock and closing stock as on particul

    Hi All,
    How to create a query to see Opening stock and closing stock as on particul.
    Regards
    Albaik

    Hi,
    In BI 0IC_C03 will provide u the  required information and also having standard queries provided by the SAP.
    Plz find the list of Queries provided by the SAP.
    =======================================================================================================
    Inventory turnover      0IC_C01_Q0001
    Range of coverage - quantity      0IC_C01_Q0002
    Range of Coverage - Value      0IC_C01_Q0003
    Range of coverage of finished goods - quantity      0IC_C01_Q0004
    Range of Coverage of Finished Goods - Value      0IC_C01_Q0005
    Range of coverage of raw materials - quantity      0IC_C01_Q0006
    Range of Coverage of Raw Materials - Value      0IC_C01_Q0007
    Obsolete Stock on Hand      0IC_C01_Q0008
    Period-dependent requirement coverage      0IC_C01_Q0009
    Value of stock on hand      0IC_C01_Q0010
    Quantity of stock on hand      0IC_C01_Q0011
    Material consumption      0IC_C01_Q0012
    Material Movements      0IC_C01_Q0013
    Consignment stock: receipts and issues      0IC_C01_Q0014
    Valuated stock: receipts and issues      0IC_C01_Q0015
    Material stock and movements      0IC_C01_Q0016
    Material Movements (Healthcare)      0IC_C01_Q0020
    Material Consumption (Healthcare)      0IC_C01_Q0021
    Material Availability      0IC_C01_Q0022
    Inventory Turnover Frequency (Value)      0IC_C01_Q0023
    Consignment Stock Received and Issued per Unit      0IC_C01_Q0024
    Material Consumption (Quantity)      0IC_C02_Q0001
    Valuated Stock Receipts and Issues (Quantity)      0IC_C02_Q0002
    Range of Valuated Stock (Quantity)      0IC_C02_Q0003
    Inventory Turnover      0IC_C02_Q0004
    Receipt and Issue Consignment Stock at Customer      0IC_C03_Q0001
    Receipt and Issue Quality Inspection Stock      0IC_C03_Q0002
    Vendor Consignment Stock Receipt and Issue      0IC_C03_Q0003
    Receipt and Issue Stock in Transit      0IC_C03_Q0004
    Receipt and Issue of Blocked Stock      0IC_C03_Q0005
    Valuated Stock      0IC_C03_Q0006
    Stock in Quality Inspection      0IC_C03_Q0007
    Stock in Transit      0IC_C03_Q0008
    Blocked Stock      0IC_C03_Q0009
    Vendor Consignment Stock      0IC_C03_Q0010
    Consignment Stock at Customer      0IC_C03_Q0011
    Stock Overview      0IC_C03_Q0012
    Stock Overview (as of 3.1 Content)      0IC_C03_Q0013
    Quantities of Valuated Project Stock (as of 3.1 Content)      0IC_C03_Q0014
    Valuated Stock (as of 3.1 Content)      0IC_C03_Q0015
    Quantities of Valuated Sales Order Stock (as of 2.1 Cont.)      0IC_C03_Q0016
    Inventory Turnover      0IC_C03_Q0017
    Days' Supply      0IC_C03_Q0018
    SUS: Vendor Consignment Stock      0IC_C03_Q0019
    Scrap      0IC_C03_Q0020
    Inventory Aging      0IC_C03_Q0021
    Stock Overview - extended      0IC_C03_Q0022
    Demand Supply Match      0IC_C03_Q0023
    Warehouse Stock Analytics – Inventory Turnover      0IC_C03_Q0024
    Warehouse Analytics - Obsolescence and Variance      0IC_C03_Q0025
    Stock Overview: Materials      0IC_C03_Q0030
    Average Stock Value Over Time      0IC_C03_Q0031
    Stock Overview Over Time      0IC_C03_Q0032
    Range of Coverage Over Time      0IC_C03_Q0033
    ==================================================================================================
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Jan 18, 2010 8:06 AM

  • The GL date is not in an open period: APP-PO-14230

    Hi,
    I am using R12.1.1 version.
    I am getting this error "The GL date is not in an open period: APP-PO-14230" when i open the "Inventory > Transactions > Receiving > Receipts" screen for the Intransit shipment.
    The Accounting calendar period (DEC -2011) is opened in both source & destination organisation.
    When i try to check the " General Ledger > Setup > Open/Close" screen, it asking the Ledger value to find out the periods.
    If i entered my primary ledger name on this field, its not matching.
    How to resolve this error.
    I am functional person. I dont have rights to see any database table levels.
    Please help me. Thank you in advance.

    Hi;
    Please see below notes:
    RVTPT-098: ORA-01086: savepoint 'START_TRX' never established [ID 987686.1]
    APP-PO-14230 Or APP-PO-14376 : When Saving Receipts [ID 552244.1]
    Run Masscancel Error App-Po-14230: The GL Date Is Not In An Open Period. [ID 1131265.1]
    Mass Cancel Error APP-PO-14230 GL Date Not In an Open Period, But Can Manually Cancel The Same Purchase Orders [ID 882329.1]
    Hope it helps
    Regard
    Helios

  • How to find open orders with amount and open deliveries?

    Hi All,
    I want to find out the open orders with open amount and open deliveries for a particular customer.
    We need this for credit check purpose.
    Kindly guide us for this.
    Regards,
    Satish.

    Hi,
    To find out open order:
    data: c_bef_pgi(1) TYPE c VALUE 'A',
    RANGES: rg_wbstk FOR vbuk-wbstk."range for wbstk
      rg_wbstk-sign = 'I'.
      rg_wbstk-option = 'EQ'.
      rg_wbstk-low = 'C'.
      APPEND rg_wbstk.
      rg_wbstk-low = 'A'.
      APPEND rg_wbstk.
    1.first put query on vbak table
    2.Put query on vbuk table as
          SELECT vbeln bestk lfstk gbstk FROM vbuk
                  INTO TABLE it_vbuk_open
                  FOR ALL ENTRIES IN it_vbak
                  WHERE vbeln = it_vbak-vbeln AND
                        bestk IN rg_wbstk AND
                        lfstk = c_bef_pgi.
    so this wil give u open orders.
    3. Then according to vbuk, get the details from vbap.
    To find open delivery
    1. First put query on vbak table
    2. Put query on vbfa as
      SELECT vbelv posnv vbeln posnn vbtyp_n vbtyp_v FROM vbfa
                 INTO TABLE it_vbfa
                 FOR ALL ENTRIES IN it_vbak
                 WHERE vbelv = it_vbak-vbeln AND
                       vbtyp_n = 'J' AND
                       vbtyp_v = 'C'.
    3.Then from VBfa,get the details from LIkp
    4.Then put entry on vbuk as
    *entries from vbuk
          SELECT vbeln wbstk fkstk gbstk FROM vbuk
                 INTO TABLE it_vbuk_del
                 FOR ALL ENTRIES IN it_likp
                 WHERE vbeln = it_likp-vbeln AND
                       wbstk IN rg_wbstk AND
                       fkstk = c_bef_pgi.
    Thanks & Regards,
    Anagha Deshmukh

  • After GL Year opening the months of new year are not appearing in open period window of Gl?

    Hi All,
    After GL Year opening the months of new year are not appearing in open period window of Gl? Am i missing any thing???
    regards
    Shahzad M. Saleem

    Have you checked GL setups
    Setup accounting manager >
    Query your OU >
    Under setup steps click on Update for ledger
    Under accounting calendar
    Number of future enterable periods.

Maybe you are looking for

  • CUCM SQL to view Logged in Phones (extension mobility)

    Hi all, is there any SQL statement, showing me all Phones where people are logged in with their extension? There is a function like this on Device - Phone scrolling down to Extension Information and there is a field called "Current Device Profile", b

  • Contextual Services not appearing correctly

    I love the new format for Services and how only relevant ones are supposed to appear at any given time. However, Snow Leopard is not always offering the correct ones. The only ones I ever used (and I used them a lot) were the Convert Traditional Chin

  • SICF Service not available in Production

    Hi Experts, I have created a Webdynpro application and I have moved it to quality and Production systems respectivelly. In development and quality system it is working fine, but the same application in production gives a runtime error. It is showing

  • Unique constraint error on delete/insert

    Hi, I am using Jdeveloper 11.1.1.3.0. I have a ADF table where we can copy lines and delete lines. I get unique constraint error when I save. Looks like the insert operation in happening before the delete operation. Is there a way to set the executio

  • Changing order line item move-out date

    Hi All, I am pretty new on the CRM end. I have a requirement where- in i need to change the move-out date on the order line item. Could someone help me out what needs to be done in order to achieve the desired functionality. Thanks, Im