SQL Query to get the Item Status change history

The Item Status change history can be found in the below navigation -

Development Manager-->Item Catalog-->Item search




This opens below screen, in which we need to type the Item number and click on Go.


It will populate all the Items.
Open the item that you want to see the history for by clicking on item name.
Go to the Lifecycle tab as below-





Click on history in the left pane as below-

The phases tab below shows the history of the status-




The Query below helps to extract the same data -

 SELECT
    *
FROM ( SELECT
    mpis.rowid                                                                                          AS row_id,
    mpis.inventory_item_id,msi.segment1,
    mpis.organization_id,
    mpis.revision_id,
    mpis.status_code,
   -- mpis.effective_date,
    to_char(mpis.effective_date, 'DD-MON-YYYY')                                                         AS effective_date,
    to_char(mpis.implemented_date,'DD-MON-YYYY') as implemented_date,
    mpis.lifecycle_id,
    mpis.phase_id,
    mpis.pending_flag,
    ppe1.name                                                                                           AS phase_name,
    --ppe1.display_sequence,
    elis.item_status_code                                                                               AS default_status_code,
    ppe2.name                                                                                           AS lifecycle_name,
    ltrim(people.party_name, '* ')                                                                      AS initiatedby,
   -- decode(mpis.change_id, NULL, NULL, apps.ego_lifecycle_user_pub.get_change_name(change_id))               AS changenotice,
   -- to_char(people.party_id)                                                                            AS party_id,
    --mpis.change_id,
    --mpis.change_line_id,
    mis.inventory_item_status_code_tl                                                                   status_code_tl,
    decode(msi.inventory_item_status_code,NULL,'INACTIVE',msi.inventory_item_status_code)                Current_Status                                                      
    from 
    apps.mtl_pending_item_status mpis ,apps.PA_EGO_PHASES_V PPE1,apps.PA_EGO_LIFECYCLES_V PPE2,
    apps.EGO_LCPHASE_ITEM_STATUS ELIS,apps.EGO_USER_V PEOPLE,apps.MTL_ITEM_STATUS MIS,
    apps.MTL_SYSTEM_ITEMS_B MSI 
    WHERE PPE2.PROJ_ELEMENT_ID (+) = MPIS.LIFECYCLE_ID AND
    PPE1.PROJ_ELEMENT_ID (+) = MPIS.PHASE_ID AND ELIS.PHASE_CODE (+) = PPE1.PHASE_CODE 
    AND ELIS.DEFAULT_FLAG (+) = 'Y'AND PEOPLE.user_id (+) = MPIS.created_by 
    AND mpis.status_code = mis.inventory_item_status_code(+)
AND mpis.inventory_item_id = msi.inventory_item_id (+)
    AND mpis.organization_id = msi.organization_id (+)
        AND mpis.lifecycle_id = msi.lifecycle_id (+)
        AND mpis.inventory_item_id = &Item_id
        and mpis.organization_id= &ORG_ID) qrslt
ORDER BY effective_date desc; 


Comments