Wednesday 19 August 2020

SQL Query to get the Suppliers Details - Oracle fusion.

Here is the generic SQL Query to fetch the basic Suppliers Details as per the Oracle FBDI template.  

SELECT pos.vendor_name                                          
      ,NULL                                                     
      ,pos.segment1                                             
      ,pos.vendor_name_alt                                      
      ,ps.organization_type_lookup_code                         
      ,pos.vendor_type_lookup_code                              
      ,pos.end_date_active
      ,pos.business_relationship
      ,hp1.party_name                                           
      ,alias.party_name                                         
      ,pos.duns_number_c                                        
      ,ps.one_time_flag                                         
      ,ps.customer_num                                         
      ,ps.standard_industry_class                             
      ,pS.ni_number                                             
      ,pos.corporate_website
      ,hop.ceo_title chief_executive_title_chk
      ,hp.ceo_name  chief_executive_name_chk
      ,ps.bc_not_applicable_flag
      ,ps.taxpayer_country
  ,psi.income_tax_id taxpayer_id
      ,ps.federal_reportable_flag                               
      ,ps.type_1099                                             
      ,ps.state_reportable_flag                                 
      ,ps.tax_reporting_name
      ,ps.name_control
      ,TO_CHAR(ps.tax_verification_date,'YYYY/MM/DD')           
      ,ps.allow_awt_flag                                        
      ,(select ZW.name from ZX_WHT_TAX_CLASSIFICATION_V ZW
      where   ZW.group_id = pos.awt_group_id)               
      ,ps.vat_code
      ,(select ZT.REP_REGISTRATION_NUMBER  from ZX_PARTY_TAX_PROFILE ZT  
           where   ZT.party_id= ps.party_id)              
      ,ps.auto_tax_calc_override
      ,ibext.payment_method_code                                
      ,ibp.delivery_channel_code                             
      ,ibp.bank_instruction1_code                             
      ,ibp.bank_instruction2_code                             
      ,ibp.bank_instruction_details                             
      ,ibp.settlement_priority
      ,ibp.payment_text_message1
      ,ibp.payment_text_message2
      ,ibp.payment_text_message3
      ,ibp.bank_charge_bearer
      ,ibp.payment_reason_code                                 
      ,ibp.payment_reason_comments                             
      ,ibp.payment_format_code                                 
  FROM poz_suppliers ps,
       poz_suppliers_v pos,
       poz_supplier_registrations psr,
   poz_suppliers_pii psi,
       hz_organization_profiles hop,
       iby_external_payees_all ibp,
       iby_ext_party_pmt_mthds ibext,
       hz_parties HP,
       hz_parties HP1,
       (SELECT party_name
              ,party_id 
          FROM hz_addtnl_party_names hap2
         WHERE hap2.party_name_type='ALIAS') ALIAS 
 WHERE 1 = 1 
   AND ps.vendor_id                                 = pos.vendor_id
   AND ps.vendor_id                                 = psr.vendor_id(+)
   and ps.vendor_id                                 = psi.vendor_id(+)
   AND hp.party_id                                  = alias.party_id(+)
   AND hp1.party_id(+)                              = ps.parent_party_id
   AND hop.party_id(+)                              = ps.party_id
   AND pos.party_id                                 = hp.party_id(+)
   AND ps.party_id                                  = hp.party_id(+) 
   AND ps.party_id                                  = ibp.payee_party_id(+)
   AND pos.party_id                                 = ibp.payee_party_id(+)
   AND ibp.ext_payee_id                             = ibext.ext_pmt_party_id(+)
   AND hp.party_id                                  = ibp.payee_party_id(+)
   AND ibp.party_site_id is null

No comments:

Post a Comment