1 PACKAGE BODY PO_AP_INTEGRATION_PVT AS
2 /* $Header: POXVAPIB.pls 115.1 2004/03/25 07:17:01 axian noship $ */
3
4 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_AP_INTEGRATION_PVT';
5
6 -------------------------------------------------------------------------------
7 --Start of Comments
8 --Name: get_invoice_numbering_options
9 --Pre-reqs:
10 -- p_org_id is not null
11 --Modifies:
12 -- FND_MSG_PUB on error
13 --Locks:
14 -- None
15 --Function:
16 -- Retrieves the invoice numbering options: the gapless invoice numbering
17 -- flag and the buying company identifier
18 --Parameters:
19 --IN:
20 --p_api_version:
21 -- Version number of API that caller expects. It should match the constant
22 -- 'l_api_version' defined in the procedure.
23 --p_org_id
24 -- Operating unit ID that will be used to retrieve OU-specific invoice
25 -- numbering options
26 --OUT:
27 --x_return_status:
28 -- FND_API.g_ret_sts_success -- if the procedure completed successfully
29 -- FND_API.g_ret_sts_unexp_error -- if an unexpected error occurred
30 --x_msg_data:
31 -- Error message text in case of exception/error
32 --x_buying_company_identifier:
33 -- Self-bill buying company identifier from the Purchasing Options of the
34 -- input OU
35 --x_gapless_inv_num_flag:
36 -- If gapless invoice numbering is enabled, return Y; else return N
37 --Testing:
38 --End of Comments
39 -------------------------------------------------------------------------------
40 PROCEDURE get_invoice_numbering_options
41 (
42 p_api_version IN NUMBER,
43 p_org_id IN NUMBER,
44 x_return_status OUT NOCOPY VARCHAR2,
45 x_msg_data OUT NOCOPY VARCHAR2,
46 x_buying_company_identifier OUT NOCOPY VARCHAR2,
47 x_gapless_inv_num_flag OUT NOCOPY VARCHAR2
48 )
49 IS
50 l_api_version CONSTANT NUMBER := 1.0;
51 l_api_name CONSTANT VARCHAR2(30) := 'get_invoice_numbering_options';
52 l_progress VARCHAR2(3) := '000';
53
54 BEGIN
55 l_progress := '010';
56
57 -- Standard call to check for call compatibility
58 IF NOT FND_API.compatible_api_call(l_api_version,
59 p_api_version,
60 l_api_name,
61 g_pkg_name) THEN
62 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
63 END IF;
64
65 x_return_status:= FND_API.g_ret_sts_success;
66 l_progress := '020';
67
68 -- SQL What: Get invoice number options from PO system parameters
69 -- SQL Why: Need to pass back x_gapless_inv_num_flag and x_buying_company_identifier
70 SELECT nvl(gapless_inv_num_flag, 'N'), buying_company_identifier
71 INTO x_gapless_inv_num_flag, x_buying_company_identifier
72 FROM PO_SYSTEM_PARAMETERS_ALL
73 WHERE org_id = p_org_id;
74
75 EXCEPTION
76 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
77 x_gapless_inv_num_flag := 'N';
78 x_buying_company_identifier := NULL;
79 x_return_status := FND_API.g_ret_sts_unexp_error;
80 x_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,
81 p_encoded => 'F');
82 WHEN OTHERS THEN
83 x_gapless_inv_num_flag := 'N';
84 x_buying_company_identifier := NULL;
85 x_return_status := FND_API.g_ret_sts_unexp_error;
86 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
87 FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
88 p_procedure_name => l_api_name,
89 p_error_text => SUBSTRB(SQLERRM, 1, 200)
90 ||' at location '||l_progress);
91 END IF;
92 x_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,
93 p_encoded => 'F');
94
95 END get_invoice_numbering_options;
96
97 END PO_AP_INTEGRATION_PVT;