博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

相关模块关联表

Posted on 2011-10-26 12:52  奥客  阅读(1095)  评论(0编辑  收藏  举报
--ap_invoice_distributions_all到xla_ae_lines. 到了XLA_AE_LINES后,会by科目和描述汇总.所以,不能一对一
select c.code_combination_id,
       
       h.je_header_id,
       
       l.ae_header_id,
       
       l.ae_line_num,
       
       te.source_id_int_1,
       
       te.application_id,
       
       te.entity_id,
       
       h.je_source,
       
       h.je_category,
       
       i.gl_date,
       
       s.vendor_name,
       
       s.segment1 
as supplier_no,
       
       l.event_class_code 
as event_class,
       
       i.invoice_id,
       
       ad.invoice_distribution_id,
       
       i.invoice_num 
as transaction_number,
       
       i.invoice_date,
       
       initcap(jl.description) description,
       
       jl.accounted_dr 
as debit,
       
       jl.accounted_cr 
as credit,
       
       nvl(jl.accounted_dr, 
0- nvl(jl.accounted_cr, 0) net_amount

  
from apps.gl_je_headers h,
       
       apps.gl_je_lines jl,
       
       apps.gl_code_combinations c,
       
       apps.gl_import_references r,
       
       apps.xla_ae_lines al,
       
       apps.xla_ae_headers ah,
       
       apps.xla_distribution_links l,
       
       apps.ap_invoices_all i,
       
       apps.ap_invoice_distributions_all ad,
       
       apps.ap_suppliers s,
       
       apps.xla_events e,
       
       apps.xla_transaction_entities te

 
where /*ad.invoice_id = 10194
      
   and
*/ jl.je_header_id = h.je_header_id
      
   
and jl.code_combination_id = c.code_combination_id
      
   
and al.gl_sl_link_id = r.gl_sl_link_id
      
   
and al.ae_header_id = ah.ae_header_id
      
   
and al.application_id = ah.application_id
      
   
and ah.application_id = e.application_id
      
   
and ah.event_id = e.event_id
      
   
and e.application_id = te.application_id(+)
      
   
and e.entity_id = te.entity_id(+)
      
   
and r.je_header_id = jl.je_header_id
      
   
and r.je_line_num = jl.je_line_num
      
   
and l.ae_header_id = al.ae_header_id
      
   
and l.ae_line_num = al.ae_line_num
      
   
and l.applied_to_source_id_num_1 = i.invoice_id
      
   
and l.source_distribution_id_num_1 = ad.invoice_distribution_id
      
   
and ad.invoice_id = i.invoice_id
      
   
and i.vendor_id = s.vendor_id

 
order by i.gl_date desc

posted @ 2011-01-01 11:55 郭振斌 阅读(333) 评论(0) 编辑
1 帐套:P_LEDGER_ID
值集 GL_SRS_SET_OF_BOOKS
配置文件,
默认值:GL_SET_OF_BKS_NAME

2 OU: ORG_ID
配置文件
默认值:ORG_ID

3 库存组织 P_MFG_ID
配置文件
默认值:ORGANIZATION_ID

4 会计期(默认为当前会计期):p_period_name_f
值集:GL_SRS_ALL_PERIODS
默认类型:SQL语句
默认值:select glp.period_name from gl_sets_of_books gls, gl_periods glp
           where gls.period_set_name = glp.period_set_name
           and gls.set_of_books_id = :$FLEX$.P_LEDGER_ID
           and sysdate between glp.start_date and glp.end_date

5 会计科目
第一个步骤:
   设置COE参数:
   COA
   NUMBER_15
   SQL语句
   默认值:select gls.chart_of_accounts_id from gl_sets_of_books gls
           where gls.set_of_books_id = :$FLEX$.P_LEDGER_ID

第2步:
    p_account_f
    GL_SRS_REPORT_FLEXFIELD
    范围:对

在报表里的做法:
    1定义参数P_COA
    2创建占位列:P_ACCOUNT_WHERE
    3在报表里引用占位列: &p_account_where
    4创建公式列:CF_PERIOD_NAME_F,CF_PERIOD_NAME_T (会计期间从-会计期间到)
    5在报表触发器BEFOREREPORTE里写入代码:
    begin
SRW.USER_EXIT('FND SRWINIT');

if :P_ACCOUNT_F is not null and :P_ACCOUNT_T is not null then
    srw.reference(:P_COA);
    srw.user_exit('FND FLEXSQL CODE="GL#"
                               NUM=":P_COA"
                               APPL_SHORT_NAME="SQLGL"
                               OUTPUT=":P_ACCOUNT_WHERE"
                               MODE="WHERE"
                               DISPLAY="ALL"
                               OPERATOR="BETWEEN"
                               OPERAND1=:P_ACCOUNT_T
                               OPERAND2=:P_ACCOUNT_F
                               TABLEALIAS="GCC"');
                               
    if :P_ACCOUNT_WHERE is not null then
    :P_ACCOUNT_WHERE := ' and ' || :P_ACCOUNT_WHERE;
    end if;
end if;

return (TRUE);
end;
posted @ 2011-01-01 09:17 郭振斌 阅读(285) 评论(0) 编辑
子模块和GL之间关联的变化
12i在功能模块上的变化很多,比如,基本每个模块都启用了MOAC特性,新增加了子帐模块,税模块等等很多新的模块,OPM库存和离散库存集成了。不过这些变化中,大部分不是我们需要重点关注的,不过有一个东西需要重点关注那就是子帐模块。子帐模块功能非常强大,现在所有的子模块会计分录都可以使用特定的公式配置出来。但是对技术而言,我们不太关心如何配置生成会计分录,我们只关心子模块的会计分录和GL的会计分路之间的关联性,以方便我们做子模块和GL的对应报表。然而,现在如果你要做对应报表,你就必须要了解子帐。因此,在这里重点只介绍子帐。

子帐的概念——SLA(Subledger Accounting)
概念
子帐是子分类帐会计的简称,字面上的含义就是子分类帐会计分录,但是这东西到底用来干吗的呢?!
通俗的说:
1、子分类帐会计其实就是连接子模块会计和GL凭证之间的桥梁,更简单的说,就是子模块和GL之间的桥梁。所有子模块(包括FA)产生的会计分录都是使用SLA产生的,存放在SLA的表中,然后通过过帐程序过帐到GL。有点类gl_interface表的功能。
2、子分类帐会计的第二层意思:在各个子模块都有一套独立的会计分录,看起来跟GL其实没太大区别,这就意味着在子模块其实就可以计算科目余额了。只是可惜,到目前为止我还没有类似gl_balance的表来存放科目余额。
3、各子模块目前还是可以有自己的分配帐户(就是以前查看会计科目看到的东西),分别存放在自己的分配表中,比如,AP还是存放在ap_invoices_distributions中,引入SLA后,把这个功能称为“事物处理会计”,和子分类帐会计的不同点在于,事物处理会计是通过自动会计或分配产生,而子分类帐会计是根据定义会计事件等公式产生的,分别存于不同的地方。
子帐架构

解释:
1、 子分类帐的产生有两种方式,一种方式是直接从子模块的事物处理会计,一种是直接从子模块的事物处理上取得。
2、 子模块的事物处理会计和子分类帐会计是两个不同的东西,一定要区别对待,传送到GL的是子分类帐会计,并非事物处理会计。
3、 由于子分类帐会计的来源可能是事物处理,也可能是事物处理会计,因此很可能存在差异,这是SLA目前的缺陷。
子分类帐带来的益处
1、 灵活的定义会计分录的产生规则,包括摘要,借方和贷方
2、 一个事物处理可以过帐到多个ledger(就是11i的帐簿),这给跨国集团管理多个帐簿带来很大的好处
3、 统一了子模块会计分录的存放和产生规则,也就是说,各个子模块都可以根据自身的情况设置会计规则,但是这些规则产生的会计分录都回存放在SLA的表中。
4、 利于扩展,ORACLE委托外包的子模块产生的会计分录更容易集成到EBS

SLA的几个重要关键词
SLA的关键词有很多,不过和我们写程序密切相关的应该是下面几个关键词。这几个关键词是我们弄清楚子模块和GL之间的关键。如果理解了这几关键词在SLA中的具体位置以及作用,加上SLA的的架构图,很容易的就理解了SLA作为子模块和GL的桥梁作用,对过帐程序具有深刻的理解,便于我们以后编写追溯程序以及追溯报表。
会计事件(account event)
会计事件,就是一个事物处理的不同事件类型产生的记录,它结合了主要分类帐,事件类型,事件分类。一个事物处理可能会有多个会计时间,因为一个事物处理可能发生多种动作,而每个动作都需要产生相应的会计凭证。因此,我们可以把一个会计事件看成是一张完整的凭证,我们把这张凭证录入到子模块的会计分录表里就形成了完整的会计分录。所以,我对会计事件的理解通俗归纳为以下几点:
1、 会计事件就相当于一张凭证,录入到GL就是一对会计分录
2、 同一个事物处理,比如收款可能会对应多个会计事件,因为收款创建会产生会计事件,收款核销也是一个会计事件。
查看路径:子模块超级用户/查询/会计事件
主要分类帐(leadger)
分类帐的概念在12i中表示的是帐簿,也就是11i的SOB,主要分类帐决定了过帐到哪个SOB
事件实体(EVENT ENTITY)
事件实体决定了会计分录来源,以应收为例子,事件实体决定了到底是从 “应收事物处理”过来的还是从“收款”过来的。存放在表:xla_entity_types_vl中,会计分录和事物处理关联的表是是xla_transaction_entities ,事件实体同时定义了关联的标识是哪个字段,存放在xla_entity_id_mappings,下面我会详细介绍怎么做关联。
设置路径路径:子模块超级用户/设置/会计/子分类帐会计/事件/事件模型
事件分类(EVENT CLASS)
事件分类是根据事件实体进一步区分会计分录的方法。比如,收款分为“收款”和“杂项收款”,事件分类的表为:xla_event_classes_v,属于xla_transaction_entities的子表。
设置路径路径:子模块超级用户/设置/会计/子分类帐会计/事件/事件模型
事件类型(EVENT TYPE)
事件类型是比事件分类更小的事件划分方法,每个事件分类会细分成多个事件类型。比如:收款会分成:收款已核销,收款未核销,收款已更新等等类型。存放在表:xla_event_types_vl 中。
设置路径路径:子模块超级用户/设置/会计/子分类帐会计/事件/事件模型

SLA&GL关系模型
关联模型中,实际参与的表很多,我们只拿最重要的表来描述,以便大家入门,不至于摸不着头脑,力求简单。
基础事件关系图
xla_entity_types_vl(事件实体)
|――xla_entity_id_mappings(实体ID对应表)
|――xla_event_classes_v(事件分类)
   |――xla_event_types_vl(事件类型)
子分类帐关系图
xla_transaction_entities(会计事物处理实体)
|――xla_events(会计事件)
|――xla_ae_headers(子帐头)
   |――xla_ae_lines(子帐行)
   |――xla_distribution_links(关联事物处理信息)
子模块和GL关系图
gl_import_references(总帐参考)
  |(gl_sl_link_id,gl_sl_link_table)
xla_ae_lines(子帐行)
说明:GL和子模块之间的关联是通过gl_import_reference实现的,关键字段是gl_sl_link_id,gl_sl_link_table。

GL->子模块追溯
伪代码
begin
    --根据GL信息找到相关的ae_header_id,ae_line_num,je_source
    --特别注意,这里可能存在一对多关系
    --一对多在业务上表现为汇总过帐
    select xal.ae_header_id,xal.ae_line_num,jh.je_source
    from gl_je_lines jl,
        gl_je_headers jh,
        gl_import_references gir,
        xla_ae_lines xal
    where jl.je_header_id=gir.je_header_id
        and jh.je_header_id=jl.je_header_id
        and jl.je_line_num=gir.je_line_num
        and gir.gl_sl_link_id=xal.gl_sl_link_id
        and gir.gl_sl_link_table=xal.gl_sl_link_table
        and jl.je_header_id=:1
        and jl.je_line_num=:2
    --根据je_header_id找到相应的会计实体,主要是需要实体代码和几个source_id
    --通过source_id....和entity_code的组合判断,可以准确的追溯到具体的事物处理
    select xte.entity_code
        ,xte.source_id_int_1
        ,......
        ,xte.source_id_char_1
        ,......
        ,xte.security_id_int_1
        ,xte.security_id_int_2
        ......
    from xla.xla_transaction_entities xte,
        xla_ae_headers xah
    where xah.ae_header_id=:1
        and xte.entity_id=xah.entity_id
        and xte.application_id=xah.application_id
    --根据日记帐来源查询xla_subledgers表获得drilldown的程序
    --由于这部分是写死的,因此,对程序员来说,只能做参考
    --至于怎么写的灵活和通用,还需要参考琢磨写成一个通用的动态SQL
    select xs.drilldown_procedure_name
    from xla.xla_subledgers xs
    where xs.je_source_name=:je_source_name
        and xs.application_id=:application_id
    --上面的信息查询出来后,组合成一个动态SQL,返回一个准确的结果集
    --当然,通常情况下,我们都没有考虑写成通用程序,因此可以写死是
    --哪些会计事件,会计实体代码
END;

一个简单的列子(收款和总帐凭证对应报表,简单写死事件实体)
SELECT CR.CASH_RECEIPT_ID    CASH_RECEIPT_ID,
     CR.DOCUMENT_NUMBER    GATHER_NUM,
     JH.DOC_SEQUENCE_VALUE DOC_SEQUENCE_VALUE,
     CR.CUSTOMER_NAME      CUSTOMER_NAME,
     CR.REMIT_BANK_BRANCH BANK_NAME,
     CR.REMIT_BANK_ACCOUNT BANK_ACCOUNT,
     CR.RECEIPT_NUMBER     RECEIPT_NUMBER,
     CR.AMOUNT             AMOUNT,
     CR.STATE_DSP          STATE_DSP,
     H.EVENT_TYPE_CODE     EVENT_TYPE_CODE
FROM XLA_AE_LINES                 L,
     XLA_AE_HEADERS               H,
     XLA.XLA_TRANSACTION_ENTITIES TE,
     GL_IMPORT_REFERENCES         IR,
     GL_JE_HEADERS                JH,
     AR_CASH_RECEIPTS_V           CR
WHERE CR.CASH_RECEIPT_ID = TE.SOURCE_ID_INT_1(+)
    AND CR.CURRENCY_CODE = P_CURRENCY
    AND TE.ENTITY_CODE(+) = 'RECEIPTS'
    AND TE.ENTITY_ID = H.ENTITY_ID(+)
    AND TE.APPLICATION_ID = H.APPLICATION_ID(+)
    AND H.AE_HEADER_ID = L.AE_HEADER_ID(+)
    AND H.APPLICATION_ID = L.APPLICATION_ID(+)
    AND L.GL_SL_LINK_TABLE = IR.GL_SL_LINK_TABLE(+)
    AND L.GL_SL_LINK_ID = IR.GL_SL_LINK_ID(+)
    AND IR.JE_HEADER_ID = JH.JE_HEADER_ID(+)
    AND L.AE_LINE_NUM(+) = 1
    AND H.ACCOUNTING_ENTRY_STATUS_CODE(+) = 'F'
    AND H.ACCOUNTING_DATE BETWEEN TRUNC(P_START_DATE) AND (TRUNC(P_END_DATE) + 86399 / 86400)

SLA总结
通过上面的介绍,我们现在应该至少了解到了如下知识点:
1、SLA的简单架构,在12i中SLA扮演什么角色?
2、SLA的几个关键词,并且知道如何从界面上找到他们?
3、 SLA几个表的关系模型,以及和GL的关系模型?怎样从子模块找到GL的凭证,怎样从GL追溯到子模块?
由于SLA非常复杂,因此在这里这点篇幅不能全部介绍完,我只是站在技术的角度来看SLA,看我们到底要做些什么变化。
posted @ 2011-01-01 09:12 郭振斌 阅读(407) 评论(0) 编辑
客户表/联系人/PARTY关联
   HZ_PARTIES

客户账户表
   HZ_CUST_ACCOUNTS

例子:

   select hp.party_number --客户注册标识
         ,
          hp.party_name 
--组织名/客户
         ,
          hp.known_as 
--别名
         ,
          hp.organization_name_phonetic 
--名称拼音
         ,
          acc.account_number 
--帐号
         ,
          flv_sale.meaning sales_channel_code 
--销售渠道
         ,
          acc.account_name 
--账记说明
         ,
          flv_customer.meaning customer_class_code 
--分类
         ,
          acc.orig_system_reference 
--参考
         ,
          flv_status.meaning status 
--状态
         ,
          flv_type.meaning customer_type 
--账户类型
         ,
          acc.attribute_category 
--上下文
         ,
          acc.attribute1 
--注册
         ,
          acc.attribute2 
--人员推广
         ,
          acc.attribute3 
--特殊要求
         ,
          acc.attribute4 
--发货单是否打印价格
         ,
          acc.attribute5 
--所属利润
     from hz_parties        hp,
          hz_cust_accounts  acc,
          fnd_lookup_values flv_sale 
--销售渠道
         ,
          fnd_lookup_values flv_customer 
--分类
         ,
          fnd_lookup_values flv_status 
--状态
         ,
          fnd_lookup_values flv_type 
--账户类型
    where hp.party_id = acc.party_id
      
and acc.sales_channel_code = flv_sale.lookup_code
      
and flv_sale.lookup_type = 'SALES_CHANNEL'
      
and flv_sale.language = userenv('LANG')
      
and acc.customer_class_code = flv_customer.lookup_code
      
and flv_customer.lookup_type = 'CUSTOMER CLASS'
      
and flv_customer.language = userenv('LANG')
      
and acc.status = flv_status.lookup_code
      
and flv_status.lookup_type = 'HZ_CPUI_REGISTRY_STATUS'
      
and flv_status.language = userenv('LANG')
      
and acc.customer_type = flv_type.lookup_code
      
and flv_type.lookup_type = 'CUSTOMER_TYPE'
      
and flv_type.language = userenv('LANG')
      
and hp.party_id = hz_parties.party_id;

帐户配置文件
   HZ_CUSTOMER_PROFILES
   字段
   cust_account_role_id  --oe_order_headers.sold_to_contract_id
   cust_account_id
   site_use_id    --客户头的该字段为空
                  --客户地点层为hz_cust_site_uses_all.site_use_id

配置文件金额
   HZ_CUST_PROFILE_AMTS   --客户头层/客户地点层
   关联:hz_customer_profiles.cust_account_profile_id

客户联系人
   HZ_CUST_ACCOUNT_ROLES    --客户头层/地点层
   cust_account_id
   cust_acct_site_id    --头层该字段为空
   party_id             --类型为 PARTY_RELATIONSHIP 的 PARTY_ID
   role_type            --CONTACT
   以头层的联系人为例

   select hp_per.*
     
from hz_cust_account_roles rol,
          hz_parties            hp_rel,
          hz_relationships      rel,
          hz_parties            hp_per
    
where rol.party_id = hp_rel.party_id
      
and hp_rel.party_id = rel.party_id
      
and rel.object_type = 'PERSON'
      
and rel.relationship_code = 'CONTACT'
      
and rel.object_id = hp_per.party_id
      
and rol.cust_acct_site_id is null --头层
      and rol.cust_account_id = hz_cust_accounts.cust_account_id;

联系方式
   HZ_CONTACT_POINTS
   字段
   owner_table_name   HZ_PARTIES/HZ_PARTY_SITES
   owner_table_id     PARTY_ID/PARTY_SITE_ID
   客户地点层的联系方式,直接用party_site_id 关联 owner_table_id 即可
   客户头层的联系方式,要用 HZ_RELATIONSHIPS 表转换一下,与 hz_relationships.party_id 关联
   客户联系人下面的联系方式,要用HZ_CUST_ACCOUNT_ROLES的PARTY_ID关联owner_table_id
   例子:
   客户头层

   
   
select con.*
     
from hz_parties        hp,
          hz_relationships  rel,
          hz_contact_points con
    
where hp.party_id = rel.subject_id
      
and rel.subject_type = 'ORGANIZATION'
      
and rel.party_id = con.owner_table_id
      
and con.owner_table_name = 'HZ_PARTIES'
      
and hp.party_id = hz_parties.party_id;
   --客户地点层
   select *
     
from hz_contact_points con
    
where con.owner_table_id = hz_party_sites.party_site_id;
   
--客户联系人下的联系方式
   select *
     
from hz_contact_points c
    
where c.owner_table_id = hz_cust_account_roles.party_id
    
  
客户的税
   HZ_CODE_ASSIGNMENTS    会计分类/客户头层/地点层
   字段
   OWNER_TABLE_NAME   关联表名/'ZX_PARTY_TAX_PROFILE'
   OWNER_TABLE_ID     关联表主键/PARTY_TAX_PROFILE_ID
   CLASS_CODE         会计分类代码
   
   ZX_PARTY_TAX_PROFILE   供应商的税的配置文件
   字段
   PARTY_TYPE_CODE         类型   THIRD_PARTY/THIRD_PARTY_SITE
   PARTY_ID                关联表 HZ_PARTIES/HZ_PARTY_SITES
                            头层: PARTY_TYPE_CODE = 'THIRD_PARTY'
                             AND PARTY_ID = HZ_PARTIES.PARTY_ID
                          地点层: PARTY_TYPE_CODE = 'THIRD_PARTY_SITE'
                             AND PARTY_ID = HZ_PARTY_SITES.PARTY_SITE_ID
   REP_REGISTRATION_NUMBER 纳税登记编号  
   PARTY_TAX_PROFILE_ID    主键
   HZ_CLASS_CODE_DENORM   会计分类描述
   
   ZX_EXEMPTIONS          客户免税/ 客户头层/地点层
   字段
   PARTY_TAX_PROFILE_ID   关联  ZX_PARTY_TAX_PROFILE.PARTY_TAX_PROFILE_ID

客户地点
   HZ_PARTY_SITES

地点地址
   HZ_LOCATIONS

客户地点帐户表
   HZ_CUST_ACCT_SITES_ALL

客户地点业务目的
   HZ_CUST_SITE_USES_ALL

滞纳费用
   HZ_CUSTOMER_PROFILES
--由销售订单分析客户结构
select h.sold_from_org_id, --业务实体/ORG ID
       h.sold_to_org_id, --客户
       h.ship_from_org_id, --发货仓库
       h.ship_to_org_id, --收货方
       h.invoice_to_org_id,
       h.sold_to_contact_id
  
from oe_order_headers_all h;--业务实体 
select org.name
  
from hr_organization_units org
 
where org.organization_id = oe_order_headers_all.sold_from_org_id;   
 
--客户
select hz.party_name
  
from hz_cust_accounts acc,
       hz_parties       hz
 
where acc.party_id = hz.party_id
   
and acc.cust_account_id = oe_order_headers_all.sold_to_org_id; 
   
--发货仓库
select para.organization_code,
       para.
*
  
from mtl_parameters para
 
where para.organization_id = oe_order_headers_all.ship_from_org_id;

select *
  
from org_organization_definitions org
 
where org.organization_id = oe_order_headers_all.ship_from_org_id;
 
--地点详细信息
select loc.*
  
from hz_parties     hp,
       hz_party_sites hps,
       hz_locations   loc
 
where hp.party_id = hps.party_id
   
and hps.location_id = loc.location_id
   
and hp.party_id = 5042;
   
--业务目的
select hp.party_name --客户
      ,
       hp.party_number 
--注册表标识
      ,
       uses.site_use_code,
       acnt.account_number 
--账号
      ,
       flv.meaning businesspurpose 
--业务目的
      ,
       uses.location 
--地点
      ,
       acnt.account_name 
--帐户说明
      ,
       decode(loc.address1, 
null, loc.address1, loc.address1 || ','||
       decode(loc.city, 
null, loc.city, loc.city || ','||
       decode(loc.state, 
null, loc.state, loc.state || ','||
       decode(loc.postal_code, 
null' ', loc.postal_code) address --地点地址
      ,
       hps.party_site_number 
--地点说明
      ,
       uses.payment_term_id 
--付款条件
      ,
       site.cust_acct_site_id,
       acnt.cust_account_id,
       uses.site_use_id
  
from hz_parties             hp,
       hz_cust_accounts       acnt,
       hz_cust_acct_sites_all site,
       hz_cust_site_uses_all  uses,
       hz_party_sites         hps,
       hz_locations           loc,
       fnd_lookup_values      flv
 
where hp.party_id = acnt.party_id
   
and acnt.cust_account_id = site.cust_account_id
   
and site.cust_acct_site_id = uses.cust_acct_site_id
   
and hps.party_site_id = site.party_site_id
   
and loc.location_id = hps.location_id
   
and uses.site_use_code = flv.lookup_code
   
and flv.lookup_type = 'SITE_USE_CODE'
   
and flv.language = userenv('LANG')
   
and hp.party_id = 5042
   
and hps.party_site_id = 3023;
   
--联系人电话/地点层
select phone.phone_number
  
from hz_contact_points phone
 
where phone.owner_table_name = 'HZ_PARTY_SITES'
   
and phone.owner_table_id = :hz_party_sites.party_sites_id;
   
--联系人/地点层
select hpsub.party_name
  
from hz_cust_account_roles hcar,
       hz_relationships      hr,
       hz_parties            hpsub
 
where hcar.party_id = hr.party_id
   
and hr.subject_id = hpsub.party_id
   
and hcar.role_type = 'CONTACT'
   
and hr.directional_flag = 'F'
   
and hcar.cust_account_role_id = :oe_order_headers_all.sold_to_contact_id
   
and hpsub.status = 'A';

posted @ 2011-01-01 09:07 郭振斌 阅读(743) 评论(0) 编辑
select hou.organization_id ou_org_id, --org_id     
       hou.name ou_name, --ou名称     
       ood.organization_id org_org_id, --库存组织id     
       ood.organization_code org_org_code, --库存组织代码      
       msi.secondary_inventory_name, --子库存名称     
       msi.description --子库存描述     
  from hr_organization_information  hoi, --组织分类表     
       hr_operating_units           hou, --ou视图       
       org_organization_definitions ood, --库存组织定义视图     
       mtl_secondary_inventories    msi --子库存信息表     
 where hoi.org_information1 = 'OPERATING_UNIT'
   
and hoi.organization_id = hou.organization_id
   
and ood.operating_unit = hoi.organization_id
   
and ood.organization_id = msi.organization_id

posted @ 2011-01-01 08:55 郭振斌 阅读(340) 评论(0) 编辑

1. 销售订单传送应收帐款的接口需要运行的请求

请求名称:工作流后台流程

参数:

项目类型:OM订单行

处理延迟:是

处理超时:否

 处理停滞:否

 

2. 应收帐款传送到总帐系统

请求名称:总账管理系统传送程序

 

 

3.  应付账款传送到总账系统

请求名称:将应付账款传送至总账

 

4. 所有库存操作必需运行成本管理器后,才会出现会计分录

设置->事务处理->接口管理器     (成本管理器   ---  工具->启动管理器)

 

5. 库存模块数据传送至总账系统

请求名称:将事务处理转至GL

posted @ 2011-01-01 08:53 郭振斌 阅读(197) 评论(0) 编辑
模块: WIP

相关表:inv.mtl_material_transactions 物料事务处理表 (transaction_source_id 与 we.wip_entity_id 连接)

            inv.mtl_transaction_lot_numbers  物料事务处理批次号表(transaction_id 与 mmt.transaction_id 连接)

            inv.mtl_system_items_b   物料表 (inventory_item_id与mmt.inventory_item_id连接)

            wip.wip_entities               离散任务表 (包括任务名称,可用wip_entity_id与wip_discrete_jobs 离散任务明细表的WIP_ENTITY_ID相连接)

其他:来源类型 - Job or Schedule     MMT.TRANSACTION_SOURCE_TYPE_ID

         事务处理类型 - WIP Completion    MMT.TRANSACTION_TYPE_ID

SQL:

select mmt.organization_id,
       mmt.transaction_id,
       mmt.transaction_type_id,
       msi.segment1 item_no,
       msi.description,
       mtl.lot_number,
       mmt.subinventory_code,
       mmt.locator_id,
       mmt.transaction_uom,
       nvl(mtl.transaction_quantity, mmt.transaction_quantity) transaction_quantity,
       we.wip_entity_name transaction_source,
       trunc(mmt.transaction_date) transaction_date,
       mmt.transaction_reference
  
from inv.mtl_material_transactions   mmt,
       inv.mtl_transaction_lot_numbers mtl,
       inv.mtl_system_items_b          msi,
       wip.wip_entities                we
 
where mmt.transaction_id = mtl.transaction_id(+)
   
and mmt.organization_id = mtl.organization_id(+)
   
and mmt.organization_id = msi.organization_id
   
and mmt.inventory_item_id = msi.inventory_item_id
   
and mmt.transaction_type_id in (4417)
   
and mmt.transaction_source_id = we.wip_entity_id
   
and mmt.organization_id = we.organization_id
   
and mmt.organization_id = :p_org_id
   
and (trunc(mmt.transaction_date) >= trunc(:fm_date) or :fm_date is null)
   
and (trunc(mmt.transaction_date) <= trunc(:to_date) or :to_date is null)
 
order by msi.segment1

posted @ 2011-01-01 08:43 郭振斌 阅读(389) 评论(0) 编辑
模块:AP

相关表:AP.AP_INVOICES_ALL   AIA  发票头

            AP.AP_INVOICE_LINES_ALL  AIL 发票行

            APPS.PO_VENDORS   供应商

            PO.PO_HEADERS_ALL   采购头

            RCV_SHIPMENT_HEADERS   RSH 接收事务头

            RCV_SHIPMENT_LINES         RSL 接收事务行

其他:接收事务与发票连接,  AIL.RCV_SHIPMENT_LINE_ID = RSL.SHIPMENT_LINE_ID(+)
  AND RSL.SHIPMENT_HEADER_ID = RSH.SHIPMENT_HEADER_ID(+)

SQL:

select aia.invoice_num,
       aia.invoice_date,
       aia.creation_date,
       aia.vendor_id,
       aia.invoice_currency_code,
       ail.amount,
       ail.base_amount,
       aia.description,
       decode(ail.base_amount,
              
null,
              
1,
              
round(ail.base_amount / ail.amount, 4)),
       ail.inventory_item_id,
       ail.quantity_invoiced,
       ail.unit_price,
       ail.amount,
       ail.base_amount,
       ail.rcv_transaction_id,
       msi.segment1,
       msi.description,
       rsh.receipt_num,
       pha.segment1,
       pv.vendor_name,
       rsl.quantity_received
  
from ap.ap_invoices_all      aia,
       ap.ap_invoice_lines_all ail,
       po.po_headers_all       pha,
       apps.po_vendors         pv,
       inv.mtl_system_items_b  msi,
       rcv_shipment_headers    rsh, 
--接收头
       rcv_shipment_lines      rsl --接收行
 where aia.invoice_id = ail.invoice_id
   
and ail.po_header_id = pha.po_header_id(+)
   
and aia.vendor_id = pv.vendor_id
   
and ail.inventory_item_id = msi.inventory_item_id(+)
   
and ail.org_id = msi.organization_id(+)
   
and ail.rcv_shipment_line_id = rsl.shipment_line_id(+)
   
and rsl.shipment_header_id = rsh.shipment_header_id(+)
   
and ail.line_type_lookup_code = 'ITEM'