[Home] [Help]
PACKAGE BODY: APPS.PO_SHARED_PROC_GRP
Source
1 PACKAGE BODY PO_SHARED_PROC_GRP AS
2 /* $Header: POXGSPSB.pls 115.3 2003/09/30 23:05:15 mbhargav noship $ */
3
4 -- Read the profile option that enables/disables the debug log
5 g_fnd_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'), 'N');
6
7 g_pkg_name CONSTANT VARCHAR2(20) := 'PO_SHARED_PROC_GRP';
8 g_module_prefix CONSTANT VARCHAR2(30) := 'po.plsql.' || g_pkg_name || '.';
9
10
11 --------------------------------------------------------------------------------
12 --Start of Comments
13 --Name: check_shared_proc_scenario
14 --Pre-reqs:
15 -- None.
16 --Modifies:
17 -- FND_MSG_PUB on error.
18 --Locks:
19 -- None.
20 --Function:
21 -- Determines if it is a Shared Procurement Services (SPS) scenario.
22 --Parameters:
23 --IN:
24 -- p_api_version
25 -- : Version number of API that caller expects. It should match the
26 -- constant 'l_api_version' defined in the procedure.
27 -- p_init_msg_list
28 -- : API standard parameter that indicates if the FND message list
29 -- needs to be reset at the start of this procedure.
30 -- p_document_type_code
31 -- : The PO's document type code.
32 -- p_ship_to_inv_org_id NUMBER
33 -- : Destination(Ship-to) Inventory Org ID
34 -- p_purchasing_ou_id NUMBER,
35 -- : Purchasing OU's org ID
36 -- p_transaction_flow_header_id NUMBER,
37 -- : Transaction flow's header ID, if a Txn flow exists between the
38 -- DOU and POU
39 -- p_project_id NUMBER,
40 -- : Project ID specified on the distribution
41 -- p_destination_type_code VARCHAR2
42 -- : Destination Type Code specified on the distribution
43 --OUT:
44 --x_return_status
45 -- FND_API.g_ret_sts_success - if the procedure completed successfully
46 -- FND_API.g_ret_sts_error - if an error occurred
47 -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
48 --x_is_shared_proc_scenario
49 -- 'Y' if it is a shared procurement scenario.
50 -- 'N' otherwise.
51 --Testing:
52 --End of Comments
53 --------------------------------------------------------------------------------
54 PROCEDURE check_shared_proc_scenario
55 (
56 p_api_version IN NUMBER,
57 p_init_msg_list IN VARCHAR2,
58 x_return_status OUT NOCOPY VARCHAR2,
59 p_destination_type_code IN VARCHAR2,
60 p_document_type_code IN VARCHAR2,
61 p_project_id IN NUMBER,
62 p_purchasing_ou_id IN NUMBER,
63 p_ship_to_inv_org_id IN NUMBER,
64 p_transaction_flow_header_id IN NUMBER,
65 x_is_shared_proc_scenario OUT NOCOPY VARCHAR2
66 )
67 IS
68 l_api_version CONSTANT NUMBER := 1.0;
69 l_api_name CONSTANT VARCHAR2(30) := 'check_shared_proc_scenario';
70 l_ship_to_ou_id NUMBER;
71 l_ship_to_ou_coa_id NUMBER;
72 l_return_status VARCHAR2(1);
73 l_is_shared_proc_scenario BOOLEAN;
74 BEGIN
75 -- Standard call to check for call compatibility
76 IF NOT FND_API.compatible_api_call(l_api_version, p_api_version,
77 l_api_name, g_pkg_name) THEN
78 RAISE FND_API.g_exc_unexpected_error;
79 END IF;
80
81 -- Start standard API initialization
82 IF FND_API.to_boolean(p_init_msg_list) THEN
83 FND_MSG_PUB.initialize;
84 END IF;
85
86 -- Derive the Ship-to-OU ID from the p_ship_to_inv_org_id
87 PO_SHARED_PROC_PVT.get_ou_and_coa_from_inv_org(
88 p_inv_org_id => p_ship_to_inv_org_id, -- IN
89 x_coa_id => l_ship_to_ou_coa_id, -- OUT
90 x_ou_id => l_ship_to_ou_id, -- OUT
91 x_return_status => l_return_status); -- OUT
92
93 IF (l_return_status <> FND_API.g_ret_sts_success) THEN
94 APP_EXCEPTION.raise_exception(
95 exception_type => 'SHARED_PROC_EXCEPTION',
96 exception_code => 0,
97 exception_text => 'PO_SHARED_PROC_PVT.' ||
98 'get_ou_and_coa_from_inv_org');
99 END IF;
100
101 -- Call the private function
102 l_is_shared_proc_scenario := PO_SHARED_PROC_PVT.is_SPS_distribution(
103 p_destination_type_code => p_destination_type_code,
104 p_document_type_code => p_document_type_code,
105 p_purchasing_ou_id => p_purchasing_ou_id,
106 p_project_id => p_project_id,
107 p_ship_to_ou_id => l_ship_to_ou_id,
108 p_transaction_flow_header_id => p_transaction_flow_header_id);
109
110 IF (l_is_shared_proc_scenario) THEN
111 x_is_shared_proc_scenario := 'Y';
112 ELSE
113 x_is_shared_proc_scenario := 'N';
114 END IF;
115
116 x_return_status := FND_API.g_ret_sts_success;
117
118 EXCEPTION
119 WHEN FND_API.g_exc_error THEN
120 x_return_status := FND_API.g_ret_sts_error;
121 WHEN FND_API.g_exc_unexpected_error THEN
122 x_return_status := FND_API.g_ret_sts_unexp_error;
123 WHEN OTHERS THEN
124 x_return_status := FND_API.g_ret_sts_unexp_error;
125 FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
126 p_procedure_name => l_api_name);
127 END check_shared_proc_scenario;
128
129 END PO_SHARED_PROC_GRP;