zoukankan      html  css  js  c++  java
  • Script to set the Purchase Order Status to ‘OPEN’(将采购订单重新打开)

      

    Business Requirement: The finance user requests the IT team to change the PO status to OPEN as they are unable to match the incoming vendor invoices.  The PO status is set to closed because of the previous legible transactions or some data corruption issues.

    Purpose: Set the Purchase Order Status to Open

    1. Identify the PO’s whose status needs to be OPENed
    2. Insert them into a temporary table e.g: xxrp_po_number_temp
    create table xxrp_po_number_temp (po_number varchar2(200));
    insert into xxrp_po_number_temp values (’1089442′);
    3. Run the script

    BEGIN
    FOR c_rec in (select po_number from xxrp_po_number_temp )
    LOOP

    – Update PO Headers
    UPDATE po_headers_all
    SET closed_date = ”,
    closed_code = ‘OPEN’
    WHERE segment1 = c_rec.po_number;

    – Update PO Lines
    UPDATE po_lines_all
    SET closed_date = ”,
    closed_code = ‘OPEN’,
    closed_by = ”,
    last_updated_by = 0,
    last_update_date = SYSDATE
    WHERE po_header_id IN
    (SELECT poh.po_header_id
    FROM po_headers_all poh
    WHERE poh.segment1 = c_rec.po_number);

    – Update PO Shipments
    UPDATE po_line_locations_all
    SET closed_date = ”,
    closed_code = ‘OPEN’,
    closed_by = ”,
    shipment_closed_date = ”,
    last_updated_by = 0,
    last_update_date = SYSDATE,
    closed_for_receiving_date = ”,
    closed_for_invoice_date = ”
    WHERE po_header_id IN
    (SELECT poh.po_header_id
    FROM po_headers_all poh
    WHERE poh.segment1 = c_rec.po_number);

    – PO Distribution needs no update
    — Update action history
    DELETE
    FROM po_action_history
    WHERE object_type_code = ‘PO’
    AND object_sub_type_code = ‘STANDARD’
    AND action_code = ‘FINALLY CLOSE’
    AND object_id =
    (SELECT poh.po_header_id
    FROM po_headers_all poh
    WHERE poh.segment1 = c_rec.po_number
    AND type_lookup_code = ‘STANDARD’);

    END LOOP;

    COMMIT;
    EXCEPTION
    when others then
    rollback;
    raise_application_error(-20001,’Error -’ || SQLERRM);
    END;
    /
    –(III) Drop the temporary table
    DROP TABLE xxrp_po_number_temp;

  • 相关阅读:
    App测试
    转【测试基础】测试计划如何编写
    web测试之界面测试
    6个讨喜的 ES6 小技巧
    在选择数据库的路上,我们遇到过哪些坑?(2)
    在选择数据库的路上,我们遇到过哪些坑?(1)
    10款jQuery文本高亮插件
    谷歌开发者大会传达的8条关键信息
    我有几个粽子,和一个故事
    容器监控—阿里云&容器内部服务监控
  • 原文地址:https://www.cnblogs.com/toowang/p/3478717.html
Copyright © 2011-2022 走看看