2016年9月25日 星期日

Oracle EBS: SO已book, 但無對應的workflow -- Part 2 (Ref)

查看資料:

SELECT h.order_number,
       h.header_id,
          l.line_number
       || '.'
       || l.shipment_number
       || '.'
       || l.option_number
       || '.'
       || l.component_number
       || '.'
       || l.service_number
          line_num,
       l.line_id,
       h.booked_flag,
       l.booked_flag,
       h.order_type_id,
       l.line_type_id,
       h.creation_date,
       h.last_update_date,
       h.last_updated_by,
       l.creation_date,
       l.last_update_date,
       l.last_updated_by,
       DECODE (
          (SELECT 1
             FROM wf_items
            WHERE     item_type = 'OEOL'
                  AND item_key = TO_CHAR (l.line_id)
                  AND end_date IS NULL),
          1, 'Yes',
          'No')
          WF_Created,
       DECODE (
          (SELECT 1
             FROM wf_item_activity_statuses
            WHERE     item_type = 'OEOL'
                  AND item_key = TO_CHAR (l.line_id)
                  AND end_date IS NULL
                  AND ROWNUM = 1),
          1, 'Yes',
          'No')
          WF_Started
  FROM oe_order_lines_all l, oe_order_headers_all h
 WHERE     l.header_id = h.header_id
       AND l.open_flag = 'Y'
       AND h.open_flag = 'Y'
       AND h.flow_status_code IN ('ENTERED', 'BOOKED')
       AND l.flow_status_code IN ('ENTERED', 'BOOKED')
       AND NOT EXISTS
                  (SELECT 1
                     FROM wf_item_activity_statuses st
                    WHERE st.item_type = 'OEOL'
                          AND st.item_key = TO_CHAR (l.line_id))
       and h.order_number =102013860

Oracle EBS: SO已book, 但無對應的workflow -- Part 2

這狀況又發生了, SO中有5個line, user要建立Delivery時有問題, 才發現第5個line沒有workflow, status還停在Booked.

有了上次的經驗, 這次處理速度快了些.


1.檢查workflow status, 沒資料

  SELECT *
    FROM wf_item_activity_statuses
   WHERE item_type = 'OEOL'

     AND item_key = TO_CHAR(1458486)


2.launch process
begin
    wf_engine.launchProcess('OEOL',  --itemtype in varchar2,
               1458486,  --1         itemkey  in varchar2,
               'Line Flow - Generic',--         process  in varchar2,
               'Sales Order 102013860, Line 5.1..', --         user_key in varchar2,
               'XX01530' );        -- owner_role in varchar2)
end;


3.再檢查workflow, 已有資料, line的status仍是Booked


4.commit


5.執行Workflow Background Process


搞定~