Tuesday, 19 December 2023

Query To Get Form Personalizations Details in Oracle APPS R12

/*SQL query to get Oracle Form Personalization Details*/


SELECT fcr.SEQUENCE                                   rule_seq,
       ffv.form_name,
       user_form_name,
       fcr.function_name,
       fff.user_function_name,
       fcr.description                                per_description,
       trigger_event,
       trigger_object,
       fcr.condition,
       fcr.enabled,
       (SELECT user_name
        FROM   fnd_user fu
        WHERE  fu.user_id = fcr.created_by)           created_by,
       Decode (fcr.rule_type, 'F', 'Form',
                              'A', 'Function')        personalize_rule_level,
       Decode (fcs.level_id, 10, 'Industry',
                             20, 'Site',
                             30, 'Responsibility',
                             40, 'User')              context_level,
       Decode (fcs.level_id, 10, '',
                             20, '',
                             30, frt.responsibility_name,
                             40, fu.user_name)        context_level_value,
       ca.SEQUENCE                                    action_seq,
       Decode (ca.action_type, 'P', 'Property',
                               'B', 'Builtin',
                               'M', 'Message',
                               ca.action_type)        ACTION_TYPE,
       Decode (ca.message_type, 'W', 'Warn',
                                'E', 'Error',
                                'S', 'Show',
                                ca.message_type)      message_type,
       ca.message_text,
       fnd_load_util.Owner_name (fcr.last_updated_by) apps_owner
FROM   fnd_form_custom_rules fcr,
       fnd_form_custom_scopes fcs,
       fnd_form_functions_vl fff,
       fnd_responsibility_tl frt,
       fnd_user fu,
       fnd_form_vl ffv,
       fnd_form_custom_actions ca
WHERE  fcs.rule_id = fcr.id
       AND fcr.function_name = fff.function_name
       AND fcs.level_value = frt.responsibility_id(+)
       AND fcs.level_value = fu.user_id(+)
       AND ffv.form_name = fcr.form_name
       AND fcr.id = ca.rule_id
--and fcr.ID= 1448
--and ffv.form_name = 'OEXOEORD' --Sales Orders
ORDER  BY ffv.form_name; 

Friday, 8 December 2023

SQL Query to extract Miscellaneous Transactions in Oracle Inventory APPS R12

 /*SQL Query to extract Miscellaneous Transactions in Oracle Inventory*/

SELECT HRO.name
       ORGANIZATION,
       MMT.inventory_item_id,
       MSB.segment1 ITEM_CODE,
       mtt.transaction_type_name,
       MMT.subinventory_code,
       MMT.transaction_quantity,
       MMT.transaction_uom,
       (SELECT concatenated_segments
        FROM   gl_code_combinations_kfv gcck
        WHERE  gcck.code_combination_id = MMT.distribution_account_id) mmt_acct,
       --Accounting Type : "Account"
       (SELECT Listagg(DISTINCT gcck.concatenated_segments, ',')
                 within GROUP (ORDER BY NULL) 
        FROM   gl_code_combinations_kfv gcck,
               cst_inv_distribution_v CID
        WHERE  GCCK.code_combination_id = CID.reference_account
               AND CID.transaction_id = MMT.transaction_id
               AND CID.organization_id = MMT.organization_id
               AND CID.accounting_line_type = 1)
       Inv_valuation_acct,--Accounting Type : "Inv valuation"
       (SELECT Listagg(DISTINCT gcck.concatenated_segments, ',')
                 within GROUP (ORDER BY NULL) 
        FROM   gl_code_combinations_kfv gcck,
               mtl_transaction_accounts mta
        WHERE  mta.transaction_id = mmt.transaction_id
               AND mta.organization_id = mmt.organization_id
               AND accounting_line_type = 1
               AND gcck.code_combination_id = mta.reference_account)
       reference_account,--Accounting Type : "Inv valuation"
       MMT.transaction_date,
       (SELECT SUM(( base_transaction_value ) / ( primary_quantity ))
        FROM   mtl_transaction_accounts mta
        WHERE  mta.transaction_id = mmt.transaction_id
               AND mta.organization_id = mmt.organization_id
               AND accounting_line_type = 1) cost,
       (SELECT SUM(CID.unit_cost)
        FROM   cst_inv_distribution_v CID
        WHERE  CID.transaction_id = MMT.transaction_id
               AND CID.organization_id = MMT.organization_id
               AND CID.accounting_line_type = 1 --Inv valuation
       ) UNIT_COST,
       MMT.actual_cost,
       (SELECT user_name
        FROM   fnd_user fu
        WHERE  fu.user_id = mmt.created_by) created_by
FROM   apps.mtl_material_transactions MMT,
       apps.mtl_transaction_types MTT,
       apps.mtl_system_items_b MSB,
       apps.hr_all_organization_units HRO
WHERE  mmt.transaction_type_id = mtt.transaction_type_id
       AND mtt.transaction_type_name LIKE '%Miscellaneous%'
       AND MMT.inventory_item_id = MSB.inventory_item_id
       AND MMT.organization_id = MSB.organization_id
       AND MMT.organization_id = HRO.organization_id
       --and MMT.TRANSACTION_ID = 676767565
       AND Trunc(MMT.transaction_date) BETWEEN :FROM_DATE AND :TO_DATE;