98: PROCEDURE Validate_PO_Lines(
99: p_po_line_tbl IN PO_Line_Tbl_Type,
100: p_osp_order_id IN NUMBER);
101:
102: -- Insert a record into the PO_HEADERS_INTERFACE table
103: PROCEDURE Insert_PO_Header(
104: p_po_header_rec IN PO_Header_Rec_Type,
105: x_intf_header_id OUT NOCOPY NUMBER,
106: x_batch_id OUT NOCOPY NUMBER);
254: -- Contains the batch id if the concurrent program was launched successfuly.
255: -- x_request_id OUT NUMBER Required
256: -- Contains the concurrent request id if the concurrent program was launched successfuly.
257: -- x_interface_header_id OUT NUMBER Required
258: -- Contains the interface header id generated for the po_headers_interface table.
259: --
260: --
261: -- Version :
262: -- Initial Version 1.0
492: x_msg_count := FND_MSG_PUB.count_msg;
493: IF x_msg_count > 0 THEN
494: RAISE FND_API.G_EXC_ERROR;
495: END IF;
496: --dbms_output.put_line('no errors : going onto insert into po_headers_interface ');
497: -- Insert Row into PO_HEADERS_INTERFACE
498: Insert_PO_Header(p_po_header_rec => l_po_header,
499: x_intf_header_id => l_intf_hdr_id,
500: x_batch_id => l_batch_id);
493: IF x_msg_count > 0 THEN
494: RAISE FND_API.G_EXC_ERROR;
495: END IF;
496: --dbms_output.put_line('no errors : going onto insert into po_headers_interface ');
497: -- Insert Row into PO_HEADERS_INTERFACE
498: Insert_PO_Header(p_po_header_rec => l_po_header,
499: x_intf_header_id => l_intf_hdr_id,
500: x_batch_id => l_batch_id);
501: --dbms_output.put_line('Inserted row into po_headers_interface. x_intf_header_id = ' || l_intf_hdr_id);
497: -- Insert Row into PO_HEADERS_INTERFACE
498: Insert_PO_Header(p_po_header_rec => l_po_header,
499: x_intf_header_id => l_intf_hdr_id,
500: x_batch_id => l_batch_id);
501: --dbms_output.put_line('Inserted row into po_headers_interface. x_intf_header_id = ' || l_intf_hdr_id);
502: --dbms_output.put_line('x_batch_id = ' || l_batch_id);
503: -- Insert rows into PO_LINES_INTERFACE
504: Insert_PO_Lines(p_po_line_tbl => l_po_line_tbl,
505: p_intf_header_id => l_intf_hdr_id);
509: IF (l_old_intf_header_id IS NOT NULL AND l_curr_status = G_OSP_SUB_FAILED_STATUS) THEN
510: -- PO Submission had failed earlier
511: DELETE FROM PO_INTERFACE_ERRORS WHERE
512: INTERFACE_HEADER_ID = l_old_intf_header_id;
513: DELETE FROM PO_HEADERS_INTERFACE WHERE
514: INTERFACE_HEADER_ID = l_old_intf_header_id;
515: DELETE FROM PO_LINES_INTERFACE WHERE
516: INTERFACE_HEADER_ID = l_old_intf_header_id;
517: DELETE FROM PO_DISTRIBUTIONS_INTERFACE WHERE
1686: END IF;
1687: END Validate_PO_Lines;
1688:
1689: ----------------------------------------
1690: -- This Procedure inserts a record into the PO_HEADERS_INTERFACE table
1691: ----------------------------------------
1692: PROCEDURE Insert_PO_Header(
1693: p_po_header_rec IN PO_Header_Rec_Type,
1694: x_intf_header_id OUT NOCOPY NUMBER,
1706: l_currency_code VARCHAR2(15) := NULL;
1707: l_temp_n NUMBER := 0;
1708: l_temp_v VARCHAR2(240) := NULL;
1709: l_curr_org_id NUMBER;
1710: l_manual_po_number PO_HEADERS_INTERFACE.DOCUMENT_NUM%TYPE := NULL;
1711:
1712: L_DEBUG_KEY CONSTANT VARCHAR2(150) := G_LOG_PREFIX || '.Insert_PO_Header';
1713:
1714: BEGIN
1716: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.begin', 'Entering Procedure');
1717: END IF;
1718: -- Get Batch Id
1719: /*
1720: SELECT NVL(MAX(batch_id), 0) + 1 INTO l_batch_id FROM po_headers_interface;
1721: */
1722: -- Changes made by jaramana on December 19, 2005
1723: -- to improve the performace of this SQL by removing the Full Index Scan
1724: -- Since batch_id is optional, no need to get it using the max value.
1725: -- Instead, hard code it to the OSP Order Id
1726: l_batch_id := p_po_header_rec.OSP_ORDER_ID;
1727:
1728: -- Generate PO Header Id
1729: SELECT PO_HEADERS_INTERFACE_S.NEXTVAL INTO l_intf_hdr_id FROM sys.dual;
1730:
1731: -- Description
1732: OPEN l_get_osp_order_dtls_csr(p_po_header_rec.OSP_ORDER_ID);
1733: FETCH l_get_osp_order_dtls_csr INTO l_temp_n, l_OSP_description;
1780:
1781: -- SATHAPLI::Bug 8583364, 21-Aug-2009, call create_manual_PO_Number to get the manual PO number
1782: l_manual_po_number := create_manual_PO_Number(l_curr_org_id, p_po_header_rec.OSP_ORDER_ID);
1783:
1784: -- Insert row into PO_HEADERS_INTERFACE
1785: INSERT INTO PO_HEADERS_INTERFACE (
1786: INTERFACE_HEADER_ID,
1787: BATCH_ID,
1788: INTERFACE_SOURCE_CODE,
1781: -- SATHAPLI::Bug 8583364, 21-Aug-2009, call create_manual_PO_Number to get the manual PO number
1782: l_manual_po_number := create_manual_PO_Number(l_curr_org_id, p_po_header_rec.OSP_ORDER_ID);
1783:
1784: -- Insert row into PO_HEADERS_INTERFACE
1785: INSERT INTO PO_HEADERS_INTERFACE (
1786: INTERFACE_HEADER_ID,
1787: BATCH_ID,
1788: INTERFACE_SOURCE_CODE,
1789: PROCESS_CODE,
2095: -- TO BE USED FOR DEBUGGING PURPOSE ONLY
2096: ----------------------------------------
2097: PROCEDURE Call_PDOI_API(p_batch_id IN NUMBER) IS
2098: BEGIN
2099: po_docs_interface_sv5.process_po_headers_interface(
2100: X_selected_batch_id => p_batch_id,
2101: X_buyer_id => NULL,
2102: X_document_type => G_DOC_TYPE_CODE,
2103: X_document_subtype => NULL,
3378: FROM AHL_OSP_ORDERS_B
3379: WHERE osp_order_id = c_order_id;
3380:
3381: l_debug_key CONSTANT VARCHAR2(150) := G_LOG_PREFIX || '.create_manual_PO_Number';
3382: l_manual_po_number PO_HEADERS_INTERFACE.DOCUMENT_NUM%TYPE := NULL;
3383: l_osp_order_number NUMBER;
3384: l_dummy VARCHAR2(1);
3385:
3386: BEGIN
3409: EXCEPTION
3410: WHEN OTHERS THEN
3411: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
3412: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_debug_key,
3413: 'l_manual_po_number exceeded PO_HEADERS_INTERFACE.DOCUMENT_NUM%TYPE precision.');
3414: END IF;
3415:
3416: CLOSE chk_manual_PO_Numbering;
3417: