1 PACKAGE PO_CONTERMS_UTL_GRP AUTHID CURRENT_USER AS
2 /* $Header: POXGCTUS.pls 120.6.12020000.2 2013/02/10 20:14:49 vegajula ship $ */
3
4 -- Read the profile option that enables/disables the debug log
5 g_fnd_debug CONSTANT VARCHAR2(1) :=
6 NVL (FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
7
8 -- Read profile option 'contracts enabled'
9 g_contracts_enabled CONSTANT VARCHAR2(1) :=
10 NVL (FND_PROFILE.VALUE('POC_ENABLED'),'N');
11
12 -- <11i10+ Contracts ER Auto Apply terms>
13 -- Read profile option 'Auto Apply Contracts template'
14 g_auto_apply_template CONSTANT VARCHAR2(1) :=
15 NVL (FND_PROFILE.VALUE('PO_AUTO_APPLY_TEMPLATE'),'N');
16
17 -- declare categories table type based on contracts item category type dfn
18 SUBTYPE item_category_tbl_type IS OKC_TERMS_UTIL_GRP.category_tbl_type;
19
20 -- declare items table type based on contracts items table type definition
21 SUBTYPE item_tbl_type IS OKC_TERMS_UTIL_GRP.item_tbl_type;
22
23 -- define table type for supplier user list
24 SUBTYPE external_user_tbl_type IS PO_VENDORS_GRP.external_user_tbl_type;
25
26 -- Contracts variable codes TBL Type
27 SUBTYPE variable_code_tbl_type IS OKC_TERMS_UTIL_GRP.variable_code_tbl_type;
28
29 -- Contracts variable values TBL Type
30 SUBTYPE variable_value_tbl_type IS OKC_TERMS_UTIL_GRP.sys_var_value_tbl_type;
31
32 -- other
33 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_CONTERMS_UTL_GRP';
34 g_module_prefix CONSTANT VARCHAR2(50) := 'po.plsql.'||g_pkg_name||'.';
35
36 ---------------------------------------------------------------------------------
37 -- API to indicate if Procurement Contracts has been enabled or not.
38 ---------------------------------------------------------------------------------
39 FUNCTION is_contracts_enabled RETURN VARCHAR2;
40
41 ---------------------------------------------------------------------------------
42 -- Overloaded PROCEDURE to indicate if Contracts has been enabled or not.
43 ---------------------------------------------------------------------------------
44 PROCEDURE is_contracts_enabled
45 (p_api_version IN NUMBER --bug4028805
46 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
47 ,x_return_status OUT NOCOPY VARCHAR2
48 ,x_msg_count OUT NOCOPY NUMBER
49 ,x_msg_data OUT NOCOPY VARCHAR2
50 ,x_contracts_enabled OUT NOCOPY VARCHAR2);
51
52 ---------------------------------------------------------------------------------
53 -- Returns the Contract document type to be used for a purchase order
54 ---------------------------------------------------------------------------------
55 FUNCTION Get_Po_Contract_Doctype(p_sub_doc_type IN VARCHAR2) RETURN VARCHAR2;
56
57 ---------------------------------------------------------------------------------
58 -- Returns the Contract document type to be used for a Modification
59 ---------------------------------------------------------------------------------
60 FUNCTION Get_Po_Contract_Doctype_Mod(p_sub_doc_type IN VARCHAR2) RETURN VARCHAR2;
61
62 ---------------------------------------------------------------------------------
63 -- API to return supplier users for the given PO document. Please check cooments
64 -- body for more details.
65 ---------------------------------------------------------------------------------
66 PROCEDURE get_external_userlist
67 (p_api_version IN NUMBER --bug4028805
68 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
69 ,p_document_id IN NUMBER
70 ,p_document_type IN VARCHAR2
71 ,p_external_contact_id IN NUMBER DEFAULT NULL
72 ,x_return_status OUT NOCOPY VARCHAR2
73 ,x_msg_count OUT NOCOPY NUMBER
74 ,x_msg_data OUT NOCOPY VARCHAR2
75 ,x_external_user_tbl OUT NOCOPY external_user_tbl_type);
76
77
78 ---------------------------------------------------------------------------------
79 -- Overloaded API to return supplier users for the given PO document.
80 -- Please check comments section in the body for more details.
81 ---------------------------------------------------------------------------------
82 PROCEDURE get_external_userlist
83 (p_api_version IN NUMBER --bug4028805
84 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
85 ,p_document_id IN NUMBER
86 ,p_document_type IN VARCHAR2
87 ,p_external_contact_id IN NUMBER DEFAULT NULL
88 ,x_return_status OUT NOCOPY VARCHAR2
89 ,x_msg_count OUT NOCOPY NUMBER
90 ,x_msg_data OUT NOCOPY VARCHAR2
91 ,x_external_userlist OUT NOCOPY VARCHAR2);
92
93 ---------------------------------------------------------------------------------
94 -- API to generate the list of distinct item categories used in a PO document.
95 -- For more details please check the comments section in the body.
96 ---------------------------------------------------------------------------------
97 PROCEDURE get_item_categorylist
98 (p_api_version IN NUMBER
99 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
100 ,p_doc_type IN VARCHAR2 := NULL -- CLM Mod project
101 ,p_document_id IN NUMBER
102 ,x_return_status OUT NOCOPY VARCHAR2
103 ,x_msg_count OUT NOCOPY NUMBER
104 ,x_msg_data OUT NOCOPY VARCHAR2
105 ,x_category_tbl OUT NOCOPY item_category_tbl_type
106 ,x_item_tbl OUT NOCOPY item_tbl_type);
107
108 ---------------------------------------------------------------------------------
109 -- API to allow saving of changes to contract terms based on PO status
110 -- For more details on usage and assumptions, please check the comments section
111 -- in the package body
112 ---------------------------------------------------------------------------------
113 PROCEDURE IS_Po_Update_Allowed (
114 p_api_version IN NUMBER,
115 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
116 p_doc_type IN VARCHAR2 := NULL, -- CLM Mod project
117 p_header_id IN NUMBER,
118 p_callout_string IN VARCHAR2,
119 p_lock_flag IN VARCHAR2 DEFAULT 'N',
120 x_update_allowed OUT NOCOPY VARCHAR2,
121 x_return_status OUT NOCOPY VARCHAR2,
122 x_msg_data OUT NOCOPY VARCHAR2,
123 x_msg_count OUT NOCOPY NUMBER);
124
125 ----------------------------------------------------------------------------------------
126 -- API to make changes to Po headers whe template is attached or dropped from a
127 -- purchase order. For more details on usage and auumptions, please check comments
128 -- in package body
129 ----------------------------------------------------------------------------------------
130 PROCEDURE Apply_Template_Change (
131 p_api_version IN NUMBER,
132 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
133 p_doc_type IN VARCHAR2 := NULL, -- CLM Mod project
134 p_header_id IN NUMBER,
135 p_callout_string IN VARCHAR2,
136 p_template_changed IN VARCHAR2 DEFAULT 'N',
137 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
138 x_update_allowed OUT NOCOPY VARCHAR2,
139 x_return_status OUT NOCOPY VARCHAR2,
140 x_msg_data OUT NOCOPY VARCHAR2,
141 x_msg_count OUT NOCOPY NUMBER);
142
143 ----------------------------------------------------------------------------------------
144 -- API to check which variable values changed since last PO revision
145 -- For more details on usage and auumptions, please check comments
146 -- in package body
147 ----------------------------------------------------------------------------------------
148 PROCEDURE Attribute_Value_Changed (
149 p_api_version IN NUMBER,
150 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
151 p_doc_type IN VARCHAR2 := NULL, -- CLM Mod project
152 p_doc_id IN NUMBER,
153 p_sys_var_tbl IN OUT NOCOPY VARIABLE_CODE_TBL_TYPE,
154 x_return_status OUT NOCOPY VARCHAR2,
155 x_msg_data OUT NOCOPY VARCHAR2,
156 x_msg_count OUT NOCOPY NUMBER);
157
158 ----------------------------------------------------------------------------------------
159 -- API to return value of po attributes reffered in Contract Terms
160 -- For more details on usage and auumptions, please check comments
161 -- in package body
162 ----------------------------------------------------------------------------------------
163 PROCEDURE Get_PO_Attribute_Values(
164 p_api_version IN NUMBER,
165 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
166 p_doc_type IN VARCHAR2 := NULL, -- CLM Mod project
167 p_doc_id IN NUMBER,
168 p_sys_var_value_tbl IN OUT NOCOPY VARIABLE_VALUE_TBL_TYPE,
169 x_return_status OUT NOCOPY VARCHAR2,
170 x_msg_data OUT NOCOPY VARCHAR2,
171 x_msg_count OUT NOCOPY NUMBER);
172
173 ---------------------------------------------------------------------------------
174 -- API to return last Signed or Approved(no signature required)revision number
175 -- For more details on usage and assumptions, please check the comments section
176 -- in the package body
177 ---------------------------------------------------------------------------------
178 PROCEDURE Get_Last_Signed_Revision (
179 p_api_version IN NUMBER,
180 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
181 p_doc_type IN VARCHAR2 := NULL, -- CLM Mod project
182 p_header_id IN NUMBER,
183 p_revision_num IN NUMBER,
184 x_signed_revision_num OUT NOCOPY NUMBER,
185 x_signed_records OUT NOCOPY VARCHAR2,
186 x_return_status OUT NOCOPY VARCHAR2,
187 x_msg_data OUT NOCOPY VARCHAR2,
188 x_msg_count OUT NOCOPY NUMBER);
189
190 ---------------------------------------------------------------------------------
191 -- <11i10+ Contracts ER Auto Apply terms>
192 -- API to apply the default contract template to a purchasing document
193 -- For more details on usage and assumptions, please check the comments section
194 -- in the package body
195 ---------------------------------------------------------------------------------
196 PROCEDURE Auto_Apply_ConTerms (
197 p_document_id IN NUMBER,
198 p_template_id IN NUMBER,
199 x_return_status OUT NOCOPY VARCHAR2);
200
201 ---------------------------------------------------------------------------------
202 -- <Contracts ER Auto Apply terms>
203 -- API to get the default contract template to a purchasing document
204 -- For more details on usage and assumptions, please check the comments section
205 -- in the package body
206 ---------------------------------------------------------------------------------
207 -- <PAR Project> : After autocreating PAR to MOD, target doc id must be passed
208 -- which would be Mod Draft id created. Rewriting whoel procedure to support new
209 --API from contracts
210 PROCEDURE Copy_Conterms_Mod( --CLM Mod
211 p_document_id IN NUMBER,
212 p_draft_id IN NUMBER,
213 p_to_mod IN VARCHAR2 := 'N',
214 p_mode IN VARCHAR2 := 'CREATE',
215 p_target_draft_id IN NUMBER DEFAULT NULL,
216 x_return_status OUT NOCOPY VARCHAR2);
217 ---------------------------------------------------------------------------------
218 -- API to copy contract terms to modification
219 -- For more details on usage and assumptions, please check the comments section
220 -- in the package body
221 ---------------------------------------------------------------------------------
222 -- CLM Mod
223
224 PROCEDURE get_def_proc_contract_info (
225 p_doc_subtype IN VARCHAR2,
226 p_org_id IN NUMBER,
227 p_conterms_exist_flag IN VARCHAR2,
228 x_template_id OUT NOCOPY VARCHAR2,
229 x_template_name OUT NOCOPY VARCHAR2,
230 x_authoring_party OUT NOCOPY VARCHAR2,
231 x_return_status OUT NOCOPY VARCHAR2);
232
233
234 ---------------------------------------------------------------------------------
235 -- <R12 Procurement Contracts Integration>
236 -- API to get authoring party and template name from a document.
240 Procedure Get_Contract_Details(
237 -- For more details on usage and assumptions, please check the comments section
238 -- in the package body
239 ---------------------------------------------------------------------------------
241 x_return_status OUT NOCOPY VARCHAR2,
242 p_doc_type IN VARCHAR2 := NULL,
243 p_doc_subtype IN VARCHAR2,
244 p_document_id IN NUMBER,
245 x_authoring_party OUT NOCOPY VARCHAR2,
246 x_template_name OUT NOCOPY VARCHAR2
247 );
248
249 ---------------------------------------------------------------------------------
250 -- FP CU2-R12: Migrate PO
251 -- Function to check if the last archived version has conterms
252 ---------------------------------------------------------------------------------
253 FUNCTION get_archive_conterms_flag (p_po_header_id IN NUMBER)
254 RETURN VARCHAR2;
255
256 END PO_CONTERMS_UTL_GRP;