Thursday 13 September 2018

Query to find Custom Layouts for Oracle WebADI

--Query to get WebADI Custom layouts
SELECT bl.application_id
      ,(select APPLICATION_NAME
          from fnd_application_vl
         where application_id = bl.application_id) lay_app_name
      ,bl.layout_code
      ,bl.user_name layout_name
      ,bl.integrator_app_id
      ,(select APPLICATION_NAME
          from fnd_application_vl
         where application_id = bl.integrator_app_id) intg_app_name
      ,bl.integrator_code
      ,(select user_name from fnd_user where user_id = bl.created_by) lay_created_by
      ,creation_date
  FROM bne_layouts_vl bl
 WHERE bl.created_by > 2
   AND EXISTS
       (select 1
          from fnd_user
         where user_id = bl.created_by)


--Query to get all the Fields/Columns included/selected for the specific WebADI Layout Code
SELECT blc.prompt_left
      ,blc.interface_col_name
      ,blc.user_hint
      ,blc.required_flag
      ,blc.display_flag
      ,blc.read_only_flag
      ,blc.val_type
      ,blc.val_id_col
      ,blc.val_obj_name
      ,blc.lov_type
    FROM bne_layout_cols_v blc
   WHERE blc.layout_code = :P_LAYPUT_CODE --Get custom layout code from above query output
ORDER BY block_id
        ,sequence_num

Tuesday 11 September 2018

Query to get Prepay apply and Standard Invoice information

--Query to get Prepay apply and Standard Invoice information
SELECT pv.vendor_name
      ,aia.invoice_num
      ,aia.invoice_id
      ,aia.invoice_amount
      ,ail.line_number Invoice_Line_Num
      ,prepay.invoice_id Prepay_Invoice_Id
      ,prepay.invoice_num Prepay_Invoice_Num
      ,ail.prepay_line_number Prepay_Invoice_Line_Num
      ,(-1)*(ail.amount - NVL(ail.included_tax_amount,0)) Prepay_Amt_Applied
      ,NULLIF((-1)*(NVL(ail.total_rec_tax_amount, 0) +     
       NVL(ail.total_nrec_tax_amount, 0)), 0) Prepay_Tax_amount_Applied
  FROM AP_INVOICES_ALL aia
      ,AP_INVOICES_ALL prepay
      ,AP_INVOICE_LINES_ALL ail
      ,AP_SUPPLIERS pv
WHERE aia.invoice_id = ail.invoice_id
  AND prepay.invoice_id = ail.prepay_invoice_id
  AND ail.amount < 0
  AND NVL(ail.discarded_flag,'N') <> 'Y'
  AND ail.line_type_lookup_code = 'PREPAY'
  AND aia.vendor_id = pv.vendor_id
  AND aia.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND aia.invoice_id = 641876;

Wednesday 5 September 2018

Query to get Responsibilities under specific user

SELECT frv.RESPONSIBILITY_NAME
      ,frv.responsibility_key
      ,fat.application_name
      ,fa.APPLICATION_SHORT_NAME
      ,fu.user_name
  FROM fnd_user fu
      ,fnd_user_resp_groups furg
      ,fnd_responsibility_vl frv
      ,fnd_application_tl fat
      ,fnd_application fa
   WHERE furg.responsibility_id = frv.responsibility_id
     AND fu.user_id = furg.user_id
     AND fa.APPLICATION_ID = fat.APPLICATION_ID
     AND frv.APPLICATION_ID = fat.APPLICATION_ID
     AND upper(fu.user_name) = UPPER ('USER_NAME')
     AND fat.LANGUAGE = 'US'
ORDER BY 1;