EBS:从订单明细生成价目表DATALOAD格式

-- 用订单明细行生成价目表,DATALOAD格式,以便于导入价目表明细行。
SELECT --DISTINCT
       OOH.ORDER_NUMBER,
      -- OOL.LINE_NUMBER,
       '项目' AS "产品上下文",
       '\{TAB}' AS "跳格1",
       '项目编号' AS "产品属性", 
       '\{TAB}' AS "跳格2",
       MSI.SEGMENT1 AS ITEM_CODE,
       '\{TAB}' AS "跳格3",
       --MSI.DESCRIPTION AS ITEM_DESCRIPTION,
       --OOL.ORDER_QUANTITY_UOM,  
       '\{TAB 5}' AS "料号后跳5格",     
       MAX(OOL.UNIT_SELLING_PRICE) AS UNIT_SELLING_PRICE,   
       '\{TAB}' AS "离开单价",
       '*IR' AS "新增一行"  
      -- '*DN' AS "向下"
      -- ,OOL.*  
 FROM ONT.OE_ORDER_HEADERS_ALL OOH,
       ONT.OE_ORDER_LINES_ALL   OOL,
       INV.MTL_SYSTEM_ITEMS_B   MSI
      -- Hz_Cust_Accounts HCA -- 客户账户 
 WHERE OOH.HEADER_ID = OOL.HEADER_ID
   AND OOH.ORG_ID = 281
  -- AND OOH.SOLD_TO_ORG_ID = 811726 
 -- and OOH.ORDER_CATEGORY_CODE = 'ORDER'
   AND OOL.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID
   AND OOL.SHIP_FROM_ORG_ID = MSI.ORGANIZATION_ID
   and NVL(ooL.cancelled_flag,'N') ='N'
   AND OOH.ORDER_NUMBER LIKE '1001389343'  -- 订单号
   AND MSI.SEGMENT1  NOT IN ('A1F60HVDV','JDOORLX','BESPWVHVDV')
 --ORDER BY OOL.LINE_NUMBER 
  GROUP BY OOH.ORDER_NUMBER,
      -- OOL.LINE_NUMBER,
    --   '项目' AS "产品上下文",
    --  '\{TAB}' AS "跳格1",
     --  '项目编号' AS "产品属性", 
     --  '\{TAB}' AS "跳格2",
       MSI.SEGMENT1-- AS ITEM_CODE

  

posted @ 2023-01-04 16:26  samrv  阅读(164)  评论(0编辑  收藏  举报