zoukankan      html  css  js  c++  java
  • oracle ebs 笔记

    select a.responsibility_name,
           b.prompt,
           f.user_concurrent_program_name
      
    from fnd_responsibility_vl      a,
           fnd_menu_entries_vl        b,
           fnd_form_functions_vl      c,
           fnd_request_groups         d,
           fnd_request_group_units    e,
           fnd_concurrent_programs_vl f
     
    where a.menu_id = b.menu_id
       
    and b.function_id = c.function_id
       
    and c.parameters like '%' || d.request_group_code || '%'
       
    and d.application_id = e.application_id
       
    and d.request_group_id = e.request_group_id
       
    and e.unit_application_id = f.application_id
       
    and e.request_unit_id = f.concurrent_program_id
       
    and f.user_concurrent_program_name like '%杂项出入库报表%'

    posted @ 2011-10-14 23:59 江南一陈风 阅读(11) 评论(0) 编辑

    select poh.segment1 po单据号,
           
           poh.creation_date,
           
           pov.vendor_name 供应商,
           
           
    --hl_po_utl_pkg.get_location_code(poh.ship_to_location_id) 收货方,
           
           
    --hl_po_utl_pkg.get_location_code(poh.bill_to_location_id) 收单方,
           
           poh.currency_code 币种,
           
           hr_general.decode_person_name(poh.agent_id) 采购员,
           
           po_headers_sv3.get_po_status(poh.po_header_id) 状态,
           
           hl_po_utl_pkg.get_po_amount(poh.po_header_id, poh.currency_code) 合计,
           
           poh.comments 摘要,
           
           pol.line_num 编号,
           
           po_line_types_sv.get_line_type(pol.line_type_id) 类型,
           
           
    --hl_po_utl_pkg.get_item_desc(pol.item_id, pll.ship_to_organization_id) 料号,
           
           pol.item_description 摘要,
           
           cat.concatenated_segments 类别,
           
           pol.unit_meas_lookup_code 单位,
           
           pol.quantity 数量,
           
           pol.unit_price 价格,
           
           
    --hl_po_utl_pkg.format_precision(pol.quantity * unit_price,poh.currency_code) 金额,
           
           gcc.concatenated_segments 借记账户,
           
           pod.gl_encumbered_date gl_日期

      
    from po_headers_all poh,
           
           po_lines_all pol,
           
           po_line_locations_all pll,
           
           hr_locations_all hl,
           
           po_distributions_all pod,
           
           po_vendors pov,
           
           mtl_system_items_vl mst,
           
           mtl_categories_b_kfv cat,
           
           gl_code_combinations_kfv gcc

     
    where poh.po_header_id = pol.po_header_id
          
       
    and pol.po_line_id = pll.po_line_id
          
       
    and hl.location_id(+= pll.ship_to_location_id
          
       
    and pod.line_location_id = pll.line_location_id
          
       
    and poh.vendor_id = pov.vendor_id(+)
          
       
    and pol.item_id = mst.inventory_item_id(+)
          
       
    and pol.org_id = mst.organization_id(+)
          
       
    and pol.category_id = cat.category_id(+)
          
       
    and gcc.code_combination_id(+= pod.code_combination_id

    posted @ 2011-10-14 23:58 江南一陈风 阅读(11) 评论(0) 编辑

    ---查询请购单的状态

    select *
      
    from po_requisition_headers_all por
     
    where por.requisition_header_id = 63578;
     
    ---修改请购单状态为未提交审批

    update po_requisition_headers_all porh
       
    set porh.authorization_status = 'INCOMPLETE'
     
    where porh.requisition_header_id = 63578;
     
    ---查询采购单状态

    select *
      
    from po_headers_all aa
     
    where aa.po_header_id in (204302043120306); 

    ---修改采购单状态为未审批

    update po_headers_all aa
       
    set aa.wf_item_type         = null,
           aa.wf_item_key          
    = null,
           aa.approved_flag        
    = null,
           aa.authorization_status 
    = null
     
    where aa.po_header_id in (2043020431);

    posted @ 2011-10-14 23:58 江南一陈风 阅读(11) 评论(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-10-14 23:56 江南一陈风 阅读(10) 评论(0) 编辑

    在ap_invoice_distributions_all中有时rcv_transaciton_id为空,有时却又是有值的, 这是为什么呢?(请参考po_line_locations_all.match_option)

     
     
    或许你还记得我们在发票工作台上选择匹配时,有时是 Match PO,有时却是Match Receipt,其实这就是原因所在, 当然影响这个匹配项的根本还是PO的shipment上的一个开关:是Receipt,还是Purchase Order,如果这里是Receipt,在匹配PO时,只能选择Receipt(匹配成功保存后rcv_transaciton_id是有值),反之在匹配值只能选择Purchase Order(匹配成功保存后rcv_transaciton_id是没有值)
     
    其实在这个ap_invoice_distributions_all还有个po_distribution_id字段,不管rcv_transaciton_id是否为空,只要是和PO建立关系的,po_distribution_id字段总归是有值的.
     
     
    现有这样的需求:查询----发票号码,接收号码,采购订单号码
    (我总是会使用po_distribution_id作为条件,而不要使用rcv_transaciton_id)
    ----------------------------------------
     
    select ai.invoice_num,
           rsh.receipt_num,
           ph.segment1,
           aid.distribution_line_number,
           aid.rcv_transaction_id,
           aid.po_distribution_id
      
    from ap_invoices_all              ai,
           ap_invoice_distributions_all aid,
           po_distributions_all         pd,
           rcv_transactions             rt,
           rcv_shipment_lines           rsl,
           rcv_shipment_headers         rsh,
           po_headers_all               ph
     
    where ai.invoice_id = aid.invoice_id
       
    and aid.set_of_books_id = '&sob'
       
    and aid.period_name = '&period_name'
       
    and aid.po_distribution_id = pd.po_distribution_id
       
    and pd.po_distribution_id = rt.po_distribution_id
       
    and rt.po_distribution_id = rsl.po_distribution_id
       
    and rsl.shipment_line_id = rt.shipment_line_id
       
    and rsh.shipment_header_id = rsl.shipment_header_id
       
    and rt.destination_type_code = 'RECEIVING'
       
    and rt.po_header_id = ph.po_header_id
     
    order by 1,
              
    2
    posted @ 2011-10-14 23:55 江南一陈风 阅读(15) 评论(0) 编辑

    首先,对于EBS中的法人实体和分类账以及OU之间的一个层次关系如下图:

    其中,对于分类账和法人实体,并不简单是一对多的关系,按照理论上来讲:由于分类账存在辅助分类账,所以一个法人实体除了对应一个主分类账(Primary Ledger)外,还可能存在辅助分类账,但是一个法人实体肯定只对应一个唯一的主分类账,而对于分类账之间是否存在有“主从关系”还不太清楚,有待进一步考证。

    而在R12中,要找出他们之间的关系就需要通过一下sql来看了:

    复制代码
     
    SELECT lg.ledger_id,
           lg.NAME ledger_name,
           lg.short_name ledger_short_name,
           cfgdet.
    object_id legal_entity_id,
           le.NAME legal_entity_name,
           reg.location_id location_id,
           hrloctl.location_code location_code,
           hrloctl.description location_description,
           lg.ledger_category_code,
           lg.currency_code,
           lg.chart_of_accounts_id,
           lg.period_set_name,
           lg.accounted_period_type,
           lg.sla_accounting_method_code,
           lg.sla_accounting_method_type,
           lg.bal_seg_value_option_code,
           lg.bal_seg_column_name,
           lg.bal_seg_value_set_id,
           cfg.acctg_environment_code,
           cfg.configuration_id,
           rs.primary_ledger_id,
           rs.relationship_enabled_flag
      
    FROM gl_ledger_config_details primdet,
           gl_ledgers               lg,
           gl_ledger_relationships  rs,
           gl_ledger_configurations cfg,
           gl_ledger_config_details cfgdet,
           xle_entity_profiles      le,
           xle_registrations        reg,
           hr_locations_all_tl      hrloctl
     
    WHERE rs.application_id = 101
       
    AND ((rs.target_ledger_category_code = 'SECONDARY' AND
           rs.relationship_type_code 
    <> 'NONE'OR
           (rs.target_ledger_category_code 
    = 'PRIMARY' AND
           rs.relationship_type_code 
    = 'NONE'OR
           (rs.target_ledger_category_code 
    = 'ALC' AND
           rs.relationship_type_code 
    IN ('JOURNAL''SUBLEDGER')))
       
    AND lg.ledger_id = rs.target_ledger_id
       
    AND lg.ledger_category_code = rs.target_ledger_category_code
       
    AND nvl(lg.complete_flag, 'Y'= 'Y'
       
    AND primdet.object_id = rs.primary_ledger_id
       
    AND primdet.object_type_code = 'PRIMARY'
       
    AND primdet.setup_step_code = 'NONE'
       
    AND cfg.configuration_id = primdet.configuration_id
       
    AND cfgdet.configuration_id(+= cfg.configuration_id
       
    AND cfgdet.object_type_code(+= 'LEGAL_ENTITY'
       
    AND le.legal_entity_id(+= cfgdet.object_id
       
    AND reg.source_id(+= cfgdet.object_id
       
    AND reg.source_table(+= 'XLE_ENTITY_PROFILES'
       
    AND reg.identifying_flag(+= 'Y'
       
    AND hrloctl.location_id(+= reg.location_id
       
    AND hrloctl.LANGUAGE(+= userenv('LANG');
    复制代码

    从数据结果中可以看出,系统中有7个分类账(LEDGER)和5个法人实体(LEGAL_ENTITY),对于TCL_YSP这个法人实体来说,拥 有两个分类账,其LEDGER_CATEGORY_CODE分别为PRIMARY和SECONDARY,说明了一个法人实体有一个主分类账,并且可以有辅 助分类账,而2041这个分类账,则没有对应的法人实体,但是其LEDGER_CATEGORY_CODE依然为PRIMARY,这说明一个分类账的 category_code有可能是事前定义好的,而不是在与法人实体关联的时候才决定的,所以不能确定分类账之间到底有层次关系……

    对以上的sql进行精简,也可以得出相应的关系来:

    select lg.ledger_id, --分类帐
           cfgdet.object_id legal_entity_id, --法人实体    
           lg.currency_code,
           lg.chart_of_accounts_id,
           rs.primary_ledger_id
      from gl_ledger_config_details primdet,
           gl_ledgers               lg,
           gl_ledger_relationships  rs,
           gl_ledger_configurations cfg,
           gl_ledger_config_details cfgdet
    where rs.application_id = 101  --101为总账GL应用
       and ((rs.target_ledger_category_code = 'SECONDARY' and
           rs.relationship_type_code <> 'NONE') or
           (rs.target_ledger_category_code = 'PRIMARY' and
           rs.relationship_type_code = 'NONE') or
           (rs.target_ledger_category_code = 'ALC' and
           rs.relationship_type_code in ('JOURNAL', 'SUBLEDGER')))
       and lg.ledger_id = rs.target_ledger_id
       and lg.ledger_category_code = rs.target_ledger_category_code
       and nvl(lg.complete_flag, 'Y') = 'Y'
       and primdet.object_id = rs.primary_ledger_id
       and primdet.object_type_code = 'PRIMARY'
       and primdet.setup_step_code = 'NONE'
       and cfg.configuration_id = primdet.configuration_id
       and cfgdet.configuration_id(+) = cfg.configuration_id
       and cfgdet.object_type_code(+) = 'LEGAL_ENTITY';

    posted @ 2011-10-14 23:54 江南一陈风 阅读(21) 评论(0) 编辑

    --Oracle多行数据合并一行.sql
    --1.
    CREATE TYPE NUMBER_LIST_T AS TABLE OF varchar2(50);     
    --2.   
    CREATE OR REPLACE FUNCTION CONCAT_LIST (
       lst IN number_list_t, separator varchar2
    )
    RETURN VARCHAR2 IS
    ret varchar2(2000);
    BEGIN
    FOR j IN 1..lst.LAST LOOP
    ret := ret || separator || lst(j);
    END LOOP;

    RETURN ret;
    END;
     
    --3.  
    CREATE OR REPLACE FUNCTION getUserRoles (
       userid in varchar2
    )
    RETURN VARCHAR2 IS
    rtl varchar2(2000);
    BEGIN
      SELECT Substr(CONCAT_LIST(LST, ','),2) into rtl from (
        SELECT
        CAST(MULTISET(
        SELECT trim(f_name) AS f_name FROM
           (select u.userid as f_id,r.rolename as f_name from base_role r, base_user_roles u where r.roleid=u.roleid) e
        WHERE e.f_id=m.f_id )
        AS number_list_t) LST
        FROM
           (select u.userid as f_id,r.rolename as f_name from base_role r, base_user_roles u where r.roleid=u.roleid) m
        where m.f_id = userid
        group by m.f_id
      );
      return(rtl);
    END;
    --select u.*, getUserRoles(u.userid) from base_user u

    posted @ 2011-10-14 23:53 江南一陈风 阅读(52) 评论(0) 编辑
    UTL_FILE 是用来进行文件IO处理的专用包,使用这外包的注意事项如下:
    1. 生成的文件好象只能放置在DATABASE所在的服务器路径中.
    2. 生成的文件如何DOWNLOAD到本地来,还有待研究.
     
    Coding步骤:
    1. 注册文件输出路径
        Create directory path[例如: C:\AA] as 'pathname';
        此命令应由数据库管理员建立,目录需要赋予相应的读写权限.
    2. 定义文件变量
        v_filename    utl_file.file_type;
    3. 建立/打开文件
        v_filename := utl_file.fopen(' pathname ' , ' filename ', 'w');
    4. 写入内容
        utl_file.put_line(v_filename, v_string[存储待写入的内容]);
    5. 关闭文件
        utl_file.fclose(v_filename);
    6. 读取文件
        v_filename := utl_file.fopen(' pathname ',' filename ', 'r');
        utl_file.get_line(v_filename, v_string[接收内容]);
    posted @ 2011-10-14 23:52 江南一陈风 阅读(21) 评论(0) 编辑

    分组最大值记录

    比如
        序号          名称       数量       
           1              A        20
           2              A        10
           1              B        20
           2              B        40
           3              B        10
           1              C        20
           2              C        40
    子查询:

    select * from 表 where (序号,名称) in (select max(序号),名称 from 表 group by 名称)

     分析函数:

    select 序号   ,       名称     ,  数量 from 
    (select    序号   ,       名称     ,  数量 
    ,row_number() over(partition by 名称 order by 序号  desc ) rn
    form tab_name )
    where rn=1


    select 序号   ,       名称     ,  数量 from 
    (select    序号   ,       名称     ,  数量 
    , max(序号) over(partition by 名称) rn
    form tab_name )

    where rn=序号

    注意:max的字段只能是number类型字段,如果是date类型的,会提示错误。date类型用上面的row_number()来做就可以了。


    Oracle 分组 取第一条记录
    id        apply_id
    1         1
    2         1
    3         1
    4         2
    5         2
    6         3
    7         3
    8         3

    取出
    id        apply_id
    3         1
    5         2
    8         3

    select alx_a.id
    from 
    (select id,apply_id,rownum rid from 表) alx_a,
    (select id,apply_id,rownum rid from 表) alx_b
    where alx_a.apply_id = alx_b.apply_id and alx_a.id <= alx_b.id 
    group by alx_a.id,alx_a.apply_id
    having count(*) = 1

     

     分组并取每组中的前n条记录

    在oracle中有一数据表exam_result(成绩记录表),

    表中的一条记录描述了“某个班某个学生某次考试的成绩"

    create table EXAM_RESULT 

      ID      NUMBER(10) not null,                   --主键
      CLASSID NUMBER(10) not null,           --  班级id,关联到班级表
      USERID  NUMBER(10) not null,             --用户id,关联到用户表
      EXAMID  NUMBER(10) not null,             --试卷id,关联到试卷表
      RESULT  NUMBER(3)                              --成绩
    )

     

    现在要求统计完成了试卷id为1,2,3的成绩的前3名

    即完成了试卷id为1的前3名,完成了试卷id为2的前3名,完成了试卷id为3的前3名

    select * from (
          select
            e.classid,
            e.userid,
            e.examid,
            e.result,
                row_number() over (partition by e.examid order by e.examid, e.result desc) rn
                       from exam_result e
                            where e.examid in (1,2,3)
    ) where rn <= 3
     
    posted @ 2011-10-14 23:51 江南一陈风 阅读(228) 评论(0) 编辑

    INV库存
    organization 两个含义:
    1. 经营单位,A/B/C分公司,A下面有A1,A2等工厂,主题目标是为了独立核算此组织
    ORG,ORG_ID;
    2. 库存组织,例如制造商的仓库,例如A1,A2等工厂
    Organization_id;

    HR_ORGANIZATION_UNITS -
    Org_organization_definitions
    Mtl_subinventory_ 库存组织单位
    MTL_PARAMETERS -库存组织参数(没有用ID,直接用name)
    MTL_SYSTEM_ITEMS_b -物料信息(同上,应用了库存组织name)
    MTL_SECONDARY_INVENTORIES -子库存组织 -
    MTL_ITEM_LOCATTIONS -货位 - SUBINVENTROY_CODE

    Mtl_Material_Transactions - (库存)物料事物表
    成本 mtl_transaction_accounts
    transaction_cost是事物成本;
    ACTUAL_COST是通过成本算法计算出来的实际成本,主计量单位

    现有量
    汇总历史记录(正负合计)
    Mtl_Material_Transactions
    MTL_ONHAND_QUANTITIES现有量表,组织/子库存/货位/物品 summary可能按照挑库先进先出统计,如果设置了"不允许负库存",这样就不可能出现负数

    PO
    请购单头表
    Po_Requisition_Headers_all
    行表
    Po_Requisition_lines_all
    采购订单
    PO_HEADER_ALL
    PO_LINES_ALL
    采购接收-退货/组织间转移/正常状态 都需要使用这个模块
    RCV_TRANSACTIONS
    1. 接收100单位货物,放入“待质检”货位
    2. 接受/拒绝
    3. 库存/退回
    有三个不同的状态!例如:接收100个,80个接受入库,20个退回,那么有80个接受事务/20个退回事物
    select TRANSACTION_TYPE,DESTINATION_TYPE_CODE from RCV_TRANSACTIONS
    可以看出以下阶段:
    A1.RECEIVE – RECEIVING
    A2.ACCEPT – RECEIVING
    A3.DELIERY – INVETORY(影响库存现有量)

    如果按照正常模式,最后会触发产生MTL_MATERIAL_TRANSACTIONS

    销售订单
    OE_ORDER_headers_all
    SOLD_FROM_ORG_ID
    SOLD_TO_ORG_ID 就是客户层
    SHIP_FROM_ORG_ID
    SHIP_TO_ORG_ID 就是客户收货层
    INVOICE_TO_ORG_ID 就是客户收单层
    DELIVER_TO_ORG_ID
    和客户结构有关
    客户 RA_customers
    客户Address Ra_Addresses
    Address 货品抵达 site RA_SITE_USES_ALL
    Address 发票抵达 site
    OE_ORDER_LINEs_all

    GL凭证
    gl_je_batches
    凭证日期: DEFAULT_EFFECTIVE_DATE
    会计期间: DEFAULT_PERIOD_NAME
    原币种凭证批借贷方汇总: RUNNING_TOTAL_DR/CR 比如美元
    本位币凭证批借贷方汇总: RUNNING_TOTAL_ACCOUNTED_DR/CR

    gl_je_headers日记账头信息
    批号: JE_BATCH_ID
    会计期间: PERIOD_NAME
    币种: CURRENCY_CODE
    汇率类型: CURRENCY_CONVERSION_TYPE
    汇率日期: CURRENCY_CONVERSION_DATE
    帐套: SET_OF_BOOKS_ID 参考 GL_SETS_OF_BOOKS
    凭证类型: JE_CATEGORY 参考 GL_JE_SOURCES
    凭证来源: JE_SOURCE

    gl_je_lines日记账体信息
    CODE_COMBINATION_ID 科目组合编号

    GL_BALANCES 总帐余额
    PERIOD_NET_DR/CR 净值
    BEGIN_BALANCE_DR/CR 期初额

    AR应收发票
    RA_CUSTOMER_TRX_ALL
    CUSTOMER_TRX_ID 发票编号
    BILL_TO_SITE_USE_ID 客户收单方编号
    PRIMARY_SALES_ID销售员
    REFERENCE是Oracle提供的外部编号输入框,但是由于版本问题和长度(<=30),不建议用户使用,如果要使用外部编号,请使用说明性弹性域

    RA_CUSTOMER_TRX_LINES_ALL
    LINE_ID 行号
    INVENTORY_ITEM_ID 可以为空,比如非物料的服务,只在DESCRIPTION中出现 /税行
    DESCRIPTION
    QUANTITY_INVOICE 开票数量
    LINE_TYPE 行类型 (一般/税)
    EXTEND_PRICE 本行金额
    注意:税行是隐藏行,所以至少会有两行

    收款情况
    AR_CASH_RECEIPTS_ALL(还包含了非收款信息)
    CASH_RECEIPT_ID 内部code
    RECEIPT_NUMBER 收款号
    RECEIPT_DATE 收款日期
    AMOUNT 总额
    RECEIPT_TYPE 现金/杂项 Cash/Misc
    FUNCTIONAL_AMOUNT 本位币计量金额
    UI上为RECEIPTS
    核销关系不是一一对应,也不是一次核销100%,UI上右下方的Application 按钮
    AR_RECEIVABLE_APPLICATIONS_ALL
    APPLIED_CUSTOMER_TRX_ID 发票编号
    APPLIED_CUSTOMER_TRX_LINE_ID 发票行编号

    STATUS APP表示核销 /UNAPP表示未核销
    AMOUNT_APPLIED 匹配金额
    注意:红冲收款报表时间跨月的问题;必须联查 AR_CASH_RECEIPTS_ALL和 AR_CASH_RECEIPT_HISTORY_ALL

    AP
    应付帐款(是我方人员按照供应商提供的纸张发票信息录入)UI 上的invoice
    AP_INVOICES_ALL

    实际付款PAYMENT
    AP_CHECKS_ALL

    核销关系 同AR,右下方的Payment 按钮
    AP_INVOICE_PAYMENTS_ALL客户余额表,情况比较复杂:比如两个用户合并,应收应付差额,预付款

    资产信息FA_ADDITIONS
    名称
    编号
    分类
    数量

    资产类别
    FA_CATEGORIES

    资产帐簿
    FA_BOOK_CONTROLS 和会计帐簿有什么关系?
    FA_BOOKS
    UI中的Inquiry
    Mothed是折旧方法(直线法/产量法)

    FA_DISTRIBUTION_HISTORY分配assignment,给什么部门使用多少
    LOCATION_ID 部门 联查FA_LOCATIONS

    折旧信息(分摊方法)
    FA_DEPRN_DETAIL
    period_counter 折旧期间编号

    折旧事务(新增、重建、转移、报废)
    FA_TRANSACTION_HEADERS

    select fnd_profile.VALUE('ORG_ID') FROM DUAL
    select * from hr_operating_units hou where hou.organization_id=204
    --fnd
    select * from fnd_application
    select * from fnd_application_tl where application_id=101
    select * from fnd_application_vl where application_id = 101
    ----值集
    select * from fnd_flex_value_sets
    select * from fnd_flex_values
    select * from fnd_flex_values_vl
    ----弹性域
    select * from fnd_id_flexs
    select * from fnd_id_flex_structures where id_flex_code='GL#'
    select * from fnd_id_flex_segments where id_flex_code='GL#' and id_flex_num=50671

    select * from fnd_profile_options_vl
    select * from fnd_concurrent_programs 程序表
    select * from fnd_concurrent_requests 请求表
    select * from fnd_concurrent_processes 进程表

    --inv
    select * from org_organization_definitions 库存组织
    select * from mtl_parameters 组织参数
    select * from mtl_system_items_b where inventory_item_id = 171 and organization_id=204 物料表
    select * from mtl_secondary_inventories 子库存
    select * from mtl_item_locations 货位
    select * from mtl_lot_numbers 批次
    select * from mtl_onhand_quantities 现有量表
    select * from mtl_serial_numbers 序列
    select * from mtl_material_transactions 物料事务记录
    select * from mtl_transaction_accounts 会计分录
    select * from mtl_transaction_types 事务类型
    select * from mtl_txn_source_types 事务来源类型
    select * from mfg_lookups ml where ml.LOOKUP_TYPE = 'MTL_TRANSACTION_ACTION'

    --po
    select * from po_requisition_headers_all 请求头
    select * from po_requisition_lines_all 请求行
    select * from po_headers_all 订单头
    select * from po_lines_all 订单行
    select * from po_line_locations_all
    select * from po_distributions_all 分配
    select * from po_releases_all 发送
    select * from rcv_shipment_headers 采购接收头
    select * from rcv_shipment_lines 采购接收行
    select * from rcv_transactions 接收事务处理
    select * from po_agents
    select * from po_vendors 订单
    select * from po_vendor_sites_all

    --oe
    select * from ra_customers 客户
    select * from ra_addresses_all 地址
    select * from ra_site_uses_all 用户

    select * from oe_order_headers_all 销售头
    select * from oe_order_lines_all 销售行

    select * from wsh_new_deliveries 发送
    select * from wsh_delivery_details
    select * from wsh_delivery_assignments

    --gl
    select * from gl_sets_of_books 总帐
    select * from gl_code_combinations gcc where gcc.summary_flag='Y' 科目组合
    select * from gl_balances 科目余额
    select * from gl_je_batches 凭证批
    select * from gl_je_headers 凭证头
    select * from gl_je_lines 凭证行
    select * from gl_je_categories 凭证分类
    select * from gl_je_sources 凭证来源
    select * from gl_summary_templates 科目汇总模板
    select * from gl_account_hierarchies 科目汇总模板层次

    --ar
    select * from ar_batches_all 事务处理批
    select * from ra_customer_trx_all 发票头
    select * from ra_customer_trx_lines_all 发票行
    select * from ra_cust_trx_line_gl_dist_all 发票分配
    select * from ar_cash_receipts_all 收款
    select * from ar_receivable_applications_all 核销
    select * from ar_payment_schedules_all 发票调整
    select * from ar_adjustments_all 会计分录
    select * from ar_distributions_all 付款计划

    --ap
    select * from ap_invoices_all 发票头
    select * from ap_invoice_distributions_all 发票行
    select * from ap_payment_schedules_all 付款计划
    select * from ap_check_stocks_all 单据
    select * from ap_checks_all 付款
    select * from ap_bank_branches 银行
    select * from ap_bank_accounts_all 银行帐号
    select * from ap_invoice_payments_all 核销

    posted @ 2011-10-14 23:50 江南一陈风 阅读(29) 评论(0) 编辑

    售订单要经历登记、发放、挑库、交货四个主要环节,有些表在各个环节都有不同的特性,作者罗列了几个主要的常用的表,其它好象还有些货物路线、停靠之类的信息表则没有涉及。

    下面是销售订单的四个主要环节和每个环节用到的常用表:

    一、登记

    1、oe_order_headers_all   --订单头信息表

    2、oe_order_lines_all
    --header_id=oe_order_headers_all.header_id
    --订单行信息表

    3、mtl_sales_orders
    --segment1=oe_order_headers_all.order_number
    --sales_order_id=mtl_material_transaction.transaction_source_id
    --记录订单编号的信息表

    4、wsh_delivery_details
    --source_header_id=oe_order_headers_all.header_id
    --source_line_id=oe_order_lines_all.line_id
    --记录订单的物料的发运明细信息,该表的记录在此阶段状态为R(Ready to release: 'R'means "ready to release")

    5、wsh_delivery_assignments
    --delivery_detail_id=wsh_delivery_details.delivery_detail_id
    --连接wsh_delivery_details和wsh_new_deliveries的信息表
    --此阶段连接wsh_delivery_details

     

    二、发放

    1、wsh_delivery_details
    --该表的记录在此阶段状态为S(Released to Warehouse: 'S' means "submitted for release" )

    2、wsh_new_deliveries
    --source_header_id=oe_order_headers_all.header_id
    --记录订单的交货信息表,此阶段为OP(Delivery is Open, has not been shipped)

    3、wsh_delivery_assignments
    --delivery_id=wsh_new_deliveries.delivery_id
    --连接wsh_delivery_details和wsh_new_deliveries的信息表
    --此阶段连接wsh_new_deliveries

    4、wsh_picking_batches
    --order_header_id=oe_order_headers_all.header_id
    --记录订单的发放的信息表

    三、挑库

    1、wsh_delivery_details
    --该表的记录在此阶段状态为Y(Staged)。如果启用了序列号,记录会按单个序列号拆分

    2、mtl_material_transactions
    --transaction_source_id=mtl_sales_orders.sales_order_id
    --trx_source_line_id=oe_order_lines_all.line_id
    --记录“销售订单挑库”阶段物料的存放位置发生变化的信息

    3、mtl_onhand_quantities
    --记录物料的现有数量信息表

    4、mtl_transaction_lot_numbers
    --transaction_id=mtl_material_transactions.transaction_id
    --lot_number=mtl_onhand_quantities.lot_number
    --记录物料的存放位置发生变化的所产生的批次信息表

    5、mtl_serial_numbers
    --last_txn_source_id=mtl_material_transactions.transaction_source_id
    --记录物料序列号的当前状态的信息表

     

    四、交货

    1、wsh_delivery_details
    --该表的记录在此阶段状态为C(Shipped)

    2、wsh_new_deliveries
    --该表的记录在此阶段为CL(Delivery has arrived at the destination)

    3、mtl_material_transactions
    --记录“销售订单发放”阶段物料的存放位置发生变化的信息
    --如果启用了序列号,记录会按单个序列号拆分

    在后台完成workflow后,数据将导入RA的接口表
    RA_INTERFACE_LINES_ALL
    RA_INTERFACE_SALESCREDITS_ALL
    当数据导入后,运行自动开票,数据将导入以下各表
    RA_CUSTOMER_TRX
    RA_CUSTOMER_TRX_LINES
    AR_PAYMENT_SCHEDULES

    (五)oracle OM在以下2层中支持开票进程
    1.订单头层级的开票:即将整个订单数据倒入结果,或返还AR
    2.订单行层级的开票:即将订单行中的数据倒入结果,或返还AR

    (六)自动开票
    Navigation: Interface-> Run Autoinvoice
    Program : Autoinvoice Master Program

    Interface Table: RA_INTERFACE_LINES_ALL
    Error Table: RA_INTERFACE_ERRORS_ALL
    Base Tables: RA_BATCHES_ALL
    RA_CUSTOMER_TRX_ALL
    RA_CUSTOMER_TRX_LINES_ALL

    OE_ORDER_HEADERS_ALL.ORDER_NUMBER =RA_CUSTOMER_TRX_ALL.INTERFACE_HEADER_ATTRIBUTE1
    下面所列举的是通过自动开票将OM中的相关引用传递到AR的字段

    Number Name Column
    1 Order Number INTERFACE_LINE_ATTRIBUTE1
    2 Order Type INTERFACE_LINE_ATTRIBUTE2
    3 Delivery INTERFACE_LINE_ATTRIBUTE3
    4 Waybill INTERFACE_LINE_ATTRIBUTE4
    5 Count INTERFACE_LINE_ATTRIBUTE5
    6 Line ID INTERFACE_LINE_ATTRIBUTE6
    7 Picking Line ID INTERFACE_LINE_ATTRIBUTE7
    8 Bill of Lading INTERFACE_LINE_ATTRIBUTE8
    9 Customer Item Part INTERFACE_LINE_ATTRIBUTE9
    10 Warehouse INTERFACE_LINE_ATTRIBUTE10
    11 Price Adjustment ID INTERFACE_LINE_ATTRIBUTE11
    12 Shipment Number INTERFACE_LINE_ATTRIBUTE12
    13 Option Number INTERFACE_LINE_ATTRIBUTE13
    14 Service Number INTERFACE_LINE_ATTRIBUTE14

    发票分组规则(Invoice Grouping Rules )
    Menu: Navigation > Setup > Transactions > Autoinvoice > Grouping Rule
    Autoinvoice uses grouping rules to group lines to create one transaction.


    1 接口表:
    a)OE_HEADERS_IFACE_ALL:此表为多组织表,用于将销售订单头插入开放接口。
    该表存储来自于其他子系统需要导入OM模块的订单头信息,
    该表导入时必须输入的字段/条件:
    ORDER_SOURCE_ID : Order source id 可选
    ORIG_SYS_DOCUMENT_REF: Original system document reference 必须
    ORDER_SOURCE : Order source 可选
    OPERATION_CODE : Operation code 必须
    ORDER_TYPE_ID : Order type id 可选
    ORDER_TYPE : Order type 可选
    RETURN_REASON_CODE : Return reason code 仅用于订单退回
    SALESREP_ID : Salesrep id
    PRICE_LIST_ID : Price list id 用于已经booking的订单
    PRICE_LIST : Price list 用于已经booking的订单
    example:
    insert into oe_headers_iface_all(
    ORDER_SOURCE_ID
    ,orig_sys_document_ref
    ,ORG_ID
    ,order_type_id
    ,PRICE_LIST_ID
    ,TRANSACTIONAL_CURR_CODE
    ,SOLD_TO_ORG_ID
    ,SHIP_TO_ORG_ID
    ,created_by
    ,creation_date
    ,last_updated_by
    ,last_update_date
    ,operation_code
    )select ooha.order_source_id
    ,ooha.orig_sys_document_ref
    ,ooha.org_id
    ,ooha.order_type_id
    ,ooha.price_list_id
    ,ooha.TRANSACTIONAL_CURR_CODE
    ,ooha.SOLD_TO_ORG_ID
    ,ooha.SHIP_TO_ORG_ID
    ,ooha.created_by
    ,ooha.creation_date
    ,fnd_global.user_id
    ,sysdate
    ,p_operation_code
    from oe_order_headers_all ooha
    where order_number=p_order_number;

    b)OE_LINES_IFACE_ALL此表为多组织表,用于将销售订单行插入开放接口。
    该表存储来自于其他子系统需要导入OM模块的订单行信息,
    该表导入时必须输入的字段/条件:
    ORDER_SOURCE_ID : Order source id 必须
    ORIG_SYS_DOCUMENT_REF : Original system document reference 必须
    ORIG_SYS_LINE_REF : Original system line reference 必须
    ORIG_SYS_SHIPMENT_REF : Original system shipment reference 必须
    INVENTORY_ITEM : Inventory Item 必须
    INVENTORY_ITEM_ID : Inventory Item ID 可选
    TOP_MODEL_LINE_REF : Top model line reference 可选
    LINK_TO_LINE_REF : Link to line reference 可选
    REQUEST_DATE : Request Date 必须
    DELIVERY_LEAD_TIME : Delivery lead time 必须
    DELIVERY_ID : Delivery id 必须
    ORDERED_QUANTITY : Ordered quantity 必须
    ORDER_QUANTITY_UOM : Order quantity uom 必须
    SHIPPING_QUANTITY : Quantity which has been shipped by Shipping in Shipping UOM. 可选
    SHIPPING_QUANTITY_UOM : The UOM for Shipping Quantity 可选
    SHIPPED_QUANTITY : Shipped quantity 可选
    CANCELLED_QUANTITY
    FULFILLED_QUANTITY : The fulfilled quantity for the line可选
    PRICING_QUANTITY : Pricing quantity 可选
    PRICING_QUANTITY_UOM : Pricing quantity uom 可选
    example:
    insert into OE_LINES_IFACE_ALL
    ( ORDER_SOURCE_ID ,
    ORIG_SYS_DOCUMENT_REF,
    ORIG_SYS_LINE_REF ,
    ORIG_SYS_SHIPMENT_REF ,
    org_id ,
    line_number
    ,line_type_id ,
    item_type_code ,
    INVENTORY_ITEM_ID ,
    source_type_code ,
    price_list_id ,
    sold_to_org_id ,
    sold_from_org_id ,
    ship_to_org_id
    ,ship_from_org_id ,
    operation_code ,
    ORDERED_QUANTITY ,
    ORDER_QUANTITY_UOM ,
    CREATED_BY ,CREATION_DATE ,LAST_UPDATED_BY ,LAST_UPDATE_DATE ,LAST_UPDATE_LOGIN )
    values
    (l_line_tbl(j).order_source_id,
    l_line_tbl(j).orig_sys_document_ref,
    l_line_tbl(j).orig_sys_line_ref ,
    l_line_tbl(j).orig_sys_shipment_ref
    ,l_line_tbl(j).org_id,
    l_line_tbl(j).line_number,
    l_line_tbl(j).line_type_id,
    l_line_tbl(j).item_type_code,
    p_new_item,
    l_line_tbl(j).source_type_code ,
    l_line_tbl(j).price_list_id,
    l_line_tbl(j).sold_to_org_id,
    l_line_tbl(j).sold_from_org_id,
    l_line_tbl(j).ship_to_org_id,
    l_line_tbl(j).ship_from_org_id ,
    p_operation_code,
    l_line_tbl(j).ordered_quantity ,
    l_line_tbl(j).order_quantity_uom,
    l_line_tbl(j).Created_By , l_line_tbl(j).creation_date ,fnd_global.USER_ID ,sysdate ,fnd_global.user_id
    );

    c)OE_PRICE_ADJS_IFACE_ALL
    d)导入接口的API: OE_ORDER_PUB
    常用过程:
    (1)OE_ORDER_PUB.Process_Order:提供创建,修改,删除订单实体的操作,该方法通过记录集或者外部的请求,同样适用于对订单的其他操作,
    (2)OE_ORDER_PUB.Get_Order :返回单个订单对象的所有记录
    (3)OE_ORDER_PUB.Lock_Order :锁定订单对象.
    可以使用get_order 来获取记录可以调用lock_order锁定该记录

    e)记录error信息
    OE_PROCESSING_MSGS
    OE_PROCESSING_MSGS_TL
    f)销售订单要经历登记、发放、挑库、交货四个主要环节,有些表在各个环节都有不同的特性,
    几个主要的常用的表,其它好象还有些货物路线、停靠之类的信息表没有深究,就不列罗。

    posted @ 2011-10-14 23:49 江南一陈风 阅读(41) 评论(0) 编辑

    1.日期时间间隔操作

    当前时间减去7分钟的时间
    select sysdate,sysdate - interval '7' MINUTE from dual
    当前时间减去7小时的时间
    select sysdate - interval '7' hour from dual
    当前时间减去7天的时间
    select sysdate - interval '7' day from dual
    当前时间减去7月的时间
    select sysdate,sysdate - interval '7' month from dual
    当前时间减去7年的时间
    select sysdate,sysdate - interval '7' year from dual
    时间间隔乘以一个数字
    select sysdate,sysdate - 8 *interval '2' hour from dual

    2.日期到字符操作
    select sysdate,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual
    select sysdate,to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dual
    select sysdate,to_char(sysdate,'yyyy-ddd hh:mi:ss') from dual
    select sysdate,to_char(sysdate,'yyyy-mm iw-d hh:mi:ss') from dual
    参考oracle的相关关文档(ORACLE901DOC/SERVER.901/A90125/SQL_ELEMENTS4.HTM#48515)

    3. 字符到日期操作
    select to_date('2003-10-17 21:15:37','yyyy-mm-dd hh24:mi:ss') from dual
    具体用法和上面的to_char差不多。

    4. trunk/ ROUND函数的使用
    select trunc(sysdate ,'YEAR') from dual
    select trunc(sysdate ) from dual
    select to_char(trunc(sysdate ,'YYYY'),'YYYY') from dual;

    posted @ 2011-10-14 23:43 江南一陈风 阅读(14) 评论(0) 编辑

    请购单头信息

    PO_REQUISITION_HEADERS_ALL

    请购单行信息

    PO_REQUISITION_LINES_ALL

    请购单分配行

    Po_Req_Distributions_All

     
     
     

    采购订单头表

    po_headers_all

    采购订单行表

    po_lines_all

    采购订单行的发送表

    po_line_locations_all

    采购订单发送行的分配表

    po_distributions_all

    posted @ 2011-10-14 23:42 江南一陈风 阅读(17) 评论(0) 编辑

    Incomplete,In-process,approved,pre-approved

    Incomplete 是当PR/PO创建但还没有提交Approve 时的状态
    此种状态的PR/PO可以删除

    In-process 是当PR/PO创建并且已经提交approve ,但是主管还没有approve,此时pr/po的状态为In-process , 此种状态的pr/po只能cancel,而不能删除

    approved 是主管已经审批,也就是说这个PR/PO已经被approved,


    pre-approved 是主管没有足够的权限进行审批,或者此单据已经失效(限于Release)


    employee job 是设置主管的,也就是审批权限的,如果为空,就是没有权限审批此PR/PO

  • 相关阅读:
    go语言练习:go实现md5
    go语言练习:结构体
    go语言练习:指针
    go语言练习:数组
    DEL: MySQL Learning
    EV: Notepad++: Insert Timestamp -- Using Python
    EV: 文件共享的问题
    EV: Ruby: 安装和运行rails
    EV: MySQL Clear Screen
    EV: Ubuntu 的root用户password问题
  • 原文地址:https://www.cnblogs.com/javawebstudy/p/3041987.html
Copyright © 2011-2022 走看看