首页 > 代码库 > 采购订单关闭
采购订单关闭
DECLARE -- Local variables here i INTEGER; l_return_status VARCHAR2(10); p_retcode VARCHAR2(2000); p_errbuf VARCHAR2(2000); v_x_return_status VARCHAR2(250); v_x_exception_msg VARCHAR2(250); BEGIN -- Test statements here FOR rec IN (SELECT pha.org_id, pha.segment1, pha.po_header_id erp_header_id FROM po_headers_all pha WHERE 1 = 1 AND pha.org_id = 86 AND pha.segment1 LIKE 'CXY-%' AND pha.created_by = 1150 AND pha.cancel_flag <> 'Y') LOOP apps.fnd_global.apps_initialize(user_id => 1150, -- V_USER_ID, resp_id => 50758, --P_RESP_ID, 50757 50737 50758 resp_appl_id => 201); apps.mo_global.init('PO'); --DBMS_OUTPUT.PUT_LINE(P_USER_ID || '*' || V_USER_ID || '*' ||P_RESP_ID); dbms_output.put_line('------' || rec.segment1 || '------'); dbms_output.put_line(l_return_status); apps.po_document_control_pub.control_document(p_api_version => 1.0, -- p_api_version p_init_msg_list => apps.fnd_api.g_true, -- p_init_msg_list p_commit => apps.fnd_api.g_true, -- p_commit x_return_status => l_return_status, -- x_return_status p_doc_type => 'PO', -- p_doc_type p_doc_subtype => 'STANDARD', -- p_doc_subtype p_doc_id => NULL, -- p_doc_id p_doc_num => rec.segment1, -- p_doc_num p_release_id => NULL, -- p_release_id p_release_num => NULL, -- p_release_num p_doc_line_id => NULL, -- p_doc_line_id p_doc_line_num => NULL, --REC.LINE_NUM, -- p_doc_line_num p_doc_line_loc_id => NULL, --rec.Line_Location_Id, -- p_doc_line_loc_id p_doc_shipment_num => NULL, -- p_doc_shipment_num p_action => 'CANCEL', -- p_action p_action_date => SYSDATE, -- p_action_date p_cancel_reason => '期初数据导入错误', -- p_cancel_reason p_cancel_reqs_flag => 'N', -- p_cancel_reqs_flag p_print_flag => NULL, -- p_print_flag p_note_to_vendor => NULL, p_use_gldate => NULL, -- <ENCUMBRANCE FPJ> p_org_id => rec.org_id); -- p_note_to_vendor -- Get any messages returned by the Cancel API COMMIT; FOR i IN 1 .. apps.fnd_msg_pub.count_msg LOOP dbms_output.put_line(apps.fnd_msg_pub.get(p_msg_index => i, p_encoded => 'F')); p_errbuf := apps.fnd_msg_pub.get(p_msg_index => i, p_encoded => 'F'); END LOOP; COMMIT; IF l_return_status = 'S' THEN BEGIN apps.po_document_action_pvt.do_approve(p_document_id => rec.erp_header_id, --PO_HEADER_ID p_document_type => 'PO', p_document_subtype => 'STANDARD', p_note => NULL, p_approval_path_id => NULL, x_return_status => v_x_return_status, x_exception_msg => v_x_exception_msg); dbms_output.put_line('V_X_RETURN_STATUS:' || v_x_return_status); dbms_output.put_line('V_X_EXCEPTION_MSG:' || v_x_exception_msg); IF v_x_return_status = 'S' THEN COMMIT; ELSE ROLLBACK; END IF; END; dbms_output.put_line('Y'); dbms_output.put_line('取消成功'); COMMIT; ELSE dbms_output.put_line('E'); dbms_output.put_line('取消失败:' || p_errbuf); END IF; COMMIT; ----update po_header ----更新头行的审批状态 END LOOP; END;
采购订单关闭
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。