总账库存科目明细追溯

/* Formatted on 2018/3/15 10:04:03 (QP5 v5.256.13226.35538) */

  SELECT xel.subinventory_code 子库

       , DECODE (xel.lot_number, '', '来源,非库存') 批次

       --       , cux_public_pkg.get_item_segment1 (81, xeh.inventory_item_id) 物料编码

       --       , cux_public_pkg.get_item_description (81, xeh.inventory_item_id) 物料品名

       , xeh.transaction_uom 单位

       , SUM (xdl.unrounded_entered_dr) 借方金额

       , SUM (xdl.unrounded_entered_cr) 贷方金额

    FROM xla_ae_headers ah

       , xla_ae_lines al

       , xla_distribution_links xdl

       , gmf_xla_extract_headers xeh

       , gmf_xla_extract_lines xel

   WHERE 1 = 1

     AND ah.ae_header_id = al.ae_header_id                                                                              

     --AND AH.APPLICATION_ID = 555

     AND ah.period_name = '2012-03'

     AND al.code_combination_id = (SELECT k.code_combination_id

                                     FROM gl_code_combinations_kfv k

                                    WHERE k.concatenated_segments = '10.0.141103.0.0.0.0')

     AND al.ae_header_id = xdl.ae_header_id

     AND al.ae_line_num = xdl.ae_line_num

     AND al.application_id = xdl.application_id

     AND xdl.source_distribution_id_num_1 = xel.line_id(+)

     AND xel.header_id = xeh.header_id(+)

GROUP BY xel.subinventory_code

       , xel.lot_number

       , xeh.inventory_item_id

       , xeh.transaction_uom

posted @ 2018-03-15 10:06  全威儒  阅读(702)  评论(0编辑  收藏  举报