1 Package OKL_RULE_APIS_PUB AUTHID CURRENT_USER As
2 /* $Header: OKLPRAPS.pls 120.4 2008/02/29 10:52:36 nikshah ship $ */
3
4 -----------------------------------------------
5 --global variables
6 -----------------------------------------------
7 G_API_TYPE CONSTANT VARCHAR2(5) := '_PUB';
8 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OKL_RULE_APIS_PUB';
9 G_APP_NAME CONSTANT VARCHAR2(3) := OKL_API.G_APP_NAME;
10 G_ERROR CONSTANT VARCHAR2(30) := 'OKL_CONTRACTS_ERROR';
11 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(30) := 'OKL_CONTRACTS_UNEXP_ERROR';
12 ------------------------------------------------
13 -- record structure for rule group
14 SUBTYPE rgpv_rec_type is OKL_RULE_APIS_PVT.rgpv_rec_type;
15 -- record structure for rule
16 SUBTYPE rulv_rec_type is OKL_RULE_APIS_PVT.rulv_rec_type;
17 -- table structure for rule group
18 SUBTYPE rgpv_tbl_type is OKL_RULE_APIS_PVT.rgpv_tbl_type;
19 -- table structure for rule
20 SUBTYPE rulv_tbl_type is OKL_RULE_APIS_PVT.rulv_tbl_type;
21 -- output record structure for displayed attributes of a rule's segments
22 -- for a given id1 and id2 for jtot_object will store name and description to be
23 -- displayed. For a rule_information segment will store name to be displayed
24 SUBTYPE rulv_disp_rec_type is OKL_RULE_APIS_PVT.rulv_disp_rec_type;
25
26 --Start of Comments
27 --Procedure Name : Get_Contract_Rgs
28 --Description : Get Contract Rule Groups for a chr_id, cle_id
29 -- if chr_id is given gets data for header
30 -- if only cle_id or cle_id and chr_id(dnz_chr_id) are given
31 -- fetches data for line
32 --
33 -- IN Parameters :
34 -- p_chr_id - contract header id for which rule group data is to
35 -- be fetched. (can be null if rule_groups attached at line level are
36 -- to be fetched)
37 --
38 -- p_cle_id - contract line id for which rule group data is to be
39 -- fetched. (can be null if rule groups attached at header level are
40 -- to be fetched)
41 --
42 -- p_rgd_code - rule group code which is to be fetched (can be passed
43 -- as null if all the rule groups are to be fetched)
44 --
45 -- OUT Parameters :
46 -- x_rgpv_tbl - table of okc_rule_groups_v type will cointain rule
47 -- group data fetched for a header or line.
48 --
49 -- x_rg_count - count of rule groups fetched
50 --End of comments
51
52 Procedure Get_Contract_Rgs(p_api_version IN NUMBER,
53 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
54 p_chr_id IN NUMBER,
55 p_cle_id IN NUMBER,
56 p_rgd_code IN VARCHAR2 default Null,
57 x_return_status OUT NOCOPY VARCHAR2,
58 x_msg_count OUT NOCOPY NUMBER,
59 x_msg_data OUT NOCOPY VARCHAR2,
60 x_rgpv_tbl OUT NOCOPY rgpv_tbl_type,
61 x_rg_count OUT NOCOPY NUMBER);
62 -- Start of Comments
63 -- Procedure : Get Contract Rules
64 -- Description : Gets all or specific rules for a rule group
65 --
66 -- IN Parameter :
67 -- p_rgpv_rec - record of okc_rule_groups_v type selected for
68 -- a contract header or contract line prior to calling this API
69 --
70 -- p_rdf_code - rule code (eg. 'BTO', 'LAINPR' etc.) . leave null
71 -- if required to pull all the rules under a rule group. Provide
72 -- value is required to fetch a specific rule record
73 --
74 -- OUT Parameters
75 -- x_rulev_tbl - table of okc_rules_v type will contain fetched
76 -- rule records
77 --
78 -- x_rule_count - count of rules fetched
79 -- End of Comments
80
81 Procedure Get_Contract_Rules(p_api_version IN NUMBER,
82 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
83 p_rgpv_rec IN rgpv_rec_type,
84 p_rdf_code IN VARCHAR2 default Null,
85 x_return_status OUT NOCOPY VARCHAR2,
86 x_msg_count OUT NOCOPY NUMBER,
87 x_msg_data OUT NOCOPY VARCHAR2,
88 x_rulv_tbl OUT NOCOPY rulv_tbl_type,
89 x_rule_count OUT NOCOPY NUMBER );
90
91 -- Start of comments
92 --Procedure : Get Rule Information
93 --Description : Fetches the display value (name) and select clause of the
94 -- rule information column in a rule if stored value(p_rule_info)
95 -- is provided else just returns the select clause
96 --
97 -- IN Parameters :
98 -- p_rdf_code : rule_code
99 -- p_appl_col_name : segment column name ('RULE_INFORMATION1',...)
100 -- p_rule_info : segment column value default Null
101 --
102 -- OUT Parameters :
103 -- x_name, x_select will return the name (rule value) and select
104 -- clause associated with the value set (if exists) for a
105 -- rule_information based rule.
106 --
107 -- End of Comments
108
109 Procedure Get_rule_Information (p_api_version IN NUMBER,
110 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
111 p_rdf_code IN VARCHAR2,
112 p_appl_col_name IN VARCHAR2,
113 p_rule_info IN VARCHAR2 default Null,
114 x_return_status OUT NOCOPY VARCHAR2,
115 x_msg_count OUT NOCOPY NUMBER,
116 x_msg_data OUT NOCOPY VARCHAR2,
117 x_name OUT NOCOPY VARCHAR2,
118 x_select OUT NOCOPY VARCHAR2);
119
120 -- Start of comments
121 --Procedure : Get_jtot_object
122 --Description : Fetches the display values (name,description) and additional
123 -- columns status, start_date, end_date, org_id, inv_org_id,
124 -- book_type_code, if present if id1 and id2 are given
125 -- Also returns the select clause associated with the jtf_object
126 -- whether id1, id2 values are given or not.
127 -- IN Parameters :
128 -- p_object_code - jtot object_code_name (fk to jtf_objects_b.object_code)
129 -- from which rule segment value is sourced.
130 --
131 -- p_id1 - (optional in case only jtf select clause is required) - id1
132 -- of source object view
133 --
134 -- p_id2 - (optional in case only jtf select clause is required) - id2
135 -- of source object view
136 --
137 -- OUT Parameters :
138 -- x_name, x_description, x_id1, x_id2, x_select will retun the
139 -- name (rule value), description, id1, id2 (rule ids) and select
140 -- clause used to fetch jtot_object based rule segment. x_status,
141 -- x_start_date_active, x_end_date_active, x_org_id, x_inv_org_id,
142 -- x_Book_Type_Code additionaly return status, start data,
143 -- end_date, operating unit id, inventory org id and FA book code
144 -- for the rule segment if these information exist.
145 -- End of Comments
146
147 Procedure Get_jtot_object(p_api_version IN NUMBER,
148 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
149 p_object_code IN VARCHAR2,
150 p_id1 IN VARCHAR2 default null,
151 p_id2 IN VARCHAR2 default null,
152 x_return_status OUT NOCOPY VARCHAR2,
153 x_msg_count OUT NOCOPY NUMBER,
154 x_msg_data OUT NOCOPY VARCHAR2,
155 x_id1 OUT NOCOPY VARCHAR2,
156 x_id2 OUT NOCOPY VARCHAR2,
157 x_name OUT NOCOPY VARCHAR2,
158 x_description OUT NOCOPY VARCHAR2,
159 x_status OUT NOCOPY VARCHAR2,
160 x_start_date OUT NOCOPY DATE,
161 x_end_date OUT NOCOPY DATE,
162 x_org_id OUT NOCOPY NUMBER,
163 x_inv_org_id OUT NOCOPY NUMBER,
164 x_book_type_code OUT NOCOPY VARCHAR2,
165 x_select OUT NOCOPY VARCHAR2);
166
167 --Start of Comments
168 --Procedure : Get_Rule_disp_value
169 --Description : Fetches the displayed values of all rule segments
170 --Note : This API fetches the displayed and stored values
171 -- for all the segments of a Rule
172 --
173 -- IN Parameters
174 -- p_rulev_rec - okc_k_rules_v record type selected prior to
175 -- calling this API for a contract header or line , for a specific
176 -- rule
177 --
178 -- OUT parameters
179 -- x_rulv_disp_rec - record of stored and displyed values of all
180 -- the rule segments. x_rulv_disp_rec attributes have the following
181 -- meaning
182 -- name, description, id1, id2, select will retun the
183 -- name (rule value), description, id1, id2 (rule ids) and select
184 -- clause used to fetch jtot_object based rule segment. status,
185 -- start_date_active, end_date_active, org_id, inv_org_id,
186 -- Book_Type_Code additionaly return status, start data,
187 -- end_date, operating unit id, inventory org id and FA book code
188 -- for the rule segment if these information exist.
189 --
190 -- RULE_INFORMATION_BASED Rule Segments :
191 -- name, select will return the name (rule value) and select
192 -- clause associated with the value set (if exists) for a
193 -- rule_information based rule.
194 --
195 -- If name, id1 and id2 are returned as null this means that
196 -- the data for the rule segment has not been entered or that
197 -- segment is not active for this rule definition
198 --End of Comments
199
200 Procedure Get_Rule_disp_value (p_api_version IN NUMBER,
201 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
202 p_rulv_rec IN Rulv_rec_type,
203 x_return_status OUT NOCOPY VARCHAR2,
204 x_msg_count OUT NOCOPY NUMBER,
205 x_msg_data OUT NOCOPY VARCHAR2,
206 x_rulv_disp_rec OUT NOCOPY rulv_disp_rec_type);
207 --Start of Comments
208 --Procedure : Get_Rule_Segment_value
209 --Description : Fetches the displayed value and select clauses of
210 -- of specific rule segment.
211 -- NOTE :
212 -- This API does not yet support rules where multiple cardinality
213 -- is possible like 'SLL', 'SLH'
214 --
215 -- IN Parameters :
216 -- p_chr_id - contract header id (for rules attached at header level
217 -- ,should be passed as null for rules attached at line level)
218 --
219 -- p_cle_id - contract line id (for rules attached at line level
220 -- , should be passed as null for rules attached at header level)
221 --
222 -- p_rgd_code - rule group code (eg. 'LABILL' for Billing setup,
223 -- 'LAEVEL' for evergreen eligibility)
224 --
225 -- p_rdf_code - rule code (eg. 'BTO' for Bill to Address, 'LAINPR'
226 -- for 'Invoice Pull for Review)
227 --
228 -- p_rdf_name - Name of the segment value to be fetched -
229 -- This API requires exact screen prompt label of the segment
230 -- to be passed as p_rdf_name (eg. 'Bill To Address',
231 -- 'Reason for Review' etc.)
232 --
233 -- OUT Parameters :
234 -- JTOT_OBJECT Based Rule Segments :
235 -- x_name, x_description, x_id1, x_id2, x_select will retun the
236 -- name (rule value), description, id1, id2 (rule ids) and select
237 -- clause used to fetch jtot_object based rule segment. x_status,
238 -- x_start_date_active, x_end_date_active, x_org_id, x_inv_org_id,
239 -- x_Book_Type_Code additionaly return status, start data,
240 -- end_date, operating unit id, inventory org id and FA book code
241 -- for the rule segment if these information exist.
242 --
243 -- RULE_INFORMATION_BASED Rule Segments :
244 -- x_name, x_select will return the name (rule value) and select
245 -- clause associated with the value set (if exists) for a
246 -- rule_information based rule.
247 --
248 -- If x_name, x_id1 and x_id2 are returned as null this means that
249 -- the data for the rule segment has not been entered.
250 --
251 --End of Comments
252
253
254 Procedure Get_rule_Segment_Value(p_api_version IN NUMBER,
255 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
256 x_return_status OUT NOCOPY VARCHAR2,
257 x_msg_count OUT NOCOPY NUMBER,
258 x_msg_data OUT NOCOPY VARCHAR2,
259 p_chr_id IN NUMBER,
260 p_cle_id IN NUMBER,
261 p_rgd_code IN VARCHAR2,
262 p_rdf_code IN VARCHAR2,
263 p_rdf_name IN VARCHAR2,
264 x_id1 OUT NOCOPY VARCHAR2,
265 x_id2 OUT NOCOPY VARCHAR2,
266 x_name OUT NOCOPY VARCHAR2,
267 x_description OUT NOCOPY VARCHAR2,
268 x_status OUT NOCOPY VARCHAR2,
269 x_start_date OUT NOCOPY DATE,
270 x_end_date OUT NOCOPY DATE,
271 x_org_id OUT NOCOPY NUMBER,
272 x_inv_org_id OUT NOCOPY NUMBER,
273 x_book_type_code OUT NOCOPY VARCHAR2,
274 x_select OUT NOCOPY VARCHAR2);
275 --Start of Comments
276 --Bug#2525946 : overloaded to take rule segment numbers as input
277 --Procedure : Get_Rule_Segment_value
278 --Description : Fetches the displayed value and select clauses of
279 -- of specific rule segment.
280 --Note : This API requires segment number
281 -- Segment number 1 to 15 are mapped to RULE_INFORMATION1 to
282 -- RULE_INFORMATION15. Segment Numbers 16, 17 and 18 are mapped
283 -- to jtot_object1, jtot_object2 and jtot_object3 respectively
284 --End of Comments
285
286 Procedure Get_rule_Segment_Value(p_api_version IN NUMBER,
287 p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
288 x_return_status OUT NOCOPY VARCHAR2,
289 x_msg_count OUT NOCOPY NUMBER,
290 x_msg_data OUT NOCOPY VARCHAR2,
291 p_chr_id IN NUMBER,
292 p_cle_id IN NUMBER,
293 p_rgd_code IN VARCHAR2,
294 p_rdf_code IN VARCHAR2,
295 p_segment_number IN NUMBER,
296 x_id1 OUT NOCOPY VARCHAR2,
297 x_id2 OUT NOCOPY VARCHAR2,
298 x_name OUT NOCOPY VARCHAR2,
299 x_description OUT NOCOPY VARCHAR2,
300 x_status OUT NOCOPY VARCHAR2,
301 x_start_date OUT NOCOPY DATE,
302 x_end_date OUT NOCOPY DATE,
303 x_org_id OUT NOCOPY NUMBER,
304 x_inv_org_id OUT NOCOPY NUMBER,
305 x_book_type_code OUT NOCOPY VARCHAR2,
306 x_select OUT NOCOPY VARCHAR2);
307
308
309 End OKL_RULE_APIS_PUB;