EBS客户相关信息查询

SELECT hou.name 业务实体,
       hp.party_name 客户名称,
       hca.account_number 客户编号,
       hp.tax_reference 纳税编号,
       hca.attribute1 客户集团,
       aa.status 有效否,
       to_char(bb.creation_date, 'YYYY-MM-DD') 创建日期,
       bb.bill_to_flag 收单标示,
       bb.ship_to_flag 收货标示,
       cc.country 国家,
       cc.address1 地点名称,
       dd.site_use_id 地点编号,
       dd.site_use_code,
       dd.primary_flag,
       dd.status,
       dd.location 业务目的编号,
       dd.bill_to_site_use_id 收单地id,
       rt.name 付款条件,
       gcc.concatenated_segments 应收科目,
       gcc01.concatenated_segments 收入科目,
       dd.tax_code 税码,
       (SELECT res.resource_name
          FROM jtf_rs_salesreps sr, jtf_rs_resource_extns_vl res
         WHERE sr.resource_id = res.resource_id
           AND sr.org_id = dd.org_id
           AND sr.salesrep_id = dd.primary_salesrep_id) 销售员
  FROM hz_parties               hp,
       hz_party_sites           aa,
       hz_cust_acct_sites_all   bb,
       hz_locations             cc,
       hz_cust_site_uses_all    dd,
       hr_operating_units       hou,
       ra_terms_vl              rt,
       hz_cust_accounts         hca,
       gl_code_combinations_kfv gcc,
       gl_code_combinations_kfv gcc01
 WHERE aa.party_site_id = bb.party_site_id
   AND hca.party_id = hp.party_id
   AND aa.status = 'A'
   AND rt.term_id = dd.payment_term_id
   AND hou.organization_id = bb.org_id
   AND hp.party_id = aa.party_id
   AND aa.location_id = cc.location_id
   AND bb.cust_acct_site_id(+) = dd.cust_acct_site_id
   AND dd.status <> 'I'
   AND gcc.code_combination_id(+) = dd.gl_id_rec
   AND gcc01.code_combination_id(+) = dd.gl_id_rev
      –AND hou.name = 'OU'
      –条件1:客户对应的OU,选择目标OU
   AND to_char(bb.creation_date, 'yyyy-mm-dd') >= '2000-01-01'
      –条件2:供应商创建对应的起始日期,选择创建日期范围,如不需限制,请注释该条件
 —  AND to_char(bb.creation_date, 'yyyy-mm-dd') <= '2015-12-08'
–条件2:供应商创建对应的截止日期,选择创建日期范围,如不需限制,请注释该条件

发表回复

您的电子邮箱地址不会被公开。