Thursday, November 1, 2012

Query to Find the Immediate Parent in a BOM

SELECT DISTINCT SUBSTR (SYS_CONNECT_BY_PATH (msib.inventory_item_id, '/') || '/'
                      , 2
                      , INSTR ((SYS_CONNECT_BY_PATH (msib.inventory_item_id, '/') || '/')
                             , '/'
                             , 2
                              ) - 2
                       ) current_parent_item
              , SUBSTR (SYS_CONNECT_BY_PATH (msib.segment1, '/') || '/'
                      , 2
                      , INSTR ((SYS_CONNECT_BY_PATH (msib.segment1, '/') || '/')
                             , '/'
                             , 2
                              ) - 2
                       ) current_parent_item
           FROM bom.bom_components_b bic
              , bom.bom_structures_b bom
              , inv.mtl_system_items_b msib
              , inv.mtl_system_items_b msib2
          WHERE 1 = 1
            AND bic.bill_sequence_id = bom.bill_sequence_id
            AND bom.assembly_item_id = msib.inventory_item_id
            AND bom.organization_id = msib.organization_id
            AND bic.component_item_id = msib2.inventory_item_id
            AND bom.organization_id = msib2.organization_id
            AND bom.organization_id = :p_organization_id
            AND bom.assembly_item_id = :p_assembly_item_id
     START WITH bic.component_item_id = :p_component_item_id
     CONNECT BY bic.component_item_id = PRIOR msib.inventory_item_id

Tuesday, October 23, 2012

API To Assigns An Existing Role To An Existing User In The 'CRM_DOMAIN'

Script to Assign the Install base roles for a User

BEGIN
jtf_auth_bulkload_pkg.assign_role('<&USER_NAME>','CSI_NORMAL_USER');
COMMIT;
END;

Tuesday, October 16, 2012

Query to Find the SID of the a Concurrent Program running from Application

SELECT   fcr.request_id
       , SUBSTR (DECODE (fcr.description
                       , NULL, fcp.user_concurrent_program_name
                       , fcr.description || ' (' || fcp.user_concurrent_program_name || ')'
                        )
               , 1
               , 40
                ) conc_prog_name
       , TO_CHAR (fcr.actual_start_date, 'hh24:mi') s_time
       , fu.user_name requestor
       , SID
       , vs.process
       , vp.spid
FROM     v$session vs
       , v$process vp
       , apps.fnd_user fu
       , apps.fnd_concurrent_programs_vl fcp
       , apps.fnd_concurrent_requests fcr
   WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
     AND fcr.program_application_id = fcp.application_id
     AND fcr.status_code = 'R'
     AND fcr.phase_code = 'R'
     AND fcr.requested_by = fu.user_id
     AND fcr.oracle_process_id = vp.spid(+)
     AND vp.addr = vs.paddr(+)
     AND fcr.request_id = :request_id
ORDER BY SUBSTR (DECODE (fcr.description
                       , NULL, fcp.user_concurrent_program_name
                       , fcr.description || ' (' || fcp.user_concurrent_program_name || ')'
                        )
               , 1
               , 40
                )
       , fcr.actual_start_date
     

Monday, October 8, 2012

Syntax to Create the Soft link for .PROG file

Script to create the Soft Link for the Shell Script

ln -s $FND_TOP/bin/fndcpesr FILE_NAME

Friday, September 21, 2012

How to Query on the LONG datatype Columns

-- Create the custom table as mentioned below 

CREATE TABLE XX_ALL_TRIGGERS AS SELECT TRIGGER_NAME,TO_LOB(TRIGGER_BODY) AS TRIGGER_BODY FROM ALL_TRIGGERS;


--After creating the table execute the below query


SELECT * FROM XX_ALL_TRIGGERS WHERE UPPER(TRIGGER_BODY) LIKE 'XX%TRG%';