[Home] [Help]
PACKAGE BODY: APPS.PO_VALIDATIONS
Source
1 PACKAGE BODY PO_VALIDATIONS AS
2 -- $Header: PO_VALIDATIONS.plb 120.78.12010000.5 2008/12/18 13:24:37 ggandhi ship $
3
4 ---------------------------------------------------------------------------
5 -- Modules for debugging.
6 ---------------------------------------------------------------------------
7
8 -- The module base for this package.
9 D_PACKAGE_BASE CONSTANT VARCHAR2(50) :=
10 PO_LOG.get_package_base('PO_VALIDATIONS');
11
12 -- The module base for the subprogram.
13 D_next_result_set_id CONSTANT VARCHAR2(100) :=
14 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'next_result_set_id');
15
16 -- The module base for the subprogram.
17 D_commit_validation_results_au CONSTANT VARCHAR2(100) :=
18 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'commit_validation_results_auto');
19
20 -- The module base for the subprogram.
21 D_update_result_set CONSTANT VARCHAR2(100) :=
22 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'update_result_set');
23
24 -- The module base for the subprogram.
25 D_commit_result_set CONSTANT VARCHAR2(100) :=
26 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'commit_result_set');
27
28 -- The module base for the subprogram.
29 D_validate_set CONSTANT VARCHAR2(100) :=
30 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_set');
31
32 -- The module base for the subprogram.
33 D_result_type_rank CONSTANT VARCHAR2(100) :=
34 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'result_type_rank');
35
36 -- The module base for the subprogram.
37 D_delete_result_set_auto CONSTANT VARCHAR2(100) :=
38 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'delete_result_set_auto');
39
40 -- The module base for the subprogram.
41 D_delete_result_set CONSTANT VARCHAR2(100) :=
42 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'delete_result_set');
43
44 -- The module base for the subprogram.
45 D_replace_result_set_id CONSTANT VARCHAR2(100) :=
46 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'replace_result_set_id');
47
48 -- The module base for the subprogram.
49 D_insert_result CONSTANT VARCHAR2(100) :=
50 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'insert_result');
51
52 -- The module base for the subprogram.
53 D_validate_unit_price_change CONSTANT VARCHAR2(100) :=
54 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_unit_price_change');
55
56 -- The module base for the subprogram.
57 D_validate_html_order CONSTANT VARCHAR2(100) :=
58 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_html_order');
59 D_validate_html_agreement CONSTANT VARCHAR2(100) :=
60 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_html_agreement');
61 D_validate_pdoi CONSTANT VARCHAR2(100) :=
62 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_pdoi');
63
64 -- Indicates that the calling program is the OA HTML UI.
65 c_program_OA CONSTANT VARCHAR2(10) := 'OA';
66
67 -- Indicates that the calling program is PDOI.
68 c_program_PDOI CONSTANT VARCHAR2(10) := 'PDOI';
69
70 -- The application name of PO.
71 c_PO CONSTANT VARCHAR2(2) := 'PO';
72
73 c_parameter_YES CONSTANT VARCHAR2(1) := PO_CORE_S.g_parameter_YES;
74 c_parameter_NO CONSTANT VARCHAR2(1) := PO_CORE_S.g_parameter_NO;
75
76 c_doc_type_blanket CONSTANT VARCHAR2(30) := 'BLANKET';
77 c_doc_type_standard CONSTANT VARCHAR2(30) := 'STANDARD';
78 c_doc_type_quotation CONSTANT VARCHAR2(30) := 'QUOTATION';
79
80
81 /**
82 Used to rank result types, for summary results and other purposes.
83 For example, if one result is WARNING and the other is FAILURE,
84 then the overall result should be FAILURE. This is indicated
85 by the fact that FAILURE has a lower index in this list than WARNING.
86 */
87 c_result_type_rank_tbl CONSTANT PO_TBL_VARCHAR30 :=
88 PO_TBL_VARCHAR30(
89 c_result_type_FATAL
90 , c_result_type_FAILURE
91 , c_result_type_WARNING
92 , c_result_type_SUCCESS
93 );
94
95 --------------------------------------------------------------
96 -- Validation Subroutine Constants
97 --------------------------------------------------------------
98
99 --------------------------------------------------------------------------
100 -- Header Validation Constants
101 --------------------------------------------------------------------------
102 -- Common
103 c_warn_supplier_on_hold CONSTANT VARCHAR2(30) := 'C_WARN_SUPPLIER_ON_HOLD';
104 c_rate_gt_zero CONSTANT VARCHAR2(30) := 'C_RATE_GT_ZERO';
105 c_fax_email_address_valid CONSTANT VARCHAR2(30) := 'C_FAX_EMAIL_ADDRESS_VALID';
106 c_rate_combination_valid CONSTANT VARCHAR2(30) := 'C_RATE_COMBINATION_VALID';
107 c_doc_num_chars_valid CONSTANT VARCHAR2(30) := 'C_DOC_NUM_CHARS_VALID';
108 c_doc_num_unique CONSTANT VARCHAR2(30) := 'C_DOC_NUM_UNIQUE';
109 c_agent_id_not_null CONSTANT VARCHAR2(30) := 'C_AGENT_ID_NOT_NULL';
110 c_hdr_ship_to_loc_not_null CONSTANT VARCHAR2(30) := 'C_HDR_SHIP_TO_LOC_NOT_NULL';
111 c_segment1_not_null CONSTANT VARCHAR2(30) := 'C_SEGMENT1_NOT_NULL';
112 -- Agreements
113 c_price_update_tol_ge_zero CONSTANT VARCHAR2(30) := 'C_PRICE_UPDATE_TOL_GE_ZERO';
114 c_amount_limit_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_LIMIT_GE_ZERO';
115 c_amt_limit_ge_amt_agreed CONSTANT VARCHAR2(30) := 'C_AMT_LIMIT_GE_AMT_AGREED';
116 c_amount_agreed_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED_GE_ZERO';
117 c_amount_agreed_not_null CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED_NOT_NULL';
118 c_effective_le_expiration CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_LE_EXPIRATION';
119 c_effective_from_le_order_date CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_FROM_LE_ORDER_DATE';
120 c_effective_to_ge_order_date CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_TO_GE_ORDER_DATE';
121 c_vendor_id_not_null CONSTANT VARCHAR2(30) := 'C_VENDOR_ID_NOT_NULL';
122 c_vendor_site_id_not_null CONSTANT VARCHAR2(30) := 'C_VENDOR_SITE_ID_NOT_NULL';
123 -- Contracts
124 c_contract_start_le_order_date CONSTANT VARCHAR2(30) := 'C_CONTRACT_START_LE_ORDER_DATE';
125 c_contract_end_ge_order_date CONSTANT VARCHAR2(30) := 'C_CONTRACT_END_GE_ORDER_DATE';
126
127 --------------------------------------------------------------
128 -- PDOI Header Validation Subroutine Constants
129 --------------------------------------------------------------
130 c_po_header_id CONSTANT VARCHAR2(30) := 'C_PO_HEADER_ID';
131 c_end_date CONSTANT VARCHAR2(30) := 'C_END_DATE';
132 c_type_lookup_code CONSTANT VARCHAR2(30) := 'C_TYPE_LOOKUP_CODE';
133 c_revision_num CONSTANT VARCHAR2(30) := 'C_REVISION_NUM';
134 c_document_num CONSTANT VARCHAR2(30) := 'C_DOCUMENT_NUM';
135 c_currency_code CONSTANT VARCHAR2(30) := 'C_CURRENCY_CODE';
136 c_rate_info CONSTANT VARCHAR2(30) := 'C_RATE_INFO';
137 c_agent_id CONSTANT VARCHAR2(30) := 'C_AGENT_ID';
138 c_vendor_info CONSTANT VARCHAR2(30) := 'C_VENDOR_INFO';
139 c_ship_to_location_id CONSTANT VARCHAR2(30) := 'C_SHIP_TO_LOCATION_ID';
140 c_bill_to_location_id CONSTANT VARCHAR2(30) := 'C_BILL_TO_LOCATION_ID';
141 c_last_updated_by CONSTANT VARCHAR2(30) := 'C_LAST_UPDATED_BY';
142 c_last_update_date CONSTANT VARCHAR2(30) := 'C_LAST_UPDATE_DATE';
143 c_release_num CONSTANT VARCHAR2(30) := 'C_RELEASE_NUM';
144 c_po_release_id CONSTANT VARCHAR2(30) := 'C_PO_RELEASE_ID';
145 c_release_date CONSTANT VARCHAR2(30) := 'C_RELEASE_DATE';
146 c_revised_date CONSTANT VARCHAR2(30) := 'C_REVISED_DATE';
147 c_printed_date CONSTANT VARCHAR2(30) := 'C_PRINTED_DATE';
148 c_closed_date CONSTANT VARCHAR2(30) := 'C_CLOSED_DATE';
149 c_terms_id_header CONSTANT VARCHAR2(30) := 'C_TERMS_ID_HEADERS';
150 c_ship_via_lookup_code CONSTANT VARCHAR2(30) := 'C_SHIP_VIA_LOOKUP_CODE';
151 c_fob_lookup_code CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE';
152 c_freight_terms_lookup_code CONSTANT VARCHAR2(30) := 'C_FREIGHT_TERMS_LOOKUP_CODE';
153 c_shipping_control CONSTANT VARCHAR2(30) := 'C_SHIPPING_CONTROL';
154 c_approval_status CONSTANT VARCHAR2(30) := 'C_APPROVAL_STATUS';
155 c_acceptance_required_flag CONSTANT VARCHAR2(30) := 'C_ACCEPTANCE_REQUIRED_FLAG';
156 c_confirming_order_flag CONSTANT VARCHAR2(30) := 'C_CONFIRMING_ORDER_FLAG';
157 c_acceptance_due_date CONSTANT VARCHAR2(30) := 'C_ACCEPTANCE_DUE_DATE';
158 c_amount_agreed CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED';
159 c_firm_status_lookup_header CONSTANT VARCHAR2(30) := 'C_FIRM_STATUS_LOOKUP_HEADER';
160 c_cancel_flag CONSTANT VARCHAR2(30) := 'C_CANCEL_FLAG';
161 c_closed_code CONSTANT VARCHAR2(30) := 'C_CLOSED_CODE';
162 c_print_count CONSTANT VARCHAR2(30) := 'C_PRINT_COUNT';
163 c_frozen_flag CONSTANT VARCHAR2(30) := 'C_FROZEN_FLAG';
164 c_amount_to_encumber CONSTANT VARCHAR2(30) := 'C_AMOUNT_TO_ENCUMBER';
165 c_quote_warning_delay CONSTANT VARCHAR2(30) := 'C_QUOTE_WARNING_DELAY';
166 c_approval_required_flag CONSTANT VARCHAR2(30) := 'C_APPROVAL_REQUIRED_FLAG';
167 c_style_id CONSTANT VARCHAR2(30) := 'C_STYLE_ID';
168 c_amount_limit CONSTANT VARCHAR2(30) := 'C_AMOUNT_LIMIT';
169 c_advance_amount CONSTANT VARCHAR2(30) := 'C_ADVANCE_AMOUNT';
170
171 --------------------------------------------------------------------------
172 -- Line Validation Constants
173 --------------------------------------------------------------------------
174 -- Common
175 c_src_doc_line_not_null CONSTANT VARCHAR2(30) := 'C_SRC_DOC_LINE_NOT_NULL';
176 -- Orders
177 c_amt_agreed_ge_zero CONSTANT VARCHAR2(30) := 'C_AMT_AGREED_GE_ZERO';
178 c_min_rel_amt_ge_zero CONSTANT VARCHAR2(30) := 'C_MIN_REL_AMT_GE_ZERO';
179 c_line_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GT_ZERO';
180 -- <Complex Work R12>: Consolidated qty billed/rcvd checks into exec check
181 c_line_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GE_QTY_EXEC';
182 c_line_qty_ge_qty_enc CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GE_QTY_ENC';
183 c_quantity_notif_change CONSTANT VARCHAR2(30) := 'C_QUANTITY_NOTIF_CHANGE';
184 c_line_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GT_ZERO';
185 -- <Complex Work R12>: Consolidated amt billed/rcvd checks into exec check
186 c_line_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GE_AMT_EXEC';
187 c_line_amt_ge_timecard CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GE_TIMECARD';
188 c_line_num_unique CONSTANT VARCHAR2(30) := 'C_LINE_NUM_UNIQUE';
189 c_line_num_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_NUM_GT_ZERO';
190 c_vmi_asl_exists CONSTANT VARCHAR2(30) := 'C_VMI_ASL_EXISTS';
191 c_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_START_DATE_LE_END_DATE';
192 c_otl_inv_start_date_change CONSTANT VARCHAR2(30) := 'C_OTL_INV_START_DATE_CHANGE';
193 c_otl_inv_end_date_change CONSTANT VARCHAR2(30) := 'C_OTL_INV_END_DATE_CHANGE';
194 c_unit_price_ge_zero CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE_GE_ZERO';
195 c_list_price_ge_zero CONSTANT VARCHAR2(30) := 'C_LIST_PRICE_GE_ZERO';
196 c_market_price_ge_zero CONSTANT VARCHAR2(30) := 'C_MARKET_PRICE_GE_ZERO';
197 c_validate_unit_price_change CONSTANT VARCHAR2(30) := 'C_VALIDATE_UNIT_PRICE_CHANGE';
198 -- Agreements
199 c_expiration_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_EXPIRATION_GE_BLANKET_START';
200 c_expiration_le_blanket_end CONSTANT VARCHAR2(30) := 'C_EXPIRATION_LE_BLANKET_END';
201 -- <Complex Work R12 Start>
202 c_qty_ge_qty_milestone_exec CONSTANT VARCHAR2(30) := 'C_QTY_GE_QTY_MILESTONE_EXEC';
203 c_price_ge_price_mstone_exec CONSTANT VARCHAR2(30) := 'C_PRICE_GE_PRICE_MSTONE_EXEC';
204 c_recoupment_rate_range_check CONSTANT VARCHAR2(30) := 'C_RECOUPMENT_RATE_RANGE_CHECK'; -- Bug 5072189
205 c_retainage_rate_range_check CONSTANT VARCHAR2(30) := 'C_RETAINAGE_RATE_RANGE_CHECK'; -- Bug 5072189
206 c_prog_pay_rate_range_check CONSTANT VARCHAR2(30) := 'C_PROG_PAY_RATE_RANGE_CHECK'; -- Bug 5072189
207 c_max_retain_amt_ge_zero CONSTANT VARCHAR2(30) := 'C_MAX_RETAIN_AMT_GE_ZERO'; -- Bug 5221843
208 c_max_retain_amt_ge_retained CONSTANT VARCHAR2(30) := 'C_MAX_RETAIN_AMT_LE_RETAINED'; -- Bug 5453079
209 -- <Complex Work R12 End>
210 c_unit_meas_not_null CONSTANT VARCHAR2(30) := 'C_UNIT_MEAS_NOT_NULL';
211 c_item_description_not_null CONSTANT VARCHAR2(30) := 'C_ITEM_DESCRIPTION_NOT_NULL';
212 c_category_id_not_null CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_NOT_NULL';
213 c_item_id_not_null CONSTANT VARCHAR2(30) := 'C_ITEM_ID_NOT_NULL';
214 c_temp_labor_job_id_not_null CONSTANT VARCHAR2(30) := 'C_TEMP_LABOR_JOB_ID_NOT_NULL';
215 c_line_type_id_not_null CONSTANT VARCHAR2(30) := 'C_LINE_TYPE_ID_NOT_NULL';
216 c_temp_lbr_start_date_not_null CONSTANT VARCHAR2(30) := 'C_TEMP_LBR_START_DATE_NOT_NULL';
217 -- OPM Integration R12
218 c_line_sec_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_SEC_QTY_GT_ZERO';
219 c_line_qtys_within_deviation CONSTANT VARCHAR2(30) := 'C_LINE_QTYS_WITHIN_DEVIATION';
220 c_from_line_id_not_null CONSTANT VARCHAR2(30) := 'C_FROM_LINE_ID_NOT_NULL';
221 c_amt_ge_advance_amt CONSTANT VARCHAR2(30) := 'C_AMT_GE_ADVANCE_AMT'; -- Bug 5446881
222 c_line_dff_validate CONSTANT VARCHAR2(30) := 'C_LINE_DFF_VALIDATE'; -- Bug 7516824
223
224 -------------------------------------------------------------------
225 -- PDOI Line Validation constants
226 -------------------------------------------------------------------
227 c_over_tolerance_error_flag CONSTANT VARCHAR2(30) := 'C_OVER_TOLERANCE_ERROR_FLAG';
228 c_expiration_date_blanket CONSTANT VARCHAR2(30) := 'C_EXPIRATION_DATE_BLANKET';
229 c_global_agreement_flag CONSTANT VARCHAR2(30) := 'C_GLOBAL_AGREEMENT_FLAG';
230 c_amount_blanket CONSTANT VARCHAR2(30) := 'C_AMOUNT_BLANKET';
231 c_order_type_lookup_code CONSTANT VARCHAR2(30) := 'C_ORDER_TYPE_LOOKUP_CODE';
232 c_contractor_name CONSTANT VARCHAR2(30) := 'C_CONTRACTOR_NAME';
233 c_job_id CONSTANT VARCHAR2(30) := 'C_JOB_ID';
234 c_job_business_group_id CONSTANT VARCHAR2(30) := 'C_JOB_BUSINESS_GROUP_ID';
235 c_capital_expense_flag CONSTANT VARCHAR2(30) := 'C_CAPITAL_EXPENSE_FLAG';
236 c_un_number_id CONSTANT VARCHAR2(30) := 'C_UN_NUMBER_ID';
237 c_hazard_class_id CONSTANT VARCHAR2(30) := 'C_HAZARD_CLASS_ID';
238 c_item_id CONSTANT VARCHAR2(30) := 'C_ITEM_ID';
239 c_item_description CONSTANT VARCHAR2(30) := 'C_ITEM_DESCRIPTION';
240 c_unit_meas_lookup_code CONSTANT VARCHAR2(30) := 'C_UNIT_MEAS_LOOKUP_CODE';
241 c_item_revision CONSTANT VARCHAR2(30) := 'C_ITEM_REVISION';
242 c_category_id CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID';
243 c_category_id_null CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_NULL';
244 c_ip_category_id CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID';
245 c_unit_price CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE';
246 c_quantity CONSTANT VARCHAR2(30) := 'C_QUANTITY';
247 c_amount CONSTANT VARCHAR2(30) := 'C_AMOUNT';
248 c_rate_type CONSTANT VARCHAR2(30) := 'C_RATE_TYPE';
249 c_line_num CONSTANT VARCHAR2(30) := 'C_LINE_NUM';
250 c_po_line_id CONSTANT VARCHAR2(30) := 'C_PO_LINE_ID';
251 c_line_type_id CONSTANT VARCHAR2(30) := 'C_LINE_TYPE_ID';
252 c_price_type_lookup_code CONSTANT VARCHAR2(30) := 'C_PRICE_TYPE_LOOKUP_CODE';
253 c_start_date_standard CONSTANT VARCHAR2(30) := 'C_START_DATE_STANDARD';
254 c_item_id_standard CONSTANT VARCHAR2(30) := 'C_ITEM_ID_STANDARD';
255 c_quantity_standard CONSTANT VARCHAR2(30) := 'C_QUANTITY_STANDARD';
256 c_amount_standard CONSTANT VARCHAR2(30) := 'C_AMOUNT_STANDARD';
257 c_price_break_lookup_code CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_LOOKUP_CODE';
258 c_not_to_exceed_price CONSTANT VARCHAR2(30) := 'C_NOT_TO_EXCEED_PRICE';
259 c_release_num_null CONSTANT VARCHAR2(30) := 'C_RELEASE_NUM_NULL';
260 c_po_release_id_null CONSTANT VARCHAR2(30) := 'C_PO_RELEASE_ID_NULL';
261 c_source_shipment_id_null CONSTANT VARCHAR2(30) := 'C_SOURCE_SHIPMENT_ID_NULL';
262 c_contract_num_null CONSTANT VARCHAR2(30) := 'C_CONTRACT_NUM_NULL';
263 c_contract_id_null CONSTANT VARCHAR2(30) := 'C_CONTRACT_ID_NULL';
264 c_type_1099_null CONSTANT VARCHAR2(30) := 'C_TYPE_1099_NULL';
265 c_closed_code_null CONSTANT VARCHAR2(30) := 'C_CLOSED_CODE_NULL';
266 c_closed_date_null CONSTANT VARCHAR2(30) := 'C_CLOSED_DATE_NULL';
267 c_closed_by_null CONSTANT VARCHAR2(30) := 'C_CLOSED_BY_NULL';
268 c_committed_amount_null CONSTANT VARCHAR2(30) := 'C_COMMITTED_AMOUNT_NULL';
269 c_allow_price_override_null CONSTANT VARCHAR2(30) := 'C_ALLOW_PRICE_OVERRIDE_NULL';
270 c_negotiated_by_preparer_null CONSTANT VARCHAR2(30) := 'C_NEGOTIATED_BY_PREPARER_NULL';
271 c_capital_expense_flag_null CONSTANT VARCHAR2(30) := 'C_CAPTIAL_EXPENSE_FLAG_NULL';
272 c_min_release_amount_null CONSTANT VARCHAR2(30) := 'C_MIN_RELEASE_AMOUNT_NULL';
273 c_market_price_null CONSTANT VARCHAR2(30) := 'C_MARKET_PRICE_NULL';
274 c_ip_category_id_null CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID_NULL';
275 c_uom_update CONSTANT VARCHAR2(30) := 'C_UOM_UPDATE';
276 c_item_desc_update CONSTANT VARCHAR2(30) := 'C_ITEM_DESC_UPDATE';
277 c_ip_category_id_update CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID_UPDATE';
278 c_line_secondary_uom CONSTANT VARCHAR2(30) := 'C_LINE_SECONDARY_UOM';
279 c_line_secondary_quantity CONSTANT VARCHAR2(30) := 'C_LINE_SECONDARY_QUANTITY';
280 c_line_preferred_grade CONSTANT VARCHAR2(30) := 'C_LINE_PREFERRED_GRADE';
281 c_line_style_related_info CONSTANT VARCHAR2(30) := 'C_LINE_STYLE_RELATED_INFO';
282 c_negotiated_by_preparer CONSTANT VARCHAR2(30) := 'C_NEGOTIATED_BY_PREPARER';
283 c_negotiated_by_prep_update CONSTANT VARCHAR2(50) := 'C_NEGOTIATED_BY_PREPARER_UPDATE';
284 c_category_id_update CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_UPDATE';
285 c_unit_price_update CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE_UPDATE';
286 c_amount_update CONSTANT VARCHAR2(30) := 'C_AMOUNT_UPDATE';
287 --------------------------------------------------------------------------
288 -- Shipment Validation Constants
289 --------------------------------------------------------------------------
290 c_days_early_gte_zero CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_GTE_ZERO';
291 c_days_late_gte_zero CONSTANT VARCHAR2(30) := 'C_DAYS_LATE_GTE_ZERO';
292 c_rcv_close_tol_within_range CONSTANT VARCHAR2(30) := 'C_RCV_CLOSE_TOL_WITHIN_RANGE';
293 c_over_rcpt_tol_within_range CONSTANT VARCHAR2(30) := 'C_OVER_RCPT_TOL_WITHIN_RANGE';
294 c_match_4way_check CONSTANT VARCHAR2(30) := 'C_MATCH_4WAY_CHECK';
295 c_inv_close_tol_range_check CONSTANT VARCHAR2(30) := 'C_INV_CLOSE_TOL_RANGE_CHECK';
296 c_need_by_date_open_per_check CONSTANT VARCHAR2(30) := 'C_NEED_BY_DATE_OPEN_PER_CHECK';
297 c_promise_date_open_per_check CONSTANT VARCHAR2(30) := 'C_PROMISE_DATE_OPEN_PER_CHECK';
298 c_ship_to_org_null_check CONSTANT VARCHAR2(30) := 'C_SHIP_TO_ORG_NULL_CHECK';
299 c_ship_to_loc_null_check CONSTANT VARCHAR2(30) := 'C_SHIP_TO_LOC_NULL_CHECK';
300 c_ship_num_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_NUM_GT_ZERO';
301 c_ship_num_unique_check CONSTANT VARCHAR2(30) := 'C_SHIP_NUM_UNIQUE_CHECK';
302 c_is_org_in_current_sob_check CONSTANT VARCHAR2(30) := 'C_IS_ORG_IN_CURRENT_SOB_CHECK';
303 c_ship_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_QTY_GT_ZERO';
304 -- <Complex Work R12>: Consolidated qty billed/rcvd checks into exec check
305 c_ship_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_SHIP_QTY_GE_QTY_EXEC';
306 c_ship_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_AMT_GT_ZERO';
307 -- <Complex Work R12>: Consolidated amt billed/rcvd checks into exec check
308 c_ship_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_SHIP_AMT_GE_AMT_EXEC';
309 -- OPM Integration R12
310 c_ship_sec_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_SEC_QTY_GT_ZERO';
311 c_ship_qtys_within_deviation CONSTANT VARCHAR2(30) := 'C_SHIP_QTYS_WITHIN_DEVIATION';
312 c_unit_of_measure_not_null CONSTANT VARCHAR2(30) := 'C_UNIT_OF_MEAS_NOT_NULL'; -- Bug 5385686
313 c_ship_dff_validate CONSTANT VARCHAR2(30) := 'C_SHIP_DFF_VALIDATE'; -- Bug 7516824
314
315 ------------------------------------------------------------------
316 -- PDOI Shipment Validation Subroutine Constants
317 ------------------------------------------------------------------
318 c_shipment_need_by_date CONSTANT VARCHAR2(30) := 'C_SHIPMENT_NEED_BY_DATE';
319 c_shipment_promised_date CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PROMISED_DATE';
320 c_shipment_type_blanket CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_BLANKET';
321 c_shipment_type_standard CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_STANDARD';
322 c_shipment_type_quotation CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_QUOTATION';
323 c_shipment_num CONSTANT VARCHAR2(30) := 'C_SHIPMENT_NUM';
324 c_shipment_quantity CONSTANT VARCHAR2(30) := 'C_SHIPMENT_QUANTITY';
325 c_shipment_price_override CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PRICE_OVERRIDE';
326 c_shipment_price_discount CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PRICE_DISCOUNT';
327 c_ship_to_organization_id CONSTANT VARCHAR2(30) := 'C_SHIP_TO_ORGANIZATION_ID';
328 c_shipment_effective_dates CONSTANT VARCHAR2(30) := 'C_SHIPMENT_EFFECTIVE_DATES';
329 c_qty_rcv_exception_code CONSTANT VARCHAR2(30) := 'C_QTY_RCV_EXCEPTION_CODE';
330 c_enforce_ship_to_loc_code CONSTANT VARCHAR2(30) := 'C_ENFORCE_SHIP_TO_LOC_CODE';
331 c_allow_sub_receipts_flag CONSTANT VARCHAR2(30) := 'C_ALLOW_SUB_RECEIPTS_FLAG';
332 c_days_early_receipt_allowed CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_RECEIPT_ALLOWD';
333 c_receipt_days_exception_code CONSTANT VARCHAR2(30) := 'C_RECEIPT_DAYS_EXCEPTION_CODE';
334 c_invoice_close_tolerance CONSTANT VARCHAR2(30) := 'C_INVOICE_CLOSE_TOLERANCE';
335 c_receive_close_tolerance CONSTANT VARCHAR2(30) := 'C_RECEIVE_CLOSE_TOLERANCE';
336 c_receiving_routing_id CONSTANT VARCHAR2(30) := 'C_RECEIVING_ROUTING_ID';
337 c_accrue_on_receipt_flag CONSTANT VARCHAR2(30) := 'C_ACCRUE_ON_RECEIPT_FLAG';
338 c_terms_id_line_loc CONSTANT VARCHAR2(30) := 'C_TERMS_ID_LINE_LOC';
339 c_need_by_date_null CONSTANT VARCHAR2(30) := 'C_NEED_BY_DATE_NULL';
340 c_firm_flag_null CONSTANT VARCHAR2(30) := 'C_FIRM_FLAG_NULL';
341 c_promised_date_null CONSTANT VARCHAR2(30) := 'C_PROMISED_DATE_NULL';
342 c_over_tolerance_err_flag_null CONSTANT VARCHAR2(30) := 'C_OVER_TOLERANCE_ERR_FLAG_NULL';
343 c_qty_rcv_tolerance_null CONSTANT VARCHAR2(30) := 'C_QTY_RCV_TOLERANCE_NULL';
344 c_qty_rcv_exception_code_null CONSTANT VARCHAR2(30) := 'C_QTY_RCV_EXCEPTION_CODE_NULL';
345 c_receipt_required_flag_null CONSTANT VARCHAR2(30) := 'C_RECEIPT_REQUIRED_FLAG_NULL';
346 c_inspection_reqd_flag_null CONSTANT VARCHAR2(30) := 'C_INSPECTION_REQD_FLAG_NULL';
347 c_receipt_days_exception_null CONSTANT VARCHAR2(30) := 'C_RECEIPT_DATES_EXCEPTION_NULL';
348 c_invoice_close_toler_null CONSTANT VARCHAR2(30) := 'C_INVOICE_CLOSE_TOLER_NULL';
349 c_receive_close_toler_null CONSTANT VARCHAR2(30) := 'C_RECEIVE_CLOSE_TOLER_NULL';
350 c_days_early_rcpt_allowed_null CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_RCPT_ALLOWED_NULL';
351 c_days_late_rcpt_allowed_null CONSTANT VARCHAR2(30) := 'C_DAYS_LATE_RCPT_ALLOWED_NULL';
352 c_enfrce_ship_to_loc_code_null CONSTANT VARCHAR2(30) := 'C_ENFRCE_SHIP_TO_LOC_CODE_NULL';
353 c_allow_sub_receipts_flag_null CONSTANT VARCHAR2(30) := 'C_ALLOW_SUB_RECEIPTS_FLAG_NULL';
354 c_receiving_routing_null CONSTANT VARCHAR2(30) := 'C_RECEIVING_ROUTING_NULL';
355 c_line_loc_secondary_uom CONSTANT VARCHAR2(30) := 'C_LINE_LOC_SECONDARY_UOM';
356 c_line_loc_secondary_quantity CONSTANT VARCHAR2(30) := 'C_LINE_LOC_SECONDARY_QUANTITY';
357 c_line_loc_preferred_grade CONSTANT VARCHAR2(30) := 'C_LINE_LOC_PREFERRED_GRADE';
358 c_line_loc_style_related_info CONSTANT VARCHAR2(30) := 'C_LINE_LOC_STYLE_RELATED_INFO';
359 c_price_break CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK';
360 c_tax_name CONSTANT VARCHAR2(30) := 'C_TAX_NAME';
361 c_fob_lookup_code_line_loc CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE_LINE_LOC';
362 c_freight_terms_line_loc CONSTANT VARCHAR2(40) := 'C_FREIGHT_TERMS_LOOKUP_LINE_LOC';
363 c_freight_carrier_line_loc CONSTANT VARCHAR2(30) := 'C_FREIGHT_CARRIER_LINE_LOC';
364 c_freight_carrier_null CONSTANT VARCHAR2(30) := 'C_FREIGHT_CARRIER_NULL';
365 c_fob_lookup_code_null CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE_NULL';
366 c_freight_terms_lookup_null CONSTANT VARCHAR2(30) := 'C_FREIGHT_TERMS_LOOKUP_NULL';
367
368 --------------------------------------------------------------------------
369 -- Price Break Validation Constants
370 --------------------------------------------------------------------------
371 c_at_least_one_required_field CONSTANT VARCHAR2(30) := 'C_AT_LEAST_ONE_REQUIRED_FIELD';
372 c_price_discount_in_percent CONSTANT VARCHAR2(30) := 'C_PRICE_DISCOUNT_IN_PERCENT';
373 c_price_override_gt_zero CONSTANT VARCHAR2(30) := 'C_PRICE_OVERRIDE_GT_ZERO';
374 c_price_break_qty_ge_zero CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_QTY_GE_ZERO';
375 c_price_break_start_le_end CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_START_LE_END';
376 c_break_start_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_BREAK_START_GE_BLANKET_START';
377 c_break_start_le_blanket_end CONSTANT VARCHAR2(30) := 'C_BREAK_START_LE_BLANKET_END';
378 c_break_start_le_expiration CONSTANT VARCHAR2(30) := 'C_BREAK_START_LE_EXPIRATION';
379 c_break_end_le_expiration CONSTANT VARCHAR2(30) := 'C_BREAK_END_LE_EXPIRATION';
380 c_break_end_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_BREAK_END_GE_BLANKET_START';
381 c_break_end_le_blanket_end CONSTANT VARCHAR2(30) := 'C_BREAK_END_LE_BLANKET_END';
382
383 --------------------------------------------------------------------------
384 -- Distribution Validation Constants
385 --------------------------------------------------------------------------
386 c_dist_num_unique CONSTANT VARCHAR2(30) := 'C_DIST_NUM_UNIQUE';
387 c_dist_num_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_NUM_GT_ZERO';
388 c_dist_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_QTY_GT_ZERO';
389 -- <Complex Work R12>: Combine del and billed into exec
390 c_dist_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_DIST_QTY_GE_QTY_EXEC';
391 c_dist_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_AMT_GT_ZERO';
392 -- <Complex Work R12>: Combine del and billed into exec
393 c_dist_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_DIST_AMT_GE_AMT_EXEC';
394 c_pjm_unit_number_effective CONSTANT VARCHAR2(30) := 'C_PJM_UNIT_NUMBER_EFFECTIVE';
395 c_oop_enter_all_fields CONSTANT VARCHAR2(30) := 'C_OOP_ENTER_ALL_FIELDS';
396 -- Agreements
397 c_amount_to_encumber_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_TO_ENCUMBER_GE_ZERO';
398 c_budget_account_id_not_null CONSTANT VARCHAR2(30) := 'C_BUDGET_ACCOUNT_ID_NOT_NULL';
399 c_gl_encumbered_date_not_null CONSTANT VARCHAR2(30) := 'C_GL_ENCUMBERED_DATE_NOT_NULL';
400 c_gl_enc_date_not_null_open CONSTANT VARCHAR2(30) := 'C_GL_ENC_DATE_NOT_NULL_OPEN';
401 c_gms_data_valid CONSTANT VARCHAR2(30) := 'C_GMS_DATA_VALID';
402 c_unencum_amt_le_amt_to_encum CONSTANT VARCHAR2(30) := 'C_UNENCUM_AMT_LE_AMT_TO_ENCUM';
403
404
405 c_dist_amount_ordered CONSTANT VARCHAR2(30) := 'C_DIST_AMOUNT_ORDERED';
406 c_dist_quantity_ordered CONSTANT VARCHAR2(30) := 'C_DIST_QUANTITY_ORDERED';
407 c_dist_destination_org_id CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_ORG_ID';
408 c_dist_deliver_to_location_id CONSTANT VARCHAR2(30) := 'C_DIST_DELIVER_TO_LOCATION_ID';
409 c_dist_deliver_to_person_id CONSTANT VARCHAR2(30) := 'C_DIST_DELIVER_TO_PERSON_ID';
410 c_dist_destination_type_code CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_TYPE_CODE';
411 c_dist_destination_subinv CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_SUBINV';
412 c_dist_wip_entity_id CONSTANT VARCHAR2(30) := 'C_DIST_WIP_ENTITY_ID';
413 c_prevent_encumberance_flag CONSTANT VARCHAR2(30) := 'C_PREVENT_ENCUMBERANCE_FLAG';
414 c_charge_account_id CONSTANT VARCHAR2(30) := 'C_CHARGE_ACCOUNT_ID';
415 c_budget_account_id CONSTANT VARCHAR2(30) := 'C_BUDGET_ACCOUNT_ID';
416 c_accrual_account_id CONSTANT VARCHAR2(30) := 'C_ACCRUAL_ACCOUNT_ID';
417 c_variance_account_id CONSTANT VARCHAR2(30) := 'C_VARIANCE_ACCOUNT_ID';
418 c_project_acct_context CONSTANT VARCHAR2(30) := 'C_PROJECT_ACCT_CONTEXT';
419 c_project_info CONSTANT VARCHAR2(30) := 'C_PROJECT_INFO';
420 c_tax_recovery_override_flag CONSTANT VARCHAR2(30) := 'C_TAX_RECOVERY_OVERRIDE_FLAG';
421 c_check_fv_validations CONSTANT VARCHAR2(30) := 'C_CHECK_FV_VALIDATIONS';
422 c_check_proj_rel_validations CONSTANT VARCHAR2(30) := 'C_CHECK_PROJ_REL_VALIDATIONS'; -- Bug 5442682
423 c_dist_dff_validate CONSTANT VARCHAR2(30) := 'C_DIST_DFF_VALIDATE'; -- Bug 7516824
424
425 --------------------------------------------------------------------------
426 -- Notification Control Validation Constants
427 --------------------------------------------------------------------------
428 c_notif_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_NOTIF_START_DATE_LE_END_DATE';
429 c_notif_percent_le_one_hundred CONSTANT VARCHAR2(30) := 'C_NOTIF_PERCENT_LE_ONE_HUNDRED';
430 c_notif_amount_gt_zero CONSTANT VARCHAR2(30) := 'C_NOTIF_AMOUNT_GT_ZERO';
431 c_notif_amount_not_null CONSTANT VARCHAR2(30) := 'C_NOTIF_AMOUNT_NOT_NULL';
432 c_notif_start_date_not_null CONSTANT VARCHAR2(30) := 'C_NOTIF_START_DATE_NOT_NULL';
433
434
435 --------------------------------------------------------------------------
436 -- GA Org Assignment Validation Constants
437 --------------------------------------------------------------------------
438 c_assign_purch_org_not_null CONSTANT VARCHAR2(30) := 'C_ASSIGN_PURCH_ORG_NOT_NULL';
439 c_assign_vendor_site_not_null CONSTANT VARCHAR2(30) := 'C_ASSIGN_VENDOR_SITE_NOT_NULL';
440
441
442 --------------------------------------------------------------------------
443 -- Price Differential Validation Constants
444 --------------------------------------------------------------------------
445 -- Common
446 c_unique_price_diff_num CONSTANT VARCHAR2(30) := 'C_UNIQUE_PRICE_DIFF_NUM';
447 c_price_diff_num_gt_zero CONSTANT VARCHAR2(30) := 'C_PRICE_DIFF_NUM_GT_ZERO';
448 c_unique_price_type CONSTANT VARCHAR2(30) := 'C_UNIQUE_PRICE_TYPE';
449 -- Agreements
450 c_max_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MAX_MUL_GE_ZERO';
451 c_max_mul_ge_min_mul CONSTANT VARCHAR2(30) := 'C_MAX_MUL_GE_MIN_MUL';
452 c_min_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MIN_MUL_GE_ZERO';
453 -- Orders
454 c_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MUL_GE_ZERO';
455 c_spo_price_type_on_src_doc CONSTANT VARCHAR2(30) := 'C_SPO_PRICE_TYPE_ON_SRC_DOC';
456 c_spo_mul_btwn_min_max CONSTANT VARCHAR2(30) := 'C_SPO_MUL_BTWN_MIN_MAX';
457 c_spo_mul_ge_min CONSTANT VARCHAR2(30) := 'C_SPO_MUL_GE_MIN';
458
459 -------------------------------------------------------------
460 -- PDOI Price Differential Validation constants
461 -------------------------------------------------------------
462 c_price_type CONSTANT VARCHAR2(30) := 'C_PRICE_TYPE';
463 c_multiple_price_diff CONSTANT VARCHAR2(30) := 'C_MULTIPLE_PRICE_DIFF';
464 c_entity_type CONSTANT VARCHAR2(30) := 'C_ENTITY_TYPE';
465 c_multiplier CONSTANT VARCHAR2(30) := 'C_MULTIPLIER';
466 c_min_multiplier CONSTANT VARCHAR2(30) := 'C_MIN_MULTIPLIER';
467 c_max_multiplier CONSTANT VARCHAR2(30) := 'C_MAX_MULTIPLIER';
468 c_price_diff_style_info CONSTANT VARCHAR2(30) := 'C_PRICE_DIFF_STYLE_INFO';
469
470
471
472 --------------------------------------------------------------------------
473 -- Used to validate that a change to the unit price is allowed.
474 --------------------------------------------------------------------------
475 c_no_dists_reserved CONSTANT VARCHAR2(30) := 'C_NO_DISTS_RESERVED';
476 c_accruals_allow_update CONSTANT VARCHAR2(30) := 'C_ACCRUALS_ALLOW_UPDATE';
477 c_no_timecards_exist CONSTANT VARCHAR2(30) := 'C_NO_TIMECARDS_EXIST';
478 c_no_pending_receipts CONSTANT VARCHAR2(30) := 'C_NO_PENDING_RECEIPTS';
479 c_retro_account_allows_update CONSTANT VARCHAR2(30) := 'C_RETRO_ACCOUNT_ALLOWS_UPDATE';
480 c_warn_amt_based_notif_ctrls CONSTANT VARCHAR2(30) := 'C_WARN_AMT_BASED_NOTIF_CTRLS';
481
482
483 ---------------------------------------------------------------
484 -- Validation Sets.
485 ---------------------------------------------------------------
486
487 -- Validation set for HTML Orders headers.
488 c_html_order_header_vs CONSTANT PO_TBL_VARCHAR2000 :=
489 PO_TBL_VARCHAR2000(
490 -- Bug# 4779226 remove c_warn_supplier_on_hold from header check
491 c_rate_gt_zero
492 , c_rate_combination_valid
493 , c_doc_num_chars_valid
494 , c_doc_num_unique
495 , c_agent_id_not_null
496 , c_hdr_ship_to_loc_not_null
497 , c_fax_email_address_valid
498 , c_segment1_not_null
499 );
500
501 -- Validation set for HTML Orders lines.
502 c_html_order_line_vs CONSTANT PO_TBL_VARCHAR2000 :=
503 PO_TBL_VARCHAR2000(
504 c_amt_agreed_ge_zero
505 , c_min_rel_amt_ge_zero
506 , c_line_qty_gt_zero
507 , c_line_qty_ge_qty_exec -- <Complex Work R12>: Consolidate rcvd/billed
508 , c_line_qty_ge_qty_enc
509 -- ECO# 4708990/4586199: Obsoleting some messages
510 --, c_quantity_notif_change
511 , c_line_amt_gt_zero
512 , c_line_amt_ge_amt_exec -- <Complex Work R12>: Consolidate rcvd/billed
513 , c_line_amt_ge_timecard
514 , c_line_num_gt_zero
515 , c_line_num_unique
516 -- Bug# 4634769: Do not do the vmi check any more, it is done in
517 -- submission check.
518 --, c_vmi_asl_exists
519 , c_start_date_le_end_date
520 , c_otl_inv_start_date_change
521 , c_otl_inv_end_date_change
522 , c_unit_price_ge_zero
523 , c_list_price_ge_zero
524 , c_market_price_ge_zero
525 , c_validate_unit_price_change
526 -- <Complex Work R12 Start>
527 , c_qty_ge_qty_milestone_exec
528 , c_price_ge_price_mstone_exec
529 , c_recoupment_rate_range_check -- Bug 5072189
530 , c_retainage_rate_range_check -- Bug 5072189
531 , c_prog_pay_rate_range_check -- Bug 5072189
532 , c_max_retain_amt_ge_zero --Bug 5221843
533 , c_max_retain_amt_ge_retained --Bug 5453079
534 -- <Complex Work R12 End>
535 , c_item_id_not_null
536 , c_temp_labor_job_id_not_null
537 , c_category_id_not_null
538 , c_item_description_not_null
539 , c_unit_meas_not_null
540 , c_line_type_id_not_null
541 , c_temp_lbr_start_date_not_null
542 , c_line_sec_qty_gt_zero -- OPM Integration R12
543 , c_line_qtys_within_deviation -- OPM Integration R12
544 , c_from_line_id_not_null
545 , c_src_doc_line_not_null
546 , c_amt_ge_advance_amt -- Bug 5070210
547 , c_line_dff_validate -- Bug 7516824
548 );
549
550 -- Validation set for HTML Order price differentials.
551 c_html_order_price_diff_vs CONSTANT PO_TBL_VARCHAR2000 :=
552 PO_TBL_VARCHAR2000(
553 c_unique_price_diff_num
554 , c_price_diff_num_gt_zero
555 , c_unique_price_type
556 , c_mul_ge_zero
557 , c_spo_price_type_on_src_doc
558 , c_spo_mul_btwn_min_max
559 , c_spo_mul_ge_min
560 );
561
562 -- Validation set for HTML Orders shipments.
563 -- ECO 4503425: Removed the planned item null date check as this
564 -- has been moved to submission checks
565 c_html_order_shipment_vs CONSTANT PO_TBL_VARCHAR2000 :=
566 PO_TBL_VARCHAR2000(
567 c_days_early_gte_zero
568 , c_days_late_gte_zero
569 , c_rcv_close_tol_within_range
570 , c_over_rcpt_tol_within_range
571 -- ECO# 4708990/4586199: Obsoleting some messages
572 --, c_match_4way_check
573 , c_inv_close_tol_range_check
574 , c_need_by_date_open_per_check
575 , c_promise_date_open_per_check
576 , c_ship_to_org_null_check
577 , c_ship_to_loc_null_check
578 , c_ship_num_gt_zero
579 , c_ship_num_unique_check
580 , c_is_org_in_current_sob_check
581 , c_ship_qty_gt_zero
582 , c_ship_qty_ge_qty_exec -- <Complex Work R12>: Combined billed/rcvd
583 , c_ship_amt_gt_zero
584 , c_ship_amt_ge_amt_exec -- <Complex Work R12>: Combined billed/rcvd
585 , c_ship_sec_qty_gt_zero -- OPM Integration R12
586 , c_ship_qtys_within_deviation -- OPM Integration R12
587 , c_unit_of_measure_not_null -- Bug 5385686
588 , c_ship_dff_validate -- Bug 7516824
589 );
590
591 -- Validation set for HTML Orders distributions.
592 c_html_order_distribution_vs CONSTANT PO_TBL_VARCHAR2000 :=
593 PO_TBL_VARCHAR2000(
594 c_dist_num_unique
595 , c_dist_num_gt_zero
596 , c_dist_qty_gt_zero
597 , c_dist_qty_ge_qty_exec -- <Complex Work R12>: Combined billed/rcvd
598 , c_dist_amt_gt_zero
599 , c_dist_amt_ge_amt_exec -- <Complex Work R12>: Combined billed/rcvd
600 , c_pjm_unit_number_effective
601 , c_project_info -- PBWC Order Phase 3: Project Validations
602 , c_gl_enc_date_not_null_open
603 , c_oop_enter_all_fields
604 , c_check_proj_rel_validations -- Bug 5442682 : Validate project required fields. Need to validate before award data is validated.
605 , c_gms_data_valid
606 , c_check_fv_validations -- ECO 4059111 : FV Validations
607 , c_dist_dff_validate -- Bug 7516824
608 );
609
610 -- Validation set for HTML Agreement headers.
611 c_html_agmt_header_vs CONSTANT PO_TBL_VARCHAR2000 :=
612 PO_TBL_VARCHAR2000(
613 -- Bug# 4779226 remove c_warn_supplier_on_hold from header check
614 c_rate_gt_zero
615 , c_rate_combination_valid
616 , c_fax_email_address_valid
617 , c_doc_num_chars_valid
618 , c_doc_num_unique
619 , c_price_update_tol_ge_zero
620 , c_amount_limit_ge_zero
621 , c_amt_limit_ge_amt_agreed
622 , c_amount_agreed_ge_zero
623 , c_amount_agreed_not_null
624 , c_effective_le_expiration
625 , c_effective_from_le_order_date
626 , c_effective_to_ge_order_date
627 , c_contract_start_le_order_date
628 , c_contract_end_ge_order_date
629 , c_agent_id_not_null
630 , c_hdr_ship_to_loc_not_null
631 , c_vendor_id_not_null
632 , c_vendor_site_id_not_null
633 , c_segment1_not_null
634 );
635
636 -- Validation set for HTML Agreement lines.
637 c_html_agmt_line_vs CONSTANT PO_TBL_VARCHAR2000 :=
638 PO_TBL_VARCHAR2000(
639 c_line_num_gt_zero
640 , c_line_num_unique
641 , c_item_id_not_null
642 , c_unit_price_ge_zero
643 , c_temp_labor_job_id_not_null
644 , c_category_id_not_null
645 , c_item_description_not_null
646 , c_unit_meas_not_null
647 , c_expiration_ge_blanket_start
648 , c_expiration_le_blanket_end
649 , c_line_type_id_not_null
650 , c_from_line_id_not_null
651 , c_src_doc_line_not_null
652 , c_line_dff_validate -- Bug 7516824
653 );
654
655 -- Validation set for HTML Agreement GA org assignments.
656 c_html_agmt_ga_org_assign_vs CONSTANT PO_TBL_VARCHAR2000 :=
657 PO_TBL_VARCHAR2000(
658 c_assign_purch_org_not_null
659 , c_assign_vendor_site_not_null
660 );
661
662 -- Validation set for HTML Agreement notification controls.
663 c_html_agmt_notif_ctrl_vs CONSTANT PO_TBL_VARCHAR2000 :=
664 PO_TBL_VARCHAR2000(
665 c_notif_start_date_le_end_date
666 , c_notif_percent_le_one_hundred
667 , c_notif_amount_gt_zero
668 , c_notif_amount_not_null
669 , c_notif_start_date_not_null
670 );
671
672 -- Validation set for HTML Agreement price differentials.
673 c_html_agmt_price_diff_vs CONSTANT PO_TBL_VARCHAR2000 :=
674 PO_TBL_VARCHAR2000(
675 c_unique_price_diff_num
676 , c_price_diff_num_gt_zero
677 , c_unique_price_type
678 , c_max_mul_ge_zero
679 , c_max_mul_ge_min_mul
680 , c_min_mul_ge_zero
681 );
682
683 -- Validation set for HTML Agreement price breaks.
684 c_html_agmt_price_break_vs CONSTANT PO_TBL_VARCHAR2000 :=
685 PO_TBL_VARCHAR2000(
686 c_ship_num_gt_zero
687 , c_ship_num_unique_check
688 , c_at_least_one_required_field
689 , c_price_discount_in_percent
690 , c_price_override_gt_zero
691 , c_price_break_qty_ge_zero
692 , c_price_break_start_le_end
693 , c_break_start_ge_blanket_start
694 , c_break_start_le_blanket_end
695 , c_break_start_le_expiration
696 , c_break_end_le_expiration
697 , c_break_end_ge_blanket_start
698 , c_break_end_le_blanket_end
699 );
700
701 -- Validation set for HTML Agreement distributions.
702 c_html_agmt_distribution_vs CONSTANT PO_TBL_VARCHAR2000 :=
703 PO_TBL_VARCHAR2000(
704 c_amount_to_encumber_ge_zero
705 , c_budget_account_id_not_null
706 , c_gl_enc_date_not_null_open
707 , c_unencum_amt_le_amt_to_encum
708 );
709
710 -- Used to validate that a change to the unit price is allowed.
711 c_allow_unit_price_change_vs CONSTANT PO_TBL_VARCHAR2000 :=
712 PO_TBL_VARCHAR2000(
713 c_no_dists_reserved
714 , c_accruals_allow_update
715 , c_no_timecards_exist
716 , c_no_pending_receipts
717 , c_retro_account_allows_update
718 -- ECO# 4708990/4586199: Obsoleting some messages
719 --, c_warn_amt_based_notif_ctrls
720 );
721
722 ----------------------------------------------------------------------------
723 -- PDOI Validation Common Set Definitions
724 ----------------------------------------------------------------------------
725 c_pdoi_header_common_vs CONSTANT po_tbl_varchar2000
726 := po_tbl_varchar2000(c_po_header_id,
727 c_end_date,
728 c_type_lookup_code,
729 c_revision_num,
730 c_document_num,
731 c_currency_code,
732 c_rate_info,
733 c_agent_id,
734 c_vendor_info,
735 c_ship_to_location_id,
736 c_bill_to_location_id,
737 c_last_updated_by,
738 c_last_update_date,
739 c_release_num,
740 c_po_release_id,
741 c_release_date,
742 c_revised_date,
743 c_printed_date,
744 c_closed_date,
745 c_terms_id_header,
746 c_ship_via_lookup_code,
747 c_fob_lookup_code,
748 c_freight_terms_lookup_code,
749 c_shipping_control,
750 c_approval_status,
751 c_acceptance_required_flag);
752
753 c_pdoi_line_common_vs CONSTANT po_tbl_varchar2000
754 := po_tbl_varchar2000(c_release_num_null,
755 c_po_release_id_null,
756 c_closed_date_null,
757 c_contractor_name,
758 c_order_type_lookup_code,
759 c_job_id,
760 c_job_business_group_id,
761 c_item_description,
762 c_category_id,
763 c_category_id_null,
764 c_hazard_class_id,
765 c_un_number_id,
766 c_unit_meas_lookup_code,
767 c_unit_price,
768 c_item_id_not_null,
769 c_item_id,
770 c_item_revision,
771 c_line_type_id,
772 c_quantity,
773 c_amount,
774 c_rate_type,
775 c_line_num,
776 c_po_line_id,
777 c_price_type_lookup_code,
778 c_line_secondary_quantity);
779
780 c_pdoi_line_update_vs CONSTANT po_tbl_varchar2000
781 := po_tbl_varchar2000(c_uom_update,
782 c_unit_price_update,
783 c_amount_update, -- bug 5258790
784 c_item_desc_update,
785 c_ip_category_id_update,
786 c_category_id_update);
787
788
789 c_pdoi_line_loc_common_vs CONSTANT po_tbl_varchar2000
790 := po_tbl_varchar2000(c_shipment_need_by_date,
791 c_shipment_quantity,
792 c_shipment_price_override,
793 c_shipment_price_discount,
794 c_ship_to_organization_id,
795 c_terms_id_line_loc,
796 c_shipment_num,
797 c_line_loc_secondary_quantity,
798 c_tax_name);
799
800 c_pdoi_dist_common_vs CONSTANT po_tbl_varchar2000
801 := po_tbl_varchar2000(c_dist_amount_ordered,
802 c_dist_quantity_ordered,
803 c_dist_destination_org_id,
804 c_dist_deliver_to_location_id,
805 c_dist_deliver_to_person_id,
806 c_dist_destination_type_code,
807 c_dist_destination_subinv,
808 c_dist_wip_entity_id,
809 c_prevent_encumberance_flag,
810 c_charge_account_id,
811 c_budget_account_id,
812 c_accrual_account_id,
813 c_variance_account_id,
814 c_project_acct_context,
815 c_project_info,
816 c_tax_recovery_override_flag);
817
818 c_pdoi_price_diff_common_vs CONSTANT po_tbl_varchar2000
819 := po_tbl_varchar2000(c_price_type,
820 c_multiple_price_diff,
821 c_entity_type,
822 c_multiplier,
823 c_min_multiplier,
824 c_max_multiplier,
825 c_price_diff_style_info);
826
827 ----------------------------------------------------------------------------
828 -- PDOI Set Definitions for Blanket PO
829 ----------------------------------------------------------------------------
830 c_pdoi_header_blanket_vs CONSTANT po_tbl_varchar2000
831 := po_tbl_varchar2000(c_confirming_order_flag,
832 c_acceptance_due_date,
833 c_amount_agreed,
834 c_amount_limit,
835 c_firm_status_lookup_header,
836 c_cancel_flag,
837 c_closed_code,
838 c_print_count,
839 c_frozen_flag,
840 c_amount_to_encumber,
841 c_style_id);
842
843
844 c_pdoi_line_blanket_vs CONSTANT po_tbl_varchar2000
845 := po_tbl_varchar2000(c_global_agreement_flag,
846 c_capital_expense_flag,
847 c_price_break_lookup_code,
848 c_not_to_exceed_price,
849 c_amount_blanket,
850 c_expiration_date_blanket,
851 c_over_tolerance_err_flag_null,
852 c_ip_category_id,
853 c_line_secondary_uom,
854 c_line_preferred_grade,
855 c_line_style_related_info,
856 c_negotiated_by_preparer);
857
858 c_pdoi_line_blanket_update_vs CONSTANT po_tbl_varchar2000
859 := po_tbl_varchar2000(c_negotiated_by_prep_update);
860
861
862 c_pdoi_line_loc_blanket_vs CONSTANT po_tbl_varchar2000
863 := po_tbl_varchar2000(c_shipment_effective_dates,
864 c_shipment_type_blanket,
865 c_at_least_one_required_field,
866 c_need_by_date_null,
867 c_firm_flag_null,
868 c_freight_carrier_null,
869 c_fob_lookup_code_null,
870 c_freight_terms_lookup_null,
871 c_qty_rcv_tolerance_null,
872 c_receipt_required_flag_null,
873 c_inspection_reqd_flag_null,
874 c_receipt_days_exception_null,
875 c_invoice_close_toler_null,
876 c_receive_close_toler_null,
877 c_days_early_rcpt_allowed_null,
878 c_days_late_rcpt_allowed_null,
879 c_enfrce_ship_to_loc_code_null,
880 c_allow_sub_receipts_flag_null,
881 c_promised_date_null,
882 c_receiving_routing_null,
883 c_line_loc_secondary_uom,
884 c_line_loc_preferred_grade,
885 c_line_loc_style_related_info,
886 c_price_break);
887
888
889
890 ----------------------------------------------------------------------------
891 -- PDOI Set Definitions for Standard PO
892 ----------------------------------------------------------------------------
893 c_pdoi_header_standard_vs CONSTANT po_tbl_varchar2000
894 := po_tbl_varchar2000(c_confirming_order_flag,
895 c_acceptance_due_date,
896 c_firm_status_lookup_header,
897 c_cancel_flag,
898 c_closed_code,
899 c_print_count,
900 c_frozen_flag,
901 c_style_id);
902
903 c_pdoi_line_standard_vs CONSTANT po_tbl_varchar2000
904 := po_tbl_varchar2000(c_over_tolerance_error_flag,
905 c_capital_expense_flag,
906 c_not_to_exceed_price,
907 c_start_date_standard,
908 c_item_id_standard,
909 c_quantity_standard,
910 c_amount_standard,
911 c_ip_category_id_null,
912 c_line_secondary_uom,
913 c_line_preferred_grade,
914 c_line_style_related_info,
915 c_negotiated_by_preparer);
916
917
918 c_pdoi_line_loc_standard_vs CONSTANT po_tbl_varchar2000
919 := po_tbl_varchar2000(c_enforce_ship_to_loc_code,
920 c_shipment_type_standard,
921 c_allow_sub_receipts_flag,
922 c_days_early_receipt_allowed,
923 c_receipt_days_exception_code,
924 c_invoice_close_tolerance,
925 c_receive_close_tolerance,
926 c_receiving_routing_id,
927 c_accrue_on_receipt_flag,
928 c_shipment_promised_date,
929 c_line_loc_secondary_uom,
930 c_line_loc_preferred_grade);
931
932
933 ----------------------------------------------------------------------------
934 -- PDOI Set Definitions for Quotation
935 ----------------------------------------------------------------------------
936 c_pdoi_header_quotation_vs CONSTANT po_tbl_varchar2000
937 := po_tbl_varchar2000(c_quote_warning_delay,
938 c_approval_required_flag);
939
940 c_pdoi_line_quotation_vs CONSTANT po_tbl_varchar2000
941 := po_tbl_varchar2000(c_over_tolerance_error_flag,
942 c_allow_price_override_null ,
943 c_negotiated_by_preparer_null,
944 c_capital_expense_flag_null,
945 c_min_release_amount_null,
946 c_market_price_null,
947 c_committed_amount_null,
948 c_ip_category_id,
949 c_negotiated_by_preparer_null);
950
951 c_pdoi_line_loc_quotation_vs CONSTANT po_tbl_varchar2000
952 := po_tbl_varchar2000(c_qty_rcv_exception_code,
953 c_shipment_type_quotation,
954 c_fob_lookup_code_line_loc,
955 c_freight_terms_line_loc,
956 c_freight_carrier_line_loc,
957 c_firm_flag_null,
958 c_promised_date_null,
959 c_receipt_days_exception_null,
960 c_invoice_close_toler_null,
961 c_receive_close_toler_null,
962 c_days_early_rcpt_allowed_null,
963 c_days_late_rcpt_allowed_null,
964 c_enfrce_ship_to_loc_code_null,
965 c_allow_sub_receipts_flag_null,
966 c_receiving_routing_null,
967 c_need_by_date_null);
968
969
970 -------------------------------------------------------------------------------
971 --Start of Comments
972 --Pre-reqs: None.
973 --Modifies: PO_VALIDATION_RESULT_SET_ID_S
974 --Locks: None.
975 --Function:
976 -- Retrieves the next value from the sequence PO_VALIDATION_RESULT_SET_ID_S.
977 --Returns:
978 -- The next sequence value.
979 --End of Comments
980 -------------------------------------------------------------------------------
981 FUNCTION next_result_set_id
982 RETURN NUMBER
983 IS
984 d_mod CONSTANT VARCHAR2(100) := D_next_result_set_id;
985 l_nextval NUMBER;
986 BEGIN
987
988 IF PO_LOG.d_proc THEN
989 PO_LOG.proc_begin(d_mod);
990 END IF;
991
992 SELECT PO_VALIDATION_RESULT_SET_ID_S.NEXTVAL
993 INTO l_nextval
994 FROM DUAL
995 ;
996
997 IF PO_LOG.d_proc THEN
998 PO_LOG.proc_return(d_mod,l_nextval);
999 END IF;
1000
1001 RETURN l_nextval;
1002
1003 EXCEPTION
1004 WHEN OTHERS THEN
1005 IF PO_LOG.d_exc THEN
1006 PO_LOG.exc(d_mod,0,NULL);
1007 END IF;
1008 RAISE;
1009
1010 END next_result_set_id;
1011
1012
1013 -------------------------------------------------------------------------------
1014 --Start of Comments
1015 --Pre-reqs: None.
1016 --Modifies: PO_VALIDATION_RESULTS
1017 --Locks: None.
1018 --Function:
1019 -- Deletes the specified result set from the
1020 -- PO_VALIDATION_RESULTS table.
1021 --Parameters:
1022 --IN:
1023 --p_result_set_id
1024 -- The result_set_id identifier into PO_VALIDATION_RESULTS.
1025 --End of Comments
1026 -------------------------------------------------------------------------------
1027 PROCEDURE delete_result_set(
1028 p_result_set_id IN NUMBER
1029 )
1030 IS
1031 d_mod CONSTANT VARCHAR2(100) := D_delete_result_set;
1032 BEGIN
1033
1034 IF PO_LOG.d_proc THEN
1035 PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1036 END IF;
1037
1038 DELETE FROM PO_VALIDATION_RESULTS_GT
1039 WHERE result_set_id = p_result_set_id
1040 ;
1041
1042 IF PO_LOG.d_proc THEN
1043 PO_LOG.stmt(d_mod,100,'Deleted result set. SQL%ROWCOUNT',SQL%ROWCOUNT);
1044 PO_LOG.proc_end(d_mod);
1045 END IF;
1046
1047 EXCEPTION
1048 WHEN OTHERS THEN
1049 IF PO_LOG.d_exc THEN
1050 PO_LOG.exc(d_mod,0,NULL);
1051 END IF;
1052 RAISE;
1053
1054 END delete_result_set;
1055
1056
1057 -------------------------------------------------------------------------------
1058 --Start of Comments
1059 --Pre-reqs: None.
1060 --Modifies: PO_VALIDATION_RESULTS
1061 --Locks: None.
1062 --Function:
1063 -- Autonomously deletes the specified result set from the
1064 -- PO_VALIDATION_RESULTS table.
1065 --Parameters:
1066 --IN:
1067 --p_result_set_id
1068 -- The result_set_id identifier into PO_VALIDATION_RESULTS.
1069 --End of Comments
1070 -------------------------------------------------------------------------------
1071 PROCEDURE delete_result_set_auto(
1072 p_result_set_id IN NUMBER
1073 )
1074 IS
1075 PRAGMA AUTONOMOUS_TRANSACTION;
1076 d_mod CONSTANT VARCHAR2(100) := D_delete_result_set_auto;
1077 d_position NUMBER := 0;
1078 BEGIN
1079
1080 IF PO_LOG.d_proc THEN
1081 PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1082 END IF;
1083
1084 d_position := 1;
1085
1086 delete_result_set(p_result_set_id => p_result_set_id);
1087
1088 d_position := 100;
1089
1090 COMMIT;
1091
1092 d_position := 200;
1093
1094 IF PO_LOG.d_proc THEN
1095 PO_LOG.proc_end(d_mod);
1096 END IF;
1097
1098 EXCEPTION
1099 WHEN OTHERS THEN
1100 IF PO_LOG.d_exc THEN
1101 PO_LOG.exc(d_mod,d_position,NULL);
1102 END IF;
1103 RAISE;
1104
1105 END delete_result_set_auto;
1106
1107
1108 -------------------------------------------------------------------------------
1109 --Start of Comments
1110 --Pre-reqs: None.
1111 --Modifies: PO_VALIDATION_RESULTS
1112 --Locks: None.
1113 --Function:
1114 -- Autonomously inserts and commits the input data into the
1115 -- PO_VALIDATION_RESULTS table.
1116 --Parameters:
1117 --IN:
1118 -- The data to insert into the table.
1119 --End of Comments
1120 -------------------------------------------------------------------------------
1121 PROCEDURE commit_validation_results_auto(
1122 p_result_id_tbl IN PO_TBL_NUMBER
1123 , p_result_set_id_tbl IN PO_TBL_NUMBER
1124 , p_result_type_tbl IN PO_TBL_VARCHAR30
1125 , p_table_name_tbl IN PO_TBL_VARCHAR30
1126 , p_table_id_tbl IN PO_TBL_NUMBER
1127 , p_message_application_tbl IN PO_TBL_VARCHAR30
1128 , p_message_name_tbl IN PO_TBL_VARCHAR30
1129 , p_column_name_tbl IN PO_TBL_VARCHAR30
1130 , p_token1_name_tbl IN PO_TBL_VARCHAR30
1131 , p_token1_value_tbl IN PO_TBL_VARCHAR2000
1132 , p_token2_name_tbl IN PO_TBL_VARCHAR30
1133 , p_token2_value_tbl IN PO_TBL_VARCHAR2000
1134 , p_token3_name_tbl IN PO_TBL_VARCHAR30
1135 , p_token3_value_tbl IN PO_TBL_VARCHAR2000
1136 , p_token4_name_tbl IN PO_TBL_VARCHAR30
1137 , p_token4_value_tbl IN PO_TBL_VARCHAR2000
1138 , p_token5_name_tbl IN PO_TBL_VARCHAR30
1139 , p_token5_value_tbl IN PO_TBL_VARCHAR2000
1140 , p_token6_name_tbl IN PO_TBL_VARCHAR30
1141 , p_token6_value_tbl IN PO_TBL_VARCHAR2000
1142 )
1143 IS
1144 PRAGMA AUTONOMOUS_TRANSACTION;
1145 d_mod CONSTANT VARCHAR2(100) := D_commit_validation_results_au;
1146 d_position NUMBER := 0;
1147 BEGIN
1148
1149 IF PO_LOG.d_proc THEN
1150 PO_LOG.proc_begin(d_mod,'p_result_id_tbl',p_result_id_tbl);
1151 PO_LOG.proc_begin(d_mod,'p_result_set_id_tbl',p_result_set_id_tbl);
1152 PO_LOG.proc_begin(d_mod,'p_result_type_tbl',p_result_type_tbl);
1153 PO_LOG.proc_begin(d_mod,'p_table_name_tbl',p_table_name_tbl);
1154 PO_LOG.proc_begin(d_mod,'p_table_id_tbl',p_table_id_tbl);
1155 PO_LOG.proc_begin(d_mod,'p_message_application_tbl',p_message_application_tbl);
1156 PO_LOG.proc_begin(d_mod,'p_message_name_tbl',p_message_name_tbl);
1157 PO_LOG.proc_begin(d_mod,'p_column_name_tbl',p_column_name_tbl);
1158 PO_LOG.proc_begin(d_mod,'p_token1_name_tbl',p_token1_name_tbl);
1159 PO_LOG.proc_begin(d_mod,'p_token1_value_tbl',p_token1_value_tbl);
1160 PO_LOG.proc_begin(d_mod,'p_token2_name_tbl',p_token2_name_tbl);
1161 PO_LOG.proc_begin(d_mod,'p_token2_value_tbl',p_token2_value_tbl);
1162 PO_LOG.proc_begin(d_mod,'p_token3_name_tbl',p_token3_name_tbl);
1163 PO_LOG.proc_begin(d_mod,'p_token3_value_tbl',p_token3_value_tbl);
1164 PO_LOG.proc_begin(d_mod,'p_token4_name_tbl',p_token4_name_tbl);
1165 PO_LOG.proc_begin(d_mod,'p_token4_value_tbl',p_token4_value_tbl);
1166 PO_LOG.proc_begin(d_mod,'p_token5_name_tbl',p_token5_name_tbl);
1167 PO_LOG.proc_begin(d_mod,'p_token5_value_tbl',p_token5_value_tbl);
1168 PO_LOG.proc_begin(d_mod,'p_token6_name_tbl',p_token6_name_tbl);
1169 PO_LOG.proc_begin(d_mod,'p_token6_value_tbl',p_token6_value_tbl);
1170 END IF;
1171
1172 d_position := 1;
1173
1174 FORALL i IN 1 .. p_result_set_id_tbl.COUNT
1175 INSERT INTO PO_VALIDATION_RESULTS_GT
1176 ( result_set_id
1177 , result_type
1178 , entity_type
1179 , entity_id
1180 , message_application
1181 , message_name
1182 , column_name
1183 , token1_name
1184 , token1_value
1185 , token2_name
1186 , token2_value
1187 , token3_name
1188 , token3_value
1189 , token4_name
1190 , token4_value
1191 , token5_name
1192 , token5_value
1193 , token6_name
1194 , token6_value
1195 )
1196 VALUES
1197 ( p_result_set_id_tbl(i)
1198 , p_result_type_tbl(i)
1199 , p_table_name_tbl(i)
1200 , p_table_id_tbl(i)
1201 , p_message_application_tbl(i)
1202 , p_message_name_tbl(i)
1203 , p_column_name_tbl(i)
1204 , p_token1_name_tbl(i)
1205 , p_token1_value_tbl(i)
1206 , p_token2_name_tbl(i)
1207 , p_token2_value_tbl(i)
1208 , p_token3_name_tbl(i)
1209 , p_token3_value_tbl(i)
1210 , p_token4_name_tbl(i)
1211 , p_token4_value_tbl(i)
1212 , p_token5_name_tbl(i)
1213 , p_token5_value_tbl(i)
1214 , p_token6_name_tbl(i)
1215 , p_token6_value_tbl(i)
1216 );
1217
1218 d_position := 100;
1219
1220 IF PO_LOG.d_stmt THEN
1221 PO_LOG.stmt(d_mod,d_position,'Inserted data. SQL%ROWCOUNT',SQL%ROWCOUNT);
1222 END IF;
1223
1224 COMMIT WORK;
1225
1226 IF PO_LOG.d_proc THEN
1227 PO_LOG.proc_end(d_mod);
1228 END IF;
1229
1230 EXCEPTION
1231 WHEN OTHERS THEN
1232 IF PO_LOG.d_exc THEN
1233 PO_LOG.exc(d_mod,d_position,NULL);
1234 END IF;
1235 RAISE;
1236
1237 END commit_validation_results_auto;
1238
1239
1240 -------------------------------------------------------------------------------
1241 --Start of Comments
1242 --Pre-reqs: None.
1243 --Modifies: PO_VALIDATION_RESULTS
1244 --Locks: PO_VALIDATION_RESULTS
1245 --Function:
1246 -- Replaces the old result_set_id with the new one.
1247 --Parameters:
1248 --IN:
1249 --p_old_result_set_id
1250 -- The result_set_id of the rows that should be updated.
1251 --p_new_result_set_id
1252 -- The id with which to replace the rows' result_set_id.
1253 --End of Comments
1254 -------------------------------------------------------------------------------
1255 PROCEDURE replace_result_set_id(
1256 p_old_result_set_id IN NUMBER
1257 , p_new_result_set_id IN NUMBER
1258 )
1259 IS
1260 d_mod CONSTANT VARCHAR2(100) := D_replace_result_set_id;
1261 BEGIN
1262
1263 IF PO_LOG.d_proc THEN
1264 PO_LOG.proc_begin(d_mod,'p_old_result_set_id',p_old_result_set_id);
1265 PO_LOG.proc_begin(d_mod,'p_new_result_set_id',p_new_result_set_id);
1266 END IF;
1267
1268 -- Fix the result_set_id, message_application, and message_name.
1269
1270 UPDATE PO_VALIDATION_RESULTS_GT
1271 SET
1272 result_set_id = p_new_result_set_id
1273 WHERE
1274 result_set_id = p_old_result_set_id
1275 ;
1276
1277 IF PO_LOG.d_proc THEN
1278 PO_LOG.proc_end(d_mod);
1279 END IF;
1280
1281 EXCEPTION
1282 WHEN OTHERS THEN
1283 IF PO_LOG.d_exc THEN
1284 PO_LOG.exc(d_mod,0,NULL);
1285 END IF;
1286 RAISE;
1287
1288 END replace_result_set_id;
1289
1290
1291 -------------------------------------------------------------------------------
1292 --Start of Comments
1293 --Pre-reqs: None.
1294 --Modifies: PO_VALIDATION_RESULTS
1295 --Locks: PO_VALIDATION_RESULTS
1296 --Function:
1297 -- Extracts records from PO_VALIDATION_RESULTS, deletes them, and then
1298 -- inserts them again in an autonomous transaction.
1299 -- Also provides default values to some columns.
1300 --Parameters:
1301 --IN:
1302 --p_result_set_id
1303 -- Identifies the rows to operate on.
1304 --End of Comments
1305 -------------------------------------------------------------------------------
1306 PROCEDURE commit_result_set(
1307 p_result_set_id IN NUMBER
1308 )
1309 IS
1310 d_mod CONSTANT VARCHAR2(100) := D_commit_result_set;
1311 d_position NUMBER := 0;
1312
1313 l_result_id_tbl PO_TBL_NUMBER;
1314 l_result_set_id_tbl PO_TBL_NUMBER;
1315 l_result_type_tbl PO_TBL_VARCHAR30;
1316 l_table_name_tbl PO_TBL_VARCHAR30;
1317 l_table_id_tbl PO_TBL_NUMBER;
1318 l_message_application_tbl PO_TBL_VARCHAR30;
1319 l_message_name_tbl PO_TBL_VARCHAR30;
1320 l_column_name_tbl PO_TBL_VARCHAR30;
1321 l_token1_name_tbl PO_TBL_VARCHAR30;
1322 l_token1_value_tbl PO_TBL_VARCHAR2000;
1323 l_token2_name_tbl PO_TBL_VARCHAR30;
1324 l_token2_value_tbl PO_TBL_VARCHAR2000;
1325 l_token3_name_tbl PO_TBL_VARCHAR30;
1326 l_token3_value_tbl PO_TBL_VARCHAR2000;
1327 l_token4_name_tbl PO_TBL_VARCHAR30;
1328 l_token4_value_tbl PO_TBL_VARCHAR2000;
1329 l_token5_name_tbl PO_TBL_VARCHAR30;
1330 l_token5_value_tbl PO_TBL_VARCHAR2000;
1331 l_token6_name_tbl PO_TBL_VARCHAR30;
1332 l_token6_value_tbl PO_TBL_VARCHAR2000;
1333
1334 BEGIN
1335
1336 IF PO_LOG.d_proc THEN
1337 PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1338 END IF;
1339
1340 d_position := 1;
1341
1342 -- Retrieve the data from the validation results table
1343 -- and commit it back, autonomously.
1344
1345 SELECT
1346 result_set_id
1347 , NVL(result_type,c_result_type_FAILURE)
1348 , entity_type
1349 , entity_id
1350 , NVL(message_application,c_PO)
1351 , message_name
1352 , column_name
1353 , token1_name
1354 , token1_value
1355 , token2_name
1356 , token2_value
1357 , token3_name
1358 , token3_value
1359 , token4_name
1360 , token4_value
1361 , token5_name
1362 , token5_value
1363 , token6_name
1364 , token6_value
1365 BULK COLLECT INTO
1366 l_result_set_id_tbl
1367 , l_result_type_tbl
1368 , l_table_name_tbl
1369 , l_table_id_tbl
1370 , l_message_application_tbl
1371 , l_message_name_tbl
1372 , l_column_name_tbl
1373 , l_token1_name_tbl
1374 , l_token1_value_tbl
1375 , l_token2_name_tbl
1376 , l_token2_value_tbl
1377 , l_token3_name_tbl
1378 , l_token3_value_tbl
1379 , l_token4_name_tbl
1380 , l_token4_value_tbl
1381 , l_token5_name_tbl
1382 , l_token5_value_tbl
1383 , l_token6_name_tbl
1384 , l_token6_value_tbl
1385 FROM
1386 PO_VALIDATION_RESULTS_GT
1387 WHERE
1388 result_set_id = p_result_set_id
1389 ;
1390
1391 d_position := 100;
1392 IF PO_LOG.d_stmt THEN
1393 PO_LOG.stmt(d_mod,d_position,'Retrieved data.');
1394 END IF;
1395
1396 delete_result_set(p_result_set_id => p_result_set_id);
1397
1398 d_position := 200;
1399
1400 commit_validation_results_auto(
1401 p_result_id_tbl => l_result_id_tbl
1402 , p_result_set_id_tbl => l_result_set_id_tbl
1403 , p_result_type_tbl => l_result_type_tbl
1404 , p_table_name_tbl => l_table_name_tbl
1405 , p_table_id_tbl => l_table_id_tbl
1406 , p_message_application_tbl => l_message_application_tbl
1407 , p_message_name_tbl => l_message_name_tbl
1408 , p_column_name_tbl => l_column_name_tbl
1409 , p_token1_name_tbl => l_token1_name_tbl
1410 , p_token1_value_tbl => l_token1_value_tbl
1411 , p_token2_name_tbl => l_token2_name_tbl
1412 , p_token2_value_tbl => l_token2_value_tbl
1413 , p_token3_name_tbl => l_token3_name_tbl
1414 , p_token3_value_tbl => l_token3_value_tbl
1415 , p_token4_name_tbl => l_token4_name_tbl
1416 , p_token4_value_tbl => l_token4_value_tbl
1417 , p_token5_name_tbl => l_token5_name_tbl
1418 , p_token5_value_tbl => l_token5_value_tbl
1419 , p_token6_name_tbl => l_token6_name_tbl
1420 , p_token6_value_tbl => l_token6_value_tbl
1421 );
1422
1423 IF PO_LOG.d_proc THEN
1424 PO_LOG.proc_end(d_mod);
1425 END IF;
1426
1427 EXCEPTION
1428 WHEN OTHERS THEN
1429 IF PO_LOG.d_exc THEN
1430 PO_LOG.exc(d_mod,d_position,NULL);
1431 END IF;
1432 RAISE;
1433
1434 END commit_result_set;
1435
1436
1437
1438 /**
1439
1440 -------------------------------------------
1441 General contract for validation subroutines
1442 -------------------------------------------
1443
1444 Each validation subroutine must have a signature
1445 containing the following output parameters:
1446
1447 x_result_set_id IN OUT NOCOPY NUMBER
1448 x_result_type OUT NOCOPY VARCHAR2
1449
1450 The validation subroutine may take in any parameters
1451 from the available input to validate_set.
1452 Most subroutines will only require a small set of parameters,
1453 and can be coded as such.
1454
1455 Example subroutine call:
1456
1457 CASE l_val
1458 ...
1459
1460 WHEN c_unit_price_ge_zero THEN
1461 PO_PRICE_HELPER.unit_price_ge_zero(
1462 p_line_id_tbl => p_lines.po_line_id
1463 , p_draft_id_tbl => p_lines.draft_id
1464 , p_unit_price_tbl => p_lines.unit_price
1465 , x_result_set_id => l_result_set_id
1466 , x_result_type => l_result_type
1467 );
1468
1469 WHEN ...
1470
1471 END CASE;
1472
1473
1474 The validation subroutine will perform the required validation
1475 on the data and insert results into the PO_VALIDATION_RESULTS table.
1476
1477 Parameter descriptions:
1478
1479 x_result_set_id
1480 This parameter identifies rows in PO_VALIDATION_RESULTS
1481 that have been generated by the validation procedure.
1482 The following columns must be populated
1483 by the validation procedure:
1484
1485 result_id
1486 PO_VALIDATION_RESULT_ID_S.nextval
1487
1488 result_set_id
1489 x_result_set_id
1490
1491 table_name
1492 table_id
1493 The name of the table on which the validation is acting,
1494 and the primary key of the table row.
1495
1496 column_name
1497 The name of the column of the pending table to which
1498 this validation result corresponds.
1499
1500 result_type
1501 This should be populated with the default interpretation
1502 of this result (WARNING, ERROR, FATAL, etc.).
1503 If this column is not populated, ERROR should be assumed.
1504
1505 message_application
1506 message_name
1507 The dictionary message for this result.
1508 If message_application is not populated, PO should be assumed.
1509
1510 Additionally, the validation procedure must populate the columns
1511 token1_name, token1_value, token2_name, token2_value, ...
1512 if any tokens are used in the dictionary message.
1513
1514 x_result_type
1515 This parameter contains a summary of the results.
1516 If all validations are successful and no results have been
1517 generated, it will be SUCCESS. Otherwise, it will be
1518 equal to the most serious result_type of the validation
1519 results.
1520
1521
1522 */
1523
1524
1525
1526 ----------------------------------------------------------------------------
1527 --Pre-reqs: None.
1528 --Modifies:
1529 -- PO_VALIDATION_RESULTS
1530 --Locks: None.
1531 --Function:
1532 -- Executes a set of validations in the order determined
1533 -- by the validation set list.
1534 -- Validation results will be stored in PO_VALIDATION_RESULTS.
1535 --
1536 -- Calls to validate_set may be chained together,
1537 -- as the x_result_set_id and x_result_type parameters
1538 -- are IN OUT.
1539 --
1540 -- Example:
1541 --
1542 -- <<DISTRIBUTION_VALIDATIONS>>
1543 -- BEGIN
1544 --
1545 -- -- Common validations
1546 --
1547 -- validate_set(
1548 -- p_validation_set => c_dist_common_val_set
1549 -- , p_distributions => l_dist_id_tbl
1550 -- , x_result_set_id => l_result_set_id
1551 -- , x_result_type => l_result_type
1552 -- );
1553 --
1554 -- IF ( l_result_type <> c_RESULT_TYPE_SUCCESS
1555 -- AND l_projects_enabled_flag )
1556 -- THEN
1557 --
1558 -- -- Projects-specific validations
1559 --
1560 -- validate_set(
1561 -- p_validation_set => c_dist_projects_val_set
1562 -- , p_distributions => l_dist_id_tbl
1563 -- , x_result_set_id => l_result_set_id
1564 -- , x_result_type => l_result_type
1565 -- );
1566 --
1567 -- END IF;
1568 --
1569 -- END DISTRIBUTION_VALIDATIONS;
1570 --
1571 --Parameters:
1572 --IN:
1573 --p_validation_set
1574 -- Specifies the validations to perform.
1575 --p_headers
1576 --p_lines
1577 --p_line_locations
1578 --p_distributions
1579 --p_price_differentials
1580 --p_ga_org_assignments
1581 --p_notification_controls
1582 -- The data that needs to be validated.
1583 -- Only the data that is required for the incoming validation set
1584 -- is necessary.
1585 --p_autocommit_results_flag
1586 -- Indicates whether or not the results need to be autonomously committed.
1587 -- g_parameter_NO - There is no need to commit the results.
1588 -- g_parameter_YES - The results need to be committed.
1589 --p_calling_program
1590 -- Identifier of the program that is invoking the validation set.
1591 -- This can be used by validation subroutines to perform differently
1592 -- for different flows. For example, this can be used to substitute
1593 -- different messages or tokens for OA vs. PDOI, or to interpret
1594 -- warnings as errors in different cases, etc.
1595 -- Use one of the c_program_XXX constants.
1596 --p_stopping_result_type
1597 -- Indicates that if this result type is encountered,
1598 -- processing should stop and return.
1599 -- Use one of the c_result_type_XXX variables.
1600 -- For no stopping, use NULL.
1601 --p_parameter_name_tbl
1602 --p_parameter_value_tbl
1603 -- Contain additional parameters that may be passed to individual
1604 -- validation subroutines.
1605 -- The parameter names and associated value should be located
1606 -- at identical indexes in the input tables.
1607 --IN OUT:
1608 --x_result_set_id
1609 -- Identifier for the output results in PO_VALIDATION_RESULTS.
1610 -- If a value is passed in, it will be used and unchanged.
1611 -- If NULL, a distinct value will be retrieved.
1612 --x_result_type
1613 -- Provides a summary of the validation results.
1614 -- An input code will never be turned into a better result,
1615 -- but may be turned into a worse result
1616 -- (ERROR will not become SUCCESS, but WARNING may become ERROR).
1617 ----------------------------------------------------------------------------
1618 PROCEDURE validate_set(
1619 p_validation_set IN PO_TBL_VARCHAR2000
1620 , p_headers IN PO_HEADERS_VAL_TYPE DEFAULT NULL
1621 , p_lines IN PO_LINES_VAL_TYPE DEFAULT NULL
1622 , p_line_locations IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
1623 , p_distributions IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
1624 , p_price_differentials IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
1625 , p_ga_org_assignments IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
1626 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
1627 , p_autocommit_results_flag IN VARCHAR2 DEFAULT NULL
1628 , p_calling_program IN VARCHAR2 DEFAULT NULL
1629 , p_stopping_result_type IN VARCHAR2 DEFAULT NULL
1630 , p_parameter_name_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL
1631 , p_parameter_value_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL
1632 , x_result_type IN OUT NOCOPY VARCHAR2
1633 , x_result_set_id IN OUT NOCOPY NUMBER
1634 , x_results IN OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
1635 )
1636 IS
1637 d_mod CONSTANT VARCHAR2(100) := D_validate_set;
1638 d_position NUMBER := 0;
1639 d_stmt CONSTANT BOOLEAN := PO_LOG.d_stmt;
1640
1641 l_result_set_id NUMBER;
1642 l_result_type VARCHAR2(30);
1643 l_val VARCHAR2(2000);
1644
1645 l_result_rank NUMBER;
1646 l_new_rank NUMBER;
1647 l_stop_rank NUMBER;
1648
1649 l_create_or_update_item VARCHAR2(1);
1650 l_chart_of_account_id NUMBER;
1651 l_po_encumbrance_flag VARCHAR2(1);
1652 l_operating_unit NUMBER;
1653 l_expense_accrual_code PO_SYSTEM_PARAMETERS.expense_accrual_code%TYPE;
1654 l_inventory_org_id NUMBER;
1655 l_doc_type VARCHAR2(25);
1656 l_set_of_books_id NUMBER;
1657 l_func_currency_code GL_SETS_OF_BOOKS.currency_code%TYPE;
1658 l_federal_instance VARCHAR2(1);
1659 l_allow_tax_code_override VARCHAR2(1);
1660 l_allow_tax_rate_override VARCHAR2(1);
1661 l_manual_po_num_type PO_SYSTEM_PARAMETERS.manual_po_num_type%TYPE;
1662 l_manual_quote_num_type PO_SYSTEM_PARAMETERS.manual_quote_num_type%TYPE;
1663
1664 BEGIN
1665
1666 IF PO_LOG.d_proc THEN
1667 PO_LOG.proc_begin(d_mod,'p_validation_set',p_validation_set);
1668 PO_LOG.proc_begin(d_mod,'p_autocommit_results_flag',p_autocommit_results_flag);
1669 PO_LOG.proc_begin(d_mod,'p_calling_program',p_calling_program);
1670 PO_LOG.proc_begin(d_mod,'p_stopping_result_type',p_stopping_result_type);
1671 PO_LOG.proc_begin(d_mod,'p_parameter_name_tbl',p_parameter_name_tbl);
1672 PO_LOG.proc_begin(d_mod,'p_parameter_value_tbl',p_parameter_value_tbl);
1673 PO_LOG.proc_begin(d_mod,'x_result_set_id',x_result_set_id);
1674 PO_LOG.proc_begin(d_mod,'x_result_type',x_result_type);
1675 END IF;
1676 d_position := 1;
1677
1678 IF (p_parameter_name_tbl IS NOT NULL) THEN
1679
1680 d_position := 2;
1681
1682 FOR i IN 1 .. p_parameter_name_tbl.COUNT LOOP
1683
1684 CASE p_parameter_name_tbl(i)
1685 WHEN 'CREATE_OR_UPDATE_ITEM' THEN
1686 l_create_or_update_item := p_parameter_value_tbl(i);
1687 WHEN 'CHART_OF_ACCOUNT_ID' THEN
1688 l_chart_of_account_id := TO_NUMBER(p_parameter_value_tbl(i));
1689 WHEN 'PO_ENCUMBRANCE_FLAG' THEN
1690 l_po_encumbrance_flag := p_parameter_value_tbl(i);
1691 WHEN 'OPERATING_UNIT' THEN
1692 l_operating_unit := TO_NUMBER(p_parameter_value_tbl(i));
1693 WHEN 'EXPENSE_ACCRUAL_CODE' THEN
1694 l_expense_accrual_code := p_parameter_value_tbl(i);
1695 WHEN 'INVENTORY_ORG_ID' THEN
1696 l_inventory_org_id := p_parameter_value_tbl(i);
1697 WHEN 'DOC_TYPE' THEN
1698 l_doc_type := p_parameter_value_tbl(i);
1699 WHEN 'SET_OF_BOOKS_ID' THEN
1700 l_set_of_books_id := p_parameter_value_tbl(i);
1701 WHEN 'FUNCTIONAL_CURRENCY_CODE' THEN
1702 l_func_currency_code := p_parameter_value_tbl(i);
1703 WHEN 'FEDERAL_INSTANCE' THEN
1704 l_federal_instance := p_parameter_value_tbl(i);
1705 WHEN 'ALLOW_TAX_CODE_OVERRIDE' THEN
1706 l_allow_tax_code_override := p_parameter_value_tbl(i);
1707 WHEN 'ALLOW_TAX_RATE_OVERRIDE' THEN
1708 l_allow_tax_rate_override := p_parameter_value_tbl(i);
1709 WHEN 'MANUAL_PO_NUM_TYPE' THEN
1710 l_manual_po_num_type := p_parameter_value_tbl(i);
1711 WHEN 'MANUAL_QUOTE_NUM_TYPE' THEN
1712 l_manual_quote_num_type := p_parameter_value_tbl(i);
1713 END CASE;
1714
1715 END LOOP;
1716
1717 END IF;
1718
1719 d_position := 5;
1720
1721 -- Initialize the IN OUT parameters, to enable chaining of validations.
1722
1723 IF x_result_set_id IS NULL THEN
1724 x_result_set_id := next_result_set_id();
1725 END IF;
1726
1727 d_position := 10;
1728
1729 IF (x_result_type IS NULL) THEN
1730 x_result_type := c_result_type_SUCCESS;
1731 END IF;
1732
1733 IF (x_results IS NULL) THEN
1734 x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
1735 END IF;
1736
1737 d_position := 20;
1738
1739 l_result_rank := result_type_rank(x_result_type);
1740
1741 d_position := 30;
1742
1743 l_stop_rank := result_type_rank(p_stopping_result_type);
1744
1745 d_position := 40;
1746 IF d_stmt THEN
1747 PO_LOG.stmt(d_mod,d_position,'x_result_set_id',x_result_set_id);
1748 PO_LOG.stmt(d_mod,d_position,'x_result_type',x_result_type);
1749 PO_LOG.stmt(d_mod,d_position,'l_result_rank',l_result_rank);
1750 PO_LOG.stmt(d_mod,d_position,'l_stop_rank',l_stop_rank);
1751 END IF;
1752
1753 -- Loop through the validation set, executing each validation in turn.
1754
1755 FOR i IN 1 .. p_validation_set.COUNT LOOP
1756 d_position := 100;
1757
1758 l_val := p_validation_set(i);
1759
1760 IF d_stmt THEN
1761 PO_LOG.stmt(d_mod,d_position,'p_validation_set('||i||')',l_val);
1762 END IF;
1763
1764 d_position := 110;
1765
1766 BEGIN
1767
1768 CASE l_val
1769
1770 ---------------------------------------------------------------
1771 -- Header Validations
1772 ---------------------------------------------------------------
1773
1774 WHEN c_warn_supplier_on_hold THEN
1775 PO_VAL_HEADERS.warn_supplier_on_hold(
1776 p_header_id_tbl => p_headers.po_header_id
1777 , p_vendor_id_tbl => p_headers.vendor_id
1778 , x_result_set_id => l_result_set_id
1779 , x_result_type => l_result_type
1780 );
1781
1782 WHEN c_rate_gt_zero THEN
1783 PO_VAL_HEADERS.rate_gt_zero(
1784 p_header_id_tbl => p_headers.po_header_id
1785 , p_rate_tbl => p_headers.rate
1786 , x_results => x_results
1787 , x_result_type => l_result_type
1788 );
1789
1790 WHEN c_fax_email_address_valid THEN
1791 PO_VAL_HEADERS.fax_email_address_valid(
1792 p_header_id_tbl => p_headers.po_header_id
1793 , p_supplier_notif_method_tbl => p_headers.supplier_notif_method
1794 , p_fax_tbl => p_headers.fax
1795 , p_email_address_tbl => p_headers.email_address
1796 , x_results => x_results
1797 , x_result_type => l_result_type
1798 );
1799
1800 WHEN c_rate_combination_valid THEN
1801 PO_VAL_HEADERS.rate_combination_valid(
1802 p_header_id_tbl => p_headers.po_header_id
1803 , p_org_id_tbl => p_headers.org_id
1804 , p_currency_code_tbl => p_headers.currency_code
1805 , p_rate_type_tbl => p_headers.rate_type
1806 , p_rate_date_tbl => p_headers.rate_date
1807 , p_rate_tbl => p_headers.rate
1808 , x_results => x_results
1809 , x_result_type => l_result_type
1810 );
1811
1812 WHEN c_doc_num_chars_valid THEN
1813 PO_VAL_HEADERS.doc_num_chars_valid(
1814 p_header_id_tbl => p_headers.po_header_id
1815 , p_org_id_tbl => p_headers.org_id
1816 , p_segment1_tbl => p_headers.segment1
1817 , x_results => x_results
1818 , x_result_type => l_result_type
1819 );
1820
1821 WHEN c_doc_num_unique THEN
1822 PO_VAL_HEADERS.doc_num_unique(
1823 p_header_id_tbl => p_headers.po_header_id
1824 , p_org_id_tbl => p_headers.org_id
1825 , p_segment1_tbl => p_headers.segment1
1826 , p_type_lookup_code_tbl => p_headers.type_lookup_code
1827 , x_results => x_results
1828 , x_result_type => l_result_type
1829 );
1830
1831 WHEN c_price_update_tol_ge_zero THEN
1832 PO_VAL_HEADERS.price_update_tol_ge_zero(
1833 p_header_id_tbl => p_headers.po_header_id
1834 , p_price_update_tol_tbl => p_headers.price_update_tolerance
1835 , x_results => x_results
1836 , x_result_type => l_result_type
1837 );
1838
1839 WHEN c_amount_limit_ge_zero THEN
1840 PO_VAL_HEADERS.amount_limit_ge_zero(
1841 p_header_id_tbl => p_headers.po_header_id
1842 , p_amount_limit_tbl => p_headers.amount_limit
1843 , x_results => x_results
1844 , x_result_type => l_result_type
1845 );
1846
1847 WHEN c_amt_limit_ge_amt_agreed THEN
1848 PO_VAL_HEADERS.amt_limit_ge_amt_agreed(
1849 p_header_id_tbl => p_headers.po_header_id
1850 , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
1851 , p_amount_limit_tbl => p_headers.amount_limit
1852 , x_results => x_results
1853 , x_result_type => l_result_type
1854 );
1855
1856 WHEN c_amount_agreed_ge_zero THEN
1857 PO_VAL_HEADERS.amount_agreed_ge_zero(
1858 p_header_id_tbl => p_headers.po_header_id
1859 , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
1860 , x_results => x_results
1861 , x_result_type => l_result_type
1862 );
1863
1864 WHEN c_amount_agreed_not_null THEN
1865 PO_VAL_HEADERS.amount_agreed_not_null(
1866 p_header_id_tbl => p_headers.po_header_id
1867 , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
1868 , p_amount_limit_tbl => p_headers.amount_limit
1869 , x_results => x_results
1870 , x_result_type => l_result_type
1871 );
1872
1873 WHEN c_effective_le_expiration THEN
1874 PO_VAL_HEADERS.effective_le_expiration(
1875 p_header_id_tbl => p_headers.po_header_id
1876 , p_start_date_tbl => p_headers.start_date
1877 , p_end_date_tbl => p_headers.end_date
1878 , x_results => x_results
1879 , x_result_type => l_result_type
1880 );
1881
1882 WHEN c_effective_from_le_order_date THEN
1883 PO_VAL_HEADERS.effective_from_le_order_date(
1884 p_header_id_tbl => p_headers.po_header_id
1885 , p_type_lookup_code_tbl => p_headers.type_lookup_code
1886 , p_start_date_tbl => p_headers.start_date
1887 , x_result_set_id => l_result_set_id
1888 , x_result_type => l_result_type
1889 );
1890
1891 WHEN c_effective_to_ge_order_date THEN
1892 PO_VAL_HEADERS.effective_to_ge_order_date(
1893 p_header_id_tbl => p_headers.po_header_id
1894 , p_type_lookup_code_tbl => p_headers.type_lookup_code
1895 , p_end_date_tbl => p_headers.end_date
1896 , x_result_set_id => l_result_set_id
1897 , x_result_type => l_result_type
1898 );
1899
1900 WHEN c_contract_start_le_order_date THEN
1901 PO_VAL_HEADERS.contract_start_le_order_date(
1902 p_header_id_tbl => p_headers.po_header_id
1903 , p_type_lookup_code_tbl => p_headers.type_lookup_code
1904 , p_start_date_tbl => p_headers.start_date
1905 , x_result_set_id => l_result_set_id
1906 , x_result_type => l_result_type
1907 );
1908
1909 WHEN c_contract_end_ge_order_date THEN
1910 PO_VAL_HEADERS.contract_end_ge_order_date(
1911 p_header_id_tbl => p_headers.po_header_id
1912 , p_type_lookup_code_tbl => p_headers.type_lookup_code
1913 , p_end_date_tbl => p_headers.end_date
1914 , x_result_set_id => l_result_set_id
1915 , x_result_type => l_result_type
1916 );
1917
1918 WHEN c_agent_id_not_null THEN
1919 PO_VAL_HEADERS.agent_id_not_null(
1920 p_header_id_tbl => p_headers.po_header_id
1921 , p_agent_id_tbl => p_headers.agent_id
1922 , x_results => x_results
1923 , x_result_type => l_result_type
1924 );
1925
1926 WHEN c_hdr_ship_to_loc_not_null THEN
1927 PO_VAL_HEADERS.ship_to_loc_not_null(
1928 p_header_id_tbl => p_headers.po_header_id
1929 , p_ship_to_loc_id_tbl => p_headers.ship_to_location_id
1930 , x_results => x_results
1931 , x_result_type => l_result_type
1932 );
1933
1934 WHEN c_vendor_id_not_null THEN
1935 PO_VAL_HEADERS.vendor_id_not_null(
1936 p_header_id_tbl => p_headers.po_header_id
1937 , p_vendor_id_tbl => p_headers.vendor_id
1938 , x_results => x_results
1939 , x_result_type => l_result_type
1940 );
1941
1942 WHEN c_vendor_site_id_not_null THEN
1943 PO_VAL_HEADERS.vendor_site_id_not_null(
1944 p_header_id_tbl => p_headers.po_header_id
1945 , p_vendor_site_id_tbl => p_headers.vendor_site_id
1946 , x_results => x_results
1947 , x_result_type => l_result_type
1948 );
1949
1950 --<Begin Bug# 5372769> EXCEPTION WHEN SAVE PO WO/ NUMBER IF DOCUMENT NUMBERING IS SET TO MANUAL
1951 WHEN c_segment1_not_null THEN
1952 PO_VAL_HEADERS.segment1_not_null(
1953 p_header_id_tbl => p_headers.po_header_id
1954 , p_segment1_tbl => p_headers.segment1
1955 , p_org_id_tbl => p_headers.org_id
1956 , x_result_set_id => l_result_set_id
1957 , x_result_type => l_result_type
1958 );
1959 --<End 5372769>
1960
1961 -------------------------------------------------------------------------
1962 -- PDOI Header Validation Subroutines
1963 -------------------------------------------------------------------------
1964 WHEN c_po_header_id THEN
1965 -- validate that the PO Header Id is not null and
1966 -- does not already exist in the Transaction table (for create case).
1967 PO_VAL_HEADERS2.po_header_id(p_id_tbl => p_headers.interface_id,
1968 p_po_header_id_tbl => p_headers.po_header_id,
1969 x_result_set_id => l_result_set_id,
1970 x_result_type => l_result_type);
1971 WHEN c_end_date THEN
1972 -- validate end date not earlier than start date.
1973 PO_VALIDATION_HELPER.start_date_le_end_date(p_calling_module => p_calling_program,
1974 p_start_date_tbl => p_headers.start_date,
1975 p_end_date_tbl => p_headers.end_date,
1976 p_entity_id_tbl => p_headers.interface_id,
1977 p_entity_type => c_entity_type_header,
1978 p_column_name => 'END DATE',
1979 p_column_val_selector => 'END_DATE',
1980 p_message_name => 'PO_PDOI_INVALID_END_DATE',
1981 p_validation_id => PO_VAL_CONSTANTS.c_end_date,
1982 x_results => x_results,
1983 x_result_type => l_result_type);
1984
1985 WHEN c_type_lookup_code THEN
1986 -- validate type_lookup_code not null and equal to BLANKET, STANDARD or QUOTATION.
1987 PO_VAL_HEADERS2.type_lookup_code(p_id_tbl => p_headers.interface_id,
1988 p_type_lookup_code_tbl => p_headers.type_lookup_code,
1989 x_results => x_results,
1990 x_result_type => l_result_type);
1991 WHEN c_document_num THEN
1992 -- document_num must not be null, must be unique, greater than or equal to zero and be of the correct type.
1993 PO_VAL_HEADERS2.document_num(p_id_tbl => p_headers.interface_id,
1994 p_po_header_id_tbl => p_headers.po_header_id,
1995 p_document_num_tbl => p_headers.document_num,
1996 p_type_lookup_code_tbl => p_headers.type_lookup_code,
1997 p_manual_po_num_type => l_manual_po_num_type,
1998 p_manual_quote_num_type => l_manual_quote_num_type,
1999 x_results => x_results,
2000 x_result_set_id => l_result_set_id,
2001 x_result_type => l_result_type);
2002
2003 WHEN c_acceptance_required_flag THEN
2004 -- bug4911383
2005 PO_VAL_HEADERS2.acceptance_required_flag
2006 ( p_id_tbl => p_headers.interface_id,
2007 p_type_lookup_code_tbl => p_headers.type_lookup_code,
2008 p_acceptance_required_flag_tbl => p_headers.acceptance_required_flag,
2009 x_results => x_results,
2010 x_result_type => l_result_type
2011 );
2012
2013
2014 WHEN c_revision_num THEN
2015 -- validate revision_num is zero.
2016 PO_VALIDATION_HELPER.zero(p_calling_module => p_calling_program,
2017 p_value_tbl => p_headers.revision_num,
2018 p_entity_id_tbl => p_headers.interface_id,
2019 p_entity_type => c_entity_type_header,
2020 p_column_name => 'REVISION_NUM',
2021 p_message_name => 'PO_PDOI_COLUMN_ZERO',
2022 p_validation_id => PO_VAL_CONSTANTS.c_revision_num,
2023 x_results => x_results,
2024 x_result_type => l_result_type);
2025 WHEN c_currency_code THEN
2026 -- validate currency_code is not null and valid in FND_CURRENCIES.
2027 PO_VAL_HEADERS2.currency_code(p_id_tbl => p_headers.interface_id,
2028 p_currency_code_tbl => p_headers.currency_code,
2029 x_result_set_id => l_result_set_id,
2030 x_result_type => l_result_type);
2031 WHEN c_rate_info THEN
2032 -- validate rate information
2033 PO_VAL_HEADERS2.rate_info(p_id_tbl => p_headers.interface_id,
2034 p_currency_code_tbl => p_headers.currency_code,
2035 p_rate_type_tbl => p_headers.rate_type,
2036 p_rate_tbl => p_headers.rate,
2037 p_rate_date_tbl => p_headers.rate_date,
2038 p_func_currency_code => l_func_currency_code,
2039 p_set_of_books_id => l_set_of_books_id,
2040 x_result_set_id => l_result_set_id,
2041 x_results => x_results,
2042 x_result_type => l_result_type);
2043 WHEN c_agent_id THEN
2044 -- validate agent_id is not null and valid in PO_AGENTS.
2045 PO_VAL_HEADERS2.agent_id(p_id_tbl => p_headers.interface_id,
2046 p_agent_id_tbl => p_headers.agent_id,
2047 x_result_set_id => l_result_set_id,
2048 x_result_type => l_result_type);
2049 WHEN c_vendor_info THEN
2050 -- validate vendor information
2051 PO_VAL_HEADERS2.vendor_info(p_id_tbl => p_headers.interface_id,
2052 p_vendor_id_tbl => p_headers.vendor_id,
2053 p_vendor_site_id_tbl => p_headers.vendor_site_id,
2054 p_vendor_contact_id_tbl => p_headers.vendor_contact_id,
2055 p_federal_instance => l_federal_instance,
2056 x_result_set_id => l_result_set_id,
2057 x_results => x_results,
2058 x_result_type => l_result_type);
2059 WHEN c_ship_to_location_id THEN
2060 PO_VAL_HEADERS2.ship_to_location_id(p_id_tbl => p_headers.interface_id,
2061 p_ship_to_location_id_tbl => p_headers.ship_to_location_id,
2062 -- Bug 7007502: Added new param p_type_lookup_code_tbl
2063 p_type_lookup_code_tbl => p_headers.type_lookup_code,
2064 x_result_set_id => l_result_set_id,
2065 x_result_type => l_result_type);
2066 WHEN c_bill_to_location_id THEN
2067 PO_VAL_HEADERS2.bill_to_location_id(p_id_tbl => p_headers.interface_id,
2068 p_bill_to_location_id_tbl => p_headers.bill_to_location_id,
2069 -- Bug 7007502: Added new param p_type_lookup_code_tbl
2070 p_type_lookup_code_tbl => p_headers.type_lookup_code,
2071 x_result_set_id => l_result_set_id,
2072 x_result_type => l_result_type);
2073 WHEN c_style_id THEN
2074 PO_VAL_HEADERS2.style_id(p_id_tbl => p_headers.interface_id,
2075 p_style_id_tbl => p_headers.style_id,
2076 x_result_set_id => l_result_set_id,
2077 x_result_type => l_result_type);
2078 WHEN c_last_update_date THEN
2079 PO_VALIDATION_HELPER.not_null(p_calling_module => p_calling_program,
2080 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.last_update_date),
2081 p_entity_id_tbl => p_headers.interface_id,
2082 p_entity_type => c_entity_type_header,
2083 p_column_name => 'LAST_UPDATE_DATE',
2084 p_message_name => 'PO_PDOI_COLUMN_NOT_NULL',
2085 p_validation_id => PO_VAL_CONSTANTS.c_last_update_date,
2086 x_results => x_results,
2087 x_result_type => l_result_type);
2088 WHEN c_last_updated_by THEN
2089 PO_VALIDATION_HELPER.not_null(p_calling_module => p_calling_program,
2090 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.last_updated_by),
2091 p_entity_id_tbl => p_headers.interface_id,
2092 p_entity_type => c_entity_type_header,
2093 p_column_name => 'LAST_UPDATED_BY',
2094 p_message_name => 'PO_PDOI_COLUMN_NOT_NULL',
2095 p_validation_id => PO_VAL_CONSTANTS.c_last_updated_by,
2096 x_results => x_results,
2097 x_result_type => l_result_type);
2098 WHEN c_po_release_id THEN
2099 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2100 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.po_release_id),
2101 p_entity_id_tbl => p_headers.interface_id,
2102 p_entity_type => c_entity_type_header,
2103 p_column_name => 'PO_RELEASE_ID',
2104 p_message_name => 'PO_PDOI_COLUMN_NULL',
2105 p_token1_name => 'COLUMN_NAME',
2106 p_token1_value => 'PO_RELEASE_ID',
2107 p_token2_name => 'VALUE',
2108 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.po_release_id),
2109 p_validation_id => PO_VAL_CONSTANTS.c_po_release_id,
2110 x_results => x_results,
2111 x_result_type => l_result_type);
2112 WHEN c_release_num THEN
2113 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2114 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_num),
2115 p_entity_id_tbl => p_headers.interface_id,
2116 p_entity_type => c_entity_type_header,
2117 p_column_name => 'RELEASE_NUM',
2118 p_message_name => 'PO_PDOI_COLUMN_NULL',
2119 p_token1_name => 'COLUMN_NAME',
2120 p_token1_value => 'RELEASE_NUM',
2121 p_token2_name => 'VALUE',
2122 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_num),
2123 p_validation_id => PO_VAL_CONSTANTS.c_release_num,
2124 x_results => x_results,
2125 x_result_type => l_result_type);
2126 WHEN c_release_date THEN
2127 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2128 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_date),
2129 p_entity_id_tbl => p_headers.interface_id,
2130 p_entity_type => c_entity_type_header,
2131 p_column_name => 'RELEASE_DATE',
2132 p_message_name => 'PO_PDOI_COLUMN_NULL',
2133 p_token1_name => 'COLUMN_NAME',
2134 p_token1_value => 'RELEASE_DATE',
2135 p_token2_name => 'VALUE',
2136 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_date),
2137 p_validation_id => PO_VAL_CONSTANTS.c_release_date,
2138 x_results => x_results,
2139 x_result_type => l_result_type);
2140 WHEN c_revised_date THEN
2141 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2142 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.revised_date),
2143 p_entity_id_tbl => p_headers.interface_id,
2144 p_entity_type => c_entity_type_header,
2145 p_column_name => 'REVISED_DATE',
2146 p_message_name => 'PO_PDOI_COLUMN_NULL',
2147 p_token1_name => 'COLUMN_NAME',
2148 p_token1_value => 'REVISED_DATE',
2149 p_token2_name => 'VALUE',
2150 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.revised_date),
2151 p_validation_id => PO_VAL_CONSTANTS.c_revised_date,
2152 x_results => x_results,
2153 x_result_type => l_result_type);
2154 WHEN c_printed_date THEN
2155 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2156 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.printed_date),
2157 p_entity_id_tbl => p_headers.interface_id,
2158 p_entity_type => c_entity_type_header,
2159 p_column_name => 'PRINTED_DATE',
2160 p_message_name => 'PO_PDOI_COLUMN_NULL',
2161 p_token1_name => 'COLUMN_NAME',
2162 p_token1_value => 'PRINTED_DATE',
2163 p_token2_name => 'VALUE',
2164 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.printed_date),
2165 p_validation_id => PO_VAL_CONSTANTS.c_printed_date,
2166 x_results => x_results,
2167 x_result_type => l_result_type);
2168 WHEN c_closed_date THEN
2169 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
2170 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.closed_date),
2171 p_entity_id_tbl => p_headers.interface_id,
2172 p_entity_type => c_entity_type_header,
2173 p_column_name => 'CLOSED_DATE',
2174 p_message_name => 'PO_PDOI_COLUMN_NULL',
2175 p_token1_name => 'COLUMN_NAME',
2176 p_token1_value => 'CLOSED_DATE',
2177 p_token2_name => 'VALUE',
2178 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.closed_date),
2179 p_validation_id => PO_VAL_CONSTANTS.c_closed_date,
2180 x_results => x_results,
2181 x_result_type => l_result_type);
2182 WHEN c_terms_id_header THEN
2183 PO_VALIDATION_HELPER.terms_id(p_calling_module => p_calling_program,
2184 p_terms_id_tbl => p_headers.terms_id,
2185 p_entity_id_tbl => p_headers.interface_id,
2186 p_entity_type => c_entity_type_header,
2187 p_validation_id => PO_VAL_CONSTANTS.c_terms_id_header,
2188 x_result_set_id => l_result_set_id,
2189 x_result_type => l_result_type);
2190 WHEN c_ship_via_lookup_code THEN
2191 PO_VAL_HEADERS2.ship_via_lookup_code(p_id_tbl => p_headers.interface_id,
2192 p_ship_via_lookup_code_tbl => p_headers.ship_via_lookup_code,
2193 p_inventory_org_id => l_inventory_org_id,
2194 x_result_set_id => l_result_set_id,
2195 x_result_type => l_result_type);
2196 WHEN c_fob_lookup_code THEN
2197 PO_VAL_HEADERS2.fob_lookup_code(p_id_tbl => p_headers.interface_id,
2198 p_fob_lookup_code_tbl => p_headers.fob_lookup_code,
2199 x_result_set_id => l_result_set_id,
2200 x_result_type => l_result_type);
2201 WHEN c_freight_terms_lookup_code THEN
2202 PO_VAL_HEADERS2.freight_terms_lookup_code(p_id_tbl => p_headers.interface_id,
2203 p_freight_terms_lookup_tbl => p_headers.freight_terms_lookup_code,
2204 x_result_set_id => l_result_set_id,
2205 x_result_type => l_result_type);
2206 WHEN c_shipping_control THEN
2207 PO_VAL_HEADERS2.shipping_control(p_id_tbl => p_headers.interface_id,
2208 p_shipping_control_tbl => p_headers.shipping_control,
2209 x_result_set_id => l_result_set_id,
2210 x_result_type => l_result_type);
2211 WHEN c_confirming_order_flag THEN
2212 PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module => p_calling_program,
2213 p_flag_value_tbl => p_headers.confirming_order_flag,
2214 p_entity_id_tbl => p_headers.interface_id,
2215 p_entity_type => c_entity_type_header,
2216 p_column_name => 'CONFIRMING_ORDER_FLAG',
2217 p_message_name => 'PO_PDOI_INVALID_FLAG_VALUE',
2218 p_token1_name => 'COLUMN_NAME',
2219 p_token1_value => 'CONFIRMING_ORDER_FLAG',
2220 p_token2_name => 'VALUE',
2221 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.confirming_order_flag),
2222 p_validation_id => PO_VAL_CONSTANTS.c_confirming_order_flag,
2223 x_results => x_results,
2224 x_result_type => l_result_type);
2225 WHEN c_acceptance_due_date THEN
2226 PO_VAL_HEADERS2.acceptance_due_date(p_id_tbl => p_headers.interface_id,
2227 p_acceptance_reqd_flag_tbl => p_headers.acceptance_required_flag,
2228 p_acceptance_due_date_tbl => p_headers.acceptance_due_date,
2229 x_results => x_results,
2230 x_result_type => l_result_type);
2231 WHEN c_amount_agreed THEN
2232 PO_VALIDATION_HELPER.greater_or_equal_zero(p_calling_module => p_calling_program,
2233 p_null_allowed_flag => PO_CORE_S.g_parameter_YES, -- bug5008206
2234 p_value_tbl => p_headers.amount_agreed,
2235 p_entity_id_tbl => p_headers.interface_id,
2236 p_entity_type => c_entity_type_header,
2237 p_column_name => c_amount_agreed,
2238 p_message_name => 'PO_PDOI_LT_ZERO',
2239 p_token1_name => 'COLUMN_NAME',
2240 p_token1_value => 'AMOUNT_AGREED',
2241 p_token2_name => 'VALUE',
2242 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.amount_agreed),
2243 p_validation_id => PO_VAL_CONSTANTS.c_amount_agreed,
2244 x_results => x_results,
2245 x_result_type => l_result_type);
2246 WHEN c_amount_limit THEN
2247 -- bug 5352625
2248 PO_VAL_HEADERS2.amount_limit
2249 ( p_id_tbl => p_headers.interface_id,
2250 p_amount_limit_tbl => p_headers.amount_limit,
2251 p_amount_agreed_tbl => p_headers.amount_agreed,
2252 x_results => x_results,
2253 x_result_type => l_result_type
2254 );
2255
2256 WHEN c_firm_status_lookup_header THEN
2257 PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module => p_calling_program,
2258 p_flag_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar1(p_headers.firm_status_lookup_code),
2259 p_entity_id_tbl => p_headers.interface_id,
2260 p_entity_type => c_entity_type_header,
2261 p_column_name => 'FIRM_STATUS_LOOKUP_CODE',
2262 p_message_name => 'PO_PDOI_INVALID_FLAG_VALUE',
2263 p_token1_name => 'COLUMN_NAME',
2264 p_token1_value => 'FIRM_STATUS_LOOKUP_CODE',
2265 p_token2_name => 'VALUE',
2266 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.firm_status_lookup_code),
2267 p_validation_id => PO_VAL_CONSTANTS.c_firm_status_lookup_header,
2268 x_results => x_results,
2269 x_result_type => l_result_type);
2270 WHEN c_cancel_flag THEN
2271 PO_VAL_HEADERS2.cancel_flag(p_id_tbl => p_headers.interface_id,
2272 p_cancel_flag_tbl => p_headers.cancel_flag,
2273 x_results => x_results,
2274 x_result_type => l_result_type);
2275 WHEN c_closed_code THEN
2276 PO_VAL_HEADERS2.closed_code(p_id_tbl => p_headers.interface_id,
2277 p_closed_code_tbl => p_headers.closed_code,
2278 p_acceptance_reqd_flag_tbl => p_headers.acceptance_required_flag,
2279 x_results => x_results,
2280 x_result_type => l_result_type);
2281 WHEN c_print_count THEN
2282 PO_VAL_HEADERS2.print_count(p_id_tbl => p_headers.interface_id,
2283 p_print_count_tbl => p_headers.print_count,
2284 p_approval_status_tbl => p_headers.approval_status,
2285 x_results => x_results,
2286 x_result_type => l_result_type);
2287 WHEN c_frozen_flag THEN
2288 PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module => p_calling_program,
2289 p_flag_value_tbl => p_headers.frozen_flag,
2290 p_entity_id_tbl => p_headers.interface_id,
2291 p_entity_type => c_entity_type_header,
2292 p_column_name => 'FROZEN_FLAG',
2293 p_message_name => 'PO_PDOI_INVALID_FLAG_VALUE',
2294 p_token1_name => 'COLUMN_NAME',
2295 p_token1_value => 'FROZEN_FLAG',
2296 p_token2_name => 'VALUE',
2297 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.frozen_flag),
2298 p_validation_id => PO_VAL_CONSTANTS.c_frozen_flag,
2299 x_results => x_results,
2300 x_result_type => l_result_type);
2301 WHEN c_approval_status THEN
2302 PO_VAL_HEADERS2.approval_status(p_id_tbl => p_headers.interface_id,
2303 p_approval_status_tbl => p_headers.approval_status,
2304 x_results => x_results,
2305 x_result_type => l_result_type);
2306 WHEN c_amount_to_encumber THEN
2307 PO_VAL_HEADERS2.amount_to_encumber(p_id_tbl => p_headers.interface_id,
2308 p_amount_to_encumber_tbl => p_headers.amount_to_encumber,
2309 x_results => x_results,
2310 x_result_type => l_result_type);
2311 WHEN c_quote_warning_delay THEN
2312 PO_VALIDATION_HELPER.not_null(p_calling_module => p_calling_program,
2313 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.quote_warning_delay),
2314 p_entity_id_tbl => p_headers.interface_id,
2315 p_entity_type => c_entity_type_header,
2316 p_column_name => 'QUOTE_WARNING_DELAY',
2317 p_message_name => 'PO_PDOI_COLUMN_NOT_NULL',
2318 p_token1_name => 'COLUMN_NAME',
2319 p_token1_value => 'QUOTE_WARNING_DELAY',
2320 p_token2_name => 'VALUE',
2321 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.quote_warning_delay),
2322 p_validation_id => PO_VAL_CONSTANTS.c_quote_warning_delay,
2323 x_results => x_results,
2324 x_result_type => l_result_type);
2325 WHEN c_approval_required_flag THEN
2326 PO_VALIDATION_HELPER.not_null(p_calling_module => p_calling_program,
2327 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.approval_required_flag),
2328 p_entity_id_tbl => p_headers.interface_id,
2329 p_entity_type => c_entity_type_header,
2330 p_column_name => 'APPROVAL_REQUIRED_FLAG',
2331 p_message_name => 'PO_PDOI_COLUMN_NOT_NULL',
2332 p_token1_name => 'COLUMN_NAME',
2333 p_token1_value => 'APPROVAL_REQUIRED_FLAG',
2334 p_token2_name => 'VALUE',
2335 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.approval_required_flag),
2336 p_validation_id => PO_VAL_CONSTANTS.c_approval_required_flag,
2337 x_results => x_results,
2338 x_result_type => l_result_type);
2339
2340 ---------------------------------------------------------------
2341 -- Line Validations
2342 ---------------------------------------------------------------
2343
2344 WHEN c_amt_agreed_ge_zero THEN
2345 PO_VAL_LINES.amt_agreed_ge_zero(
2346 p_line_id_tbl => p_lines.po_line_id
2347 , p_committed_amount_tbl => p_lines.committed_amount
2348 , x_results => x_results
2349 , x_result_type => l_result_type
2350 );
2351
2352 WHEN c_min_rel_amt_ge_zero THEN
2353 PO_VAL_LINES.min_rel_amt_ge_zero(
2354 p_line_id_tbl => p_lines.po_line_id
2355 , p_min_release_amount_tbl => p_lines.min_release_amount
2356 , x_results => x_results
2357 , x_result_type => l_result_type
2358 );
2359
2360 WHEN c_line_qty_gt_zero THEN
2361 PO_VAL_LINES.quantity_gt_zero(
2362 p_line_id_tbl => p_lines.po_line_id
2363 , p_quantity_tbl => p_lines.quantity
2364 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2365 , x_results => x_results
2366 , x_result_type => l_result_type
2367 );
2368
2369 -- <Complex Work R12 Start>: Consolidate qty rcvd/billed check
2370 WHEN c_line_qty_ge_qty_exec THEN
2371 PO_VAL_LINES.quantity_ge_quantity_exec(
2372 p_line_id_tbl => p_lines.po_line_id
2373 , p_quantity_tbl => p_lines.quantity
2374 , x_result_set_id => l_result_set_id
2375 , x_result_type => l_result_type
2376 );
2377 -- <Complex Work R12 End>
2378
2379 WHEN c_line_qty_ge_qty_enc THEN
2380 PO_VAL_LINES.quantity_ge_quantity_enc(
2381 p_line_id_tbl => p_lines.po_line_id
2382 , p_quantity_tbl => p_lines.quantity
2383 , x_result_set_id => l_result_set_id
2384 , x_result_type => l_result_type
2385 );
2386
2387 WHEN c_quantity_notif_change THEN
2388 PO_VAL_LINES.quantity_notif_change(
2389 p_line_id_tbl => p_lines.po_line_id
2390 , p_quantity_tbl => p_lines.quantity
2391 , x_result_set_id => l_result_set_id
2392 , x_result_type => l_result_type
2393 );
2394
2395 WHEN c_line_amt_gt_zero THEN
2396 PO_VAL_LINES.amount_gt_zero(
2397 p_line_id_tbl => p_lines.po_line_id
2398 , p_amount_tbl => p_lines.amount
2399 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2400 , x_results => x_results
2401 , x_result_type => l_result_type
2402 );
2403
2404 -- <Complex Work R12 Start>: Consolidate amt rcvd/billed check
2405 WHEN c_line_amt_ge_amt_exec THEN
2406 PO_VAL_LINES.amount_ge_amount_exec(
2407 p_line_id_tbl => p_lines.po_line_id
2408 , p_amount_tbl => p_lines.amount
2409 , p_currency_code_tbl => p_lines.hdr_currency_code
2410 , x_result_set_id => l_result_set_id
2411 , x_result_type => l_result_type
2412 );
2413 -- <Complex Work R12 End>
2414
2415 WHEN c_line_amt_ge_timecard THEN
2416 PO_VAL_LINES.amount_ge_timecard(
2417 p_line_id_tbl => p_lines.po_line_id
2418 , p_amount_tbl => p_lines.amount
2419 , x_results => x_results
2420 , x_result_type => l_result_type
2421 );
2422
2423 WHEN c_line_num_unique THEN
2424 PO_VAL_LINES.line_num_unique(
2425 p_line_id_tbl => p_lines.po_line_id
2426 , p_header_id_tbl => p_lines.po_header_id
2427 , p_line_num_tbl => p_lines.line_num
2428 , x_result_set_id => l_result_set_id
2429 , x_result_type => l_result_type
2430 );
2431
2432 WHEN c_line_num_gt_zero THEN
2433 PO_VAL_LINES.line_num_gt_zero(
2434 p_line_id_tbl => p_lines.po_line_id
2435 , p_line_num_tbl => p_lines.line_num
2436 , x_results => x_results
2437 , x_result_type => l_result_type
2438 );
2439
2440 WHEN c_vmi_asl_exists THEN
2441 PO_VAL_LINES.vmi_asl_exists(
2442 p_line_id_tbl => p_lines.po_line_id
2443 , p_type_lookup_code_tbl => p_lines.hdr_type_lookup_code
2444 , p_item_id_tbl => p_lines.item_id
2445 -- Bug# 4634769: Pass in the inventory org id
2446 , p_org_id_tbl => p_lines.inventory_org_id
2447 , p_vendor_id_tbl => p_lines.hdr_vendor_id
2448 , p_vendor_site_id_tbl => p_lines.hdr_vendor_site_id
2449 , x_result_set_id => l_result_set_id
2450 , x_result_type => l_result_type
2451 );
2452
2453 WHEN c_start_date_le_end_date THEN
2454 PO_VAL_LINES.start_date_le_end_date(
2455 p_line_id_tbl => p_lines.po_line_id
2456 , p_start_date_tbl => p_lines.start_date
2457 , p_expiration_date_tbl => p_lines.expiration_date
2458 , x_results => x_results
2459 , x_result_type => l_result_type
2460 );
2461
2462 WHEN c_otl_inv_start_date_change THEN
2463 PO_VAL_LINES.otl_invalid_start_date_change(
2464 p_line_id_tbl => p_lines.po_line_id
2465 , p_start_date_tbl => p_lines.start_date
2466 , x_results => x_results
2467 , x_result_type => l_result_type
2468 );
2469
2470 WHEN c_otl_inv_end_date_change THEN
2471 PO_VAL_LINES.otl_invalid_end_date_change(
2472 p_line_id_tbl => p_lines.po_line_id
2473 , p_expiration_date_tbl => p_lines.expiration_date
2474 , x_results => x_results
2475 , x_result_type => l_result_type
2476 );
2477
2478 WHEN c_unit_price_ge_zero THEN
2479 PO_VAL_LINES.unit_price_ge_zero(
2480 p_line_id_tbl => p_lines.po_line_id
2481 , p_unit_price_tbl => p_lines.unit_price
2482 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2483 , x_results => x_results
2484 , x_result_type => l_result_type
2485 );
2486
2487 WHEN c_list_price_ge_zero THEN
2488 PO_VAL_LINES.list_price_ge_zero(
2489 p_line_id_tbl => p_lines.po_line_id
2490 , p_list_price_per_unit_tbl => p_lines.list_price_per_unit
2491 , x_results => x_results
2492 , x_result_type => l_result_type
2493 );
2494
2495 WHEN c_market_price_ge_zero THEN
2496 PO_VAL_LINES.market_price_ge_zero(
2497 p_line_id_tbl => p_lines.po_line_id
2498 , p_market_price_tbl => p_lines.market_price
2499 , x_results => x_results
2500 , x_result_type => l_result_type
2501 );
2502
2503 WHEN c_validate_unit_price_change THEN
2504 PO_VAL_LINES.validate_unit_price_change(
2505 p_line_id_tbl => p_lines.po_line_id
2506 , p_unit_price_tbl => p_lines.unit_price
2507 , p_price_break_lookup_code_tbl => p_lines.price_break_lookup_code
2508 , x_result_set_id => l_result_set_id
2509 , x_results => x_results
2510 , x_result_type => l_result_type
2511 );
2512
2513 WHEN c_expiration_ge_blanket_start THEN
2514 PO_VAL_LINES.expiration_ge_blanket_start(
2515 p_line_id_tbl => p_lines.po_line_id
2516 , p_blanket_start_date_tbl => p_lines.hdr_start_date
2517 , p_expiration_date_tbl => p_lines.expiration_date
2518 , x_results => x_results
2519 , x_result_type => l_result_type
2520 );
2521
2522 WHEN c_expiration_le_blanket_end THEN
2523 PO_VAL_LINES.expiration_le_blanket_end(
2524 p_line_id_tbl => p_lines.po_line_id
2525 , p_blanket_end_date_tbl => p_lines.hdr_end_date
2526 , p_expiration_date_tbl => p_lines.expiration_date
2527 , x_results => x_results
2528 , x_result_type => l_result_type
2529 );
2530
2531 -- <Complex Work R12 Start>
2532 WHEN c_qty_ge_qty_milestone_exec THEN
2533 PO_VAL_LINES.qty_ge_qty_milestone_exec(
2534 p_line_id_tbl => p_lines.po_line_id
2535 , p_quantity_tbl => p_lines.quantity
2536 , x_result_set_id => l_result_set_id
2537 , x_result_type => l_result_type
2538 );
2539
2540 WHEN c_price_ge_price_mstone_exec THEN
2541 PO_VAL_LINES.price_ge_price_milestone_exec(
2542 p_line_id_tbl => p_lines.po_line_id
2543 , p_price_tbl => p_lines.unit_price
2544 , x_result_set_id => l_result_set_id
2545 , x_result_type => l_result_type
2546 );
2547
2548 -- Bug 5072189 START
2549 WHEN c_recoupment_rate_range_check THEN
2550 PO_VAL_LINES.recoupment_rate_range_check(
2551 p_line_id_tbl => p_lines.po_line_id
2552 , p_recoupment_rate_tbl => p_lines.recoupment_rate
2553 , x_results => x_results
2554 , x_result_type => l_result_type
2555 );
2556
2557 WHEN c_retainage_rate_range_check THEN
2558 PO_VAL_LINES.retainage_rate_range_check(
2559 p_line_id_tbl => p_lines.po_line_id
2560 , p_retainage_rate_tbl => p_lines.retainage_rate
2561 , x_results => x_results
2562 , x_result_type => l_result_type
2563 );
2564
2565 WHEN c_prog_pay_rate_range_check THEN
2566 PO_VAL_LINES.prog_pay_rate_range_check(
2567 p_line_id_tbl => p_lines.po_line_id
2568 , p_prog_pay_rate_tbl => p_lines.progress_payment_rate
2569 , x_results => x_results
2570 , x_result_type => l_result_type
2571 );
2572 -- Bug 5072189 END
2573
2574 -- Bug 5221843 START
2575 WHEN c_max_retain_amt_ge_zero THEN
2576 PO_VAL_LINES.max_retain_amt_ge_zero (
2577 p_line_id_tbl => p_lines.po_line_id
2578 , p_max_retain_amt_tbl => p_lines.max_retainage_amount
2579 , x_results => x_results
2580 , x_result_type => l_result_type
2581 );
2582 -- Bug 5221843 END
2583
2584 -- Bug 5453079 START
2585 WHEN c_max_retain_amt_ge_retained THEN
2586 PO_VAL_LINES.max_retain_amt_ge_retained (
2587 p_line_id_tbl => p_lines.po_line_id
2588 , p_max_retain_amt_tbl => p_lines.max_retainage_amount
2589 , x_result_set_id => l_result_set_id
2590 , x_result_type => l_result_type
2591 );
2592 -- Bug 5453079 END
2593
2594 -- <Complex Work R12 End>
2595
2596 WHEN c_unit_meas_not_null THEN
2597 PO_VAL_LINES.unit_meas_not_null(
2598 p_line_id_tbl => p_lines.po_line_id
2599 , p_unit_meas_lookup_code_tbl => p_lines.unit_meas_lookup_code
2600 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2601 , x_results => x_results
2602 , x_result_type => l_result_type
2603 );
2604
2605 WHEN c_item_description_not_null THEN
2606 PO_VAL_LINES.item_description_not_null(
2607 p_line_id_tbl => p_lines.po_line_id
2608 , p_item_description_tbl => p_lines.item_description
2609 , x_results => x_results
2610 , x_result_type => l_result_type
2611 );
2612
2613 WHEN c_category_id_not_null THEN
2614 PO_VAL_LINES.category_id_not_null(
2615 p_line_id_tbl => p_lines.po_line_id
2616 , p_category_id_tbl => p_lines.category_id
2617 , x_results => x_results
2618 , x_result_type => l_result_type
2619 );
2620
2621 WHEN c_item_id_not_null THEN
2622 IF (p_calling_program = c_program_PDOI) THEN
2623 PO_VAL_LINES.item_id_not_null(
2624 p_id_tbl => p_lines.interface_id
2625 , p_item_id_tbl => p_lines.item_id
2626 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2627 , p_line_type_id_tbl => p_lines.line_type_id
2628 , p_message_name => PO_MESSAGE_S.PO_PDOI_ITEM_NOT_NULL
2629 , x_result_set_id => l_result_set_id
2630 , x_result_type => l_result_type
2631 );
2632 ELSE
2633 PO_VAL_LINES.item_id_not_null(
2634 p_id_tbl => p_lines.po_line_id
2635 , p_item_id_tbl => p_lines.item_id
2636 , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2637 , p_line_type_id_tbl => p_lines.line_type_id
2638 , p_message_name => PO_MESSAGE_S.PO_ALL_NOT_NULL
2639 , x_result_set_id => l_result_set_id
2640 , x_result_type => l_result_type
2641 );
2642 END IF;
2643
2644 WHEN c_temp_labor_job_id_not_null THEN
2645 PO_VAL_LINES.temp_labor_job_id_not_null(
2646 p_line_id_tbl => p_lines.po_line_id
2647 , p_job_id_tbl => p_lines.job_id
2648 , p_purchase_basis_tbl => p_lines.purchase_basis
2649 , x_results => x_results
2650 , x_result_type => l_result_type
2651 );
2652
2653 WHEN c_line_type_id_not_null THEN
2654 PO_VAL_LINES.line_type_id_not_null(
2655 p_line_id_tbl => p_lines.po_line_id
2656 , p_line_type_id_tbl => p_lines.line_type_id
2657 , x_results => x_results
2658 , x_result_type => l_result_type
2659 );
2660
2661 WHEN c_temp_lbr_start_date_not_null THEN
2662 PO_VAL_LINES.temp_lbr_start_date_not_null(
2663 p_line_id_tbl => p_lines.po_line_id
2664 , p_start_date_tbl => p_lines.start_date
2665 , p_purchase_basis_tbl => p_lines.purchase_basis
2666 , x_results => x_results
2667 , x_result_type => l_result_type
2668 );
2669
2670 WHEN c_src_doc_line_not_null THEN
2671 PO_VAL_LINES.src_doc_line_not_null(
2672 p_line_id_tbl => p_lines.po_line_id
2673 , p_from_header_id_tbl => p_lines.from_header_id
2674 , p_from_line_id_tbl => p_lines.from_line_id
2675 , x_results => x_results
2676 , x_result_type => l_result_type
2677 );
2678
2679 -- Opm related validation : OPM Integration R12 Start
2680 WHEN c_line_sec_qty_gt_zero THEN
2681 PO_VAL_LINES.line_sec_quantity_gt_zero(
2682 p_line_id_tbl => p_lines.po_line_id
2683 , p_item_id_tbl => p_lines.item_id
2684 , p_sec_quantity_tbl => p_lines.secondary_quantity
2685 , x_results => x_results
2686 , x_result_type => l_result_type
2687 );
2688
2689 WHEN c_line_qtys_within_deviation THEN
2690 PO_VAL_LINES.line_qtys_within_deviation(
2691 p_line_id_tbl => p_lines.po_line_id
2692 , p_item_id_tbl => p_lines.item_id
2693 , p_quantity_tbl => p_lines.quantity
2694 , p_primary_uom_tbl => p_lines.unit_meas_lookup_code
2695 , p_sec_quantity_tbl => p_lines.secondary_quantity
2696 , p_secondary_uom_tbl => p_lines.secondary_unit_of_measure
2697 , x_results => x_results
2698 , x_result_type => l_result_type
2699 );
2700 -- Opm related validation : OPM Integration R12 End
2701
2702 WHEN c_from_line_id_not_null THEN
2703 PO_VAL_LINES.from_line_id_not_null(
2704 p_line_id_tbl => p_lines.po_line_id
2705 , p_from_header_id_tbl => p_lines.from_header_id
2706 , p_from_line_id_tbl => p_lines.from_line_id
2707 , x_results => x_results
2708 , x_result_type => l_result_type
2709 );
2710
2711 -- Bug 5070210 Start
2712 WHEN c_amt_ge_advance_amt THEN
2713 PO_VAL_LINES.advance_amt_le_amt(
2714 p_line_id_tbl => p_lines.po_line_id,
2715 p_advance_tbl => p_lines.advance_amount,
2716 p_amount_tbl => p_lines.amount,
2717 p_quantity_tbl => p_lines.quantity,
2718 p_price_tbl => p_lines.unit_price,
2719 x_results => x_results,
2720 x_result_type => l_result_type
2721 );
2722 -- Bug 5070210 End
2723
2724 -- Bug 7516824: Validate PO_LINES DFF
2725 WHEN c_line_dff_validate THEN
2726 PO_VALIDATION_HELPER.validate_desc_flex(
2727 p_calling_module => p_calling_program,
2728 p_id_tbl => p_lines.po_line_id,
2729 p_desc_flex_name => 'PO_LINES',
2730 p_attribute_category_tbl => p_lines.attribute_category,
2731 p_attribute1_tbl => p_lines.attribute1,
2732 p_attribute2_tbl => p_lines.attribute2,
2733 p_attribute3_tbl => p_lines.attribute3,
2734 p_attribute4_tbl => p_lines.attribute4,
2735 p_attribute5_tbl => p_lines.attribute5,
2736 p_attribute6_tbl => p_lines.attribute6,
2737 p_attribute7_tbl => p_lines.attribute7,
2738 p_attribute8_tbl => p_lines.attribute8,
2739 p_attribute9_tbl => p_lines.attribute9,
2740 p_attribute10_tbl => p_lines.attribute10,
2741 p_attribute11_tbl => p_lines.attribute11,
2742 p_attribute12_tbl => p_lines.attribute12,
2743 p_attribute13_tbl => p_lines.attribute13,
2744 p_attribute14_tbl => p_lines.attribute14,
2745 p_attribute15_tbl => p_lines.attribute15,
2746 p_entity_type => c_entity_type_line,
2747 x_results => x_results,
2748 x_result_type => l_result_type);
2749
2750 -------------------------------------------------------------------------
2751 -- Line Validation Subroutines
2752 -------------------------------------------------------------------------
2753 WHEN c_over_tolerance_error_flag THEN
2754 -- The lookup code specified in over_tolerance_error_flag with the lookup type
2755 -- 'RECEIVING CONTROL LEVEL' has to exist in po_lookup_codes and still active.
2756 -- This method is called only for Standard PO and quotation documents
2757 PO_VAL_LINES2.over_tolerance_err_flag(p_id_tbl => p_lines.interface_id,
2758 p_over_tolerance_err_flag_tbl => p_lines.over_tolerance_error_flag,
2759 x_result_set_id => l_result_set_id,
2760 x_result_type => l_result_type);
2761 WHEN c_expiration_date_blanket THEN
2762 -- Expiration date on the line cannot be earlier than the header effective start date and cannot be later than header effective end date
2763 PO_VAL_LINES2.expiration_date_blanket(p_id_tbl => p_lines.interface_id,
2764 p_expiration_date_tbl => p_lines.expiration_date,
2765 p_header_start_date_tbl => p_lines.hdr_start_date,
2766 p_header_end_date_tbl => p_lines.hdr_end_date,
2767 x_results => x_results,
2768 x_result_type => l_result_type);
2769 WHEN c_global_agreement_flag THEN
2770 -- For blanket document with purchase type 'TEMP LABOR', the global agreement
2771 -- flag has to be 'Y'. Global_agreement_flag and outside operation flag cannot both be 'Y'
2772 PO_VAL_LINES2.global_agreement_flag(p_id_tbl => p_lines.interface_id,
2773 p_global_agreement_flag_tbl => p_lines.global_agreement_flag,
2774 p_purchase_basis_tbl => p_lines.purchase_basis,
2775 p_line_type_id_tbl => p_lines.line_type_id,
2776 x_result_set_id => l_result_set_id,
2777 x_results => x_results,
2778 x_result_type => l_result_type);
2779 WHEN c_amount_blanket THEN
2780 -- If order_type_lookup_code is 'RATE', amount has to be null
2781 PO_VAL_LINES2.amount_blanket(p_id_tbl => p_lines.interface_id,
2782 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2783 p_amount_tbl => p_lines.amount,
2784 x_results => x_results,
2785 x_result_type => l_result_type);
2786 WHEN c_order_type_lookup_code THEN
2787 -- If services procurement is not enabled, the order_type_lookup_code cannot
2788 -- be 'FIXED PRICE' or 'RATE'.
2789 PO_VAL_LINES2.order_type_lookup_code(p_id_tbl => p_lines.interface_id,
2790 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2791 x_results => x_results,
2792 x_result_type => l_result_type);
2793 WHEN c_contractor_name THEN
2794 -- If purchase basis is not 'TEMP LABOR' or document type is not STANDARD,
2795 -- contractor first name and last name fields should be empty
2796 PO_VAL_LINES2.contractor_name(p_id_tbl => p_lines.interface_id,
2797 p_doc_type => l_doc_type,
2798 p_purchase_basis_tbl => p_lines.purchase_basis,
2799 p_contractor_last_name_tbl => p_lines.contractor_last_name,
2800 p_contractor_first_name_tbl => p_lines.contractor_first_name,
2801 x_results => x_results,
2802 x_result_type => l_result_type);
2803 WHEN c_job_id THEN
2804 -- If purchase basis is TEMP LABOR, then job id must be null
2805 PO_VAL_LINES2.job_id(p_id_tbl => p_lines.interface_id,
2806 p_job_id_tbl => p_lines.job_id,
2807 p_job_business_group_id_tbl => p_lines.job_business_group_id,
2808 p_purchase_basis_tbl => p_lines.purchase_basis,
2809 p_category_id_tbl => p_lines.category_id,
2810 x_result_set_id => l_result_set_id,
2811 x_results => x_results,
2812 x_result_type => l_result_type);
2813 WHEN c_job_business_group_id THEN
2814 -- If services procurement not enabled, order_type_lookup_code cannot be
2815 -- 'FIXED PRICE' or 'RATE'
2816 PO_VAL_LINES2.job_business_group_id(p_id_tbl => p_lines.interface_id,
2817 p_job_id_tbl => p_lines.job_id,
2818 p_job_business_group_id_tbl => p_lines.job_business_group_id,
2819 p_purchase_basis_tbl => p_lines.purchase_basis,
2820 x_result_set_id => l_result_set_id,
2821 x_result_type => l_result_type);
2822 WHEN c_capital_expense_flag THEN
2823 -- If purchase_basis = 'TEMP LABOR', then capital_expense_flag cannot = 'Y'
2824 PO_VAL_LINES2.capital_expense_flag(p_id_tbl => p_lines.interface_id,
2825 p_purchase_basis_tbl => p_lines.purchase_basis,
2826 p_capital_expense_flag_tbl => p_lines.capital_expense_flag,
2827 x_results => x_results,
2828 x_result_type => l_result_type);
2829 WHEN c_un_number_id THEN
2830 -- If purchase_basis = 'TEMP LABOR', then un_number must be null
2831 PO_VAL_LINES2.un_number_id(p_id_tbl => p_lines.interface_id,
2832 p_purchase_basis_tbl => p_lines.purchase_basis,
2833 p_un_number_id_tbl => p_lines.un_number_id,
2834 x_result_set_id => l_result_set_id,
2835 x_results => x_results,
2836 x_result_type => l_result_type);
2837 WHEN c_hazard_class_id THEN
2838 -- If purchase_basis = 'TEMP LABOR', then un_number must be null
2839 PO_VAL_LINES2.hazard_class_id(p_id_tbl => p_lines.interface_id,
2840 p_purchase_basis_tbl => p_lines.purchase_basis,
2841 p_hazard_class_id_tbl => p_lines.hazard_class_id,
2842 x_result_set_id => l_result_set_id,
2843 x_results => x_results,
2844 x_result_type => l_result_type);
2845 WHEN c_item_id THEN
2846 -- If order_type_lookup_code is 'FIXED PRICE', 'RATE', or 'AMOUNT', item_id has to be null
2847 PO_VAL_LINES2.item_id(p_id_tbl => p_lines.interface_id,
2848 p_item_id_tbl => p_lines.item_id,
2849 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2850 p_line_type_id_tbl => p_lines.line_type_id,
2851 p_inventory_org_id => l_inventory_org_id,
2852 x_result_set_id => l_result_set_id,
2853 x_results => x_results,
2854 x_result_type => l_result_type);
2855 WHEN c_item_description THEN
2856 -- Make sure that the item_description is populated, and also need to find out if it is different from
2857 -- what is setup for the item. Would not allow item_description update if item attribute
2858 -- allow_item_desc_update_flag is N.
2859 PO_VAL_LINES2.item_description(p_id_tbl => p_lines.interface_id,
2860 p_item_description_tbl => p_lines.item_description,
2861 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2862 p_item_id_tbl => p_lines.item_id,
2863 p_create_or_update_item => l_create_or_update_item,
2864 p_inventory_org_id => l_inventory_org_id,
2865 x_result_set_id => l_result_set_id,
2866 x_result_type => l_result_type);
2867 WHEN c_unit_meas_lookup_code THEN
2868 -- check to see if x_item_unit_of_measure is valid
2869 PO_VAL_LINES2.unit_meas_lookup_code(p_id_tbl => p_lines.interface_id,
2870 p_unit_meas_lookup_code_tbl => p_lines.unit_meas_lookup_code,
2871 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2872 p_item_id_tbl => p_lines.item_id,
2873 p_line_type_id_tbl => p_lines.line_type_id,
2874 p_inventory_org_id => l_inventory_org_id,
2875 x_result_set_id => l_result_set_id,
2876 x_results => x_results,
2877 x_result_type => l_result_type);
2878 WHEN c_item_revision THEN
2879 -- if order_type_lookup_code is FIXED PRICE or RATE, or item id is null, then item revision has to
2880 -- be NULL. Check to see if there are x_item_revision exists in mtl_item_revisions table
2881 PO_VAL_LINES2.item_revision(p_id_tbl => p_lines.interface_id,
2882 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2883 p_item_revision_tbl => p_lines.item_revision,
2884 p_item_id_tbl => p_lines.item_id,
2885 x_result_set_id => l_result_set_id,
2886 x_results => x_results,
2887 x_result_type => l_result_type);
2888 WHEN c_category_id THEN
2889 -- Validate and make sure category_id is a valid category within the default category set for Purchasing.
2890 -- Validate if X_category_id belong to the X_item. Check if the Purchasing Category set has
2891 -- 'Validate flag' ON. If Yes, we will validate the Category to exist in the 'Valid Category List'.
2892 -- If No, we will just validate if the category is Enable and Active.
2893 PO_VAL_LINES2.category_id(p_id_tbl => p_lines.interface_id,
2894 p_category_id_tbl => p_lines.category_id,
2895 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2896 p_item_id_tbl => p_lines.item_id,
2897 p_inventory_org_id => l_inventory_org_id,
2898 x_result_set_id => l_result_set_id,
2899 x_results => x_results,
2900 x_result_type => l_result_type);
2901 WHEN c_ip_category_id THEN
2902 -- Validate ip_category_id is not empty
2903 -- Validate ip_category_id is valid if not empty.
2904 PO_VAL_LINES2.ip_category_id(p_id_tbl => p_lines.interface_id,
2905 p_ip_category_id_tbl => p_lines.ip_category_id,
2906 x_result_set_id => l_result_set_id,
2907 x_results => x_results,
2908 x_result_type => l_result_type);
2909 WHEN c_unit_price THEN
2910 --If order_type_lookup_code is not 'FIXED PRICE', unit_price cannot be null and cannot be less than zero.
2911 --If line_type_id is not null and order_type_lookup_code is 'AMOUNT', unit_price should be the same as the one defined in the line_type.
2912 --If order_type_lookup_code is 'FIXED PRICE', unit_price has to be null.
2913 PO_VAL_LINES2.unit_price(p_id_tbl => p_lines.interface_id,
2914 p_unit_price_tbl => p_lines.unit_price,
2915 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2916 p_line_type_id_tbl => p_lines.line_type_id,
2917 x_result_set_id => l_result_set_id,
2918 x_results => x_results,
2919 x_result_type => l_result_type);
2920 WHEN c_quantity THEN
2921 -- If order_type_lookup_code is not 'FIXED PRICE' or 'RATE', quantity cannot be less than zero
2922 -- If order_type_lookup_code is 'FIXED PRICE' or 'RATE', quantity has to be null.
2923 PO_VAL_LINES2.quantity(p_id_tbl => p_lines.interface_id,
2924 p_quantity_tbl => p_lines.quantity,
2925 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2926 x_results => x_results,
2927 x_result_type => l_result_type);
2928 WHEN c_amount THEN
2929 -- If order_type_lookup_code is not 'FIXED PRICE' or 'RATE', amount has to be null
2930 PO_VAL_LINES2.amount(p_id_tbl => p_lines.interface_id,
2931 p_amount_tbl => p_lines.amount,
2932 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2933 x_results => x_results,
2934 x_result_type => l_result_type);
2935 WHEN c_rate_type THEN
2936 -- For rate based temp labor line, the currency rate_type cannot be 'user'
2937 PO_VAL_LINES2.rate_type(p_id_tbl => p_lines.interface_id,
2938 p_rate_type_tbl => p_lines.hdr_rate_type,
2939 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2940 x_results => x_results,
2941 x_result_type => l_result_type);
2942 WHEN c_line_num THEN
2943 -- Line num must be populated and cannot be <= 0.
2944 -- Line num has to be unique in a requisition.
2945 PO_VAL_LINES2.line_num(p_id_tbl => p_lines.interface_id,
2946 p_po_header_id_tbl => p_lines.po_header_id,
2947 p_line_num_tbl => p_lines.line_num,
2948 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2949 p_draft_id_tbl => p_lines.draft_id, -- bug5129752
2950 x_result_set_id => l_result_set_id,
2951 x_results => x_results,
2952 x_result_type => l_result_type);
2953 WHEN c_po_line_id THEN
2954 -- Po_line_id must be populated and unique.
2955 PO_VAL_LINES2.po_line_id(p_id_tbl => p_lines.interface_id,
2956 p_po_line_id_tbl => p_lines.po_line_id,
2957 p_po_header_id_tbl => p_lines.po_header_id,
2958 x_result_set_id => l_result_set_id,
2959 x_result_type => l_result_type);
2960 WHEN c_line_type_id THEN
2961 -- Line type id must be populated and exist in po_line_types_val_v
2962 PO_VAL_LINES2.line_type_id(p_id_tbl => p_lines.interface_id,
2963 p_line_type_id_tbl => p_lines.line_type_id,
2964 x_result_set_id => l_result_set_id,
2965 x_result_type => l_result_type);
2966 WHEN c_line_style_related_info THEN
2967 PO_VAL_LINES2.style_related_info(p_id_tbl => p_lines.interface_id,
2968 p_style_id_tbl => p_lines.hdr_style_id,
2969 p_line_type_id_tbl => p_lines.line_type_id,
2970 p_purchase_basis_tbl => p_lines.purchase_basis,
2971 x_result_set_id => l_result_set_id,
2972 x_result_type => l_result_type);
2973 WHEN c_price_type_lookup_code THEN
2974 -- If price_type_lookup_code is not null, it has to be a valid price type in po_lookup_codes
2975 PO_VAL_LINES2.price_type_lookup_code(p_id_tbl => p_lines.interface_id,
2976 p_price_type_lookup_code_tbl => p_lines.price_type_lookup_code,
2977 x_result_set_id => l_result_set_id,
2978 x_result_type => l_result_type);
2979 WHEN c_start_date_standard THEN
2980 -- Start date is required for Standard PO with purchase basis 'TEMP LABOR'
2981 -- Expiration date if provided should be later than the start date
2982 -- If purchase basis is not 'TEMP LABOR', start_date and expiration_date have to be null
2983 PO_VAL_LINES2.start_date_standard(p_id_tbl => p_lines.interface_id,
2984 p_start_date_tbl => p_lines.start_date,
2985 p_expiration_date_tbl => p_lines.expiration_date,
2986 p_purchase_basis_tbl => p_lines.purchase_basis,
2987 x_results => x_results,
2988 x_result_type => l_result_type);
2989 WHEN c_item_id_standard THEN
2990 -- If order_type_lookup_code is not 'RATE' or 'FIXED PRICE', and item_id is not null, then bom_item_type cannot be 1 or 2.
2991 PO_VAL_LINES2.item_id_standard(p_id_tbl => p_lines.interface_id,
2992 p_item_id_tbl => p_lines.item_id,
2993 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
2994 p_inventory_org_id => l_inventory_org_id,
2995 x_result_set_id => l_result_set_id,
2996 x_result_type => l_result_type);
2997 WHEN c_quantity_standard THEN
2998 -- Quantity cannot be zero for SPO
2999 -- And qiantity cannot be empty for SPO if order type is QUANTITY/AMOUNT
3000 PO_VAL_LINES2.quantity_standard(p_id_tbl => p_lines.interface_id,
3001 p_quantity_tbl => p_lines.quantity,
3002 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3003 x_results => x_results,
3004 x_result_type => l_result_type);
3005 WHEN c_amount_standard THEN
3006 -- If order_type_lookup_code is 'FIXED PRICE' or 'RATE', amount cannot be null
3007 PO_VAL_LINES2.amount_standard(p_id_tbl => p_lines.interface_id,
3008 p_amount_tbl => p_lines.amount,
3009 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3010 x_results => x_results,
3011 x_result_type => l_result_type);
3012 WHEN c_price_break_lookup_code THEN
3013 -- bug5016163
3014 PO_VAL_LINES2.price_break_lookup_code(p_id_tbl => p_lines.interface_id,
3015 p_price_break_lookup_code_tbl => p_lines.price_break_lookup_code,
3016 p_global_agreement_flag_tbl => p_lines.global_agreement_flag,
3017 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3018 p_purchase_basis_tbl => p_lines.purchase_basis,
3019 x_result_set_id => l_result_set_id,
3020 x_results => x_results,
3021 x_result_type => l_result_type);
3022 WHEN c_not_to_exceed_price THEN
3023 -- If allow_price_override_flag is 'N', then not_to_exceed_price has to be null.
3024 -- If not_to_exceed_price is not null, then it cannot be less than unit_price.
3025 PO_VAL_LINES2.not_to_exceed_price(p_id_tbl => p_lines.interface_id,
3026 p_not_to_exceed_price_tbl => p_lines.not_to_exceed_price,
3027 p_allow_price_override_tbl => p_lines.allow_price_override_flag,
3028 p_unit_price_tbl => p_lines.unit_price,
3029 x_results => x_results,
3030 x_result_type => l_result_type);
3031 WHEN c_uom_update THEN
3032 -- validate unit_meas_lookup_code against po_lines_all and po_units_of_measure_val_v
3033 -- for the Update case
3034 PO_VAL_LINES2.uom_update(p_id_tbl => p_lines.interface_id,
3035 p_unit_meas_lookup_code_tbl => p_lines.unit_meas_lookup_code,
3036 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3037 p_po_header_id_tbl => p_lines.po_header_id,
3038 p_po_line_id_tbl => p_lines.po_line_id,
3039 x_results => x_results,
3040 x_result_set_id => l_result_set_id,
3041 x_result_type => l_result_type);
3042 WHEN c_unit_price_update THEN
3043 -- In the UPDATE case, unit_price cannot be negative. Also handle #DEL.
3044 PO_VAL_LINES2.unit_price_update
3045 ( p_id_tbl => p_lines.interface_id,
3046 p_po_line_id_tbl => p_lines.po_line_id, -- bug5008206
3047 p_draft_id_tbl => p_lines.draft_id, -- bug5258790
3048 p_unit_price_tbl => p_lines.unit_price,
3049 x_results => x_results,
3050 x_result_set_id => l_result_set_id, -- bug5008206
3051 x_result_type => l_result_type
3052 );
3053
3054 WHEN c_amount_update THEN
3055 -- In the UPDATE case, unit_price cannot be negative. Also handle #DEL.
3056 PO_VAL_LINES2.amount_update
3057 ( p_id_tbl => p_lines.interface_id,
3058 p_po_line_id_tbl => p_lines.po_line_id, -- bug5008206
3059 p_draft_id_tbl => p_lines.draft_id, -- bug5258790
3060 p_amount_tbl => p_lines.amount,
3061 x_results => x_results,
3062 x_result_set_id => l_result_set_id, -- bug5008206
3063 x_result_type => l_result_type
3064 );
3065
3066 WHEN c_item_desc_update THEN
3067 PO_VAL_LINES2.item_desc_update(p_id_tbl => p_lines.interface_id,
3068 p_item_description_tbl => p_lines.item_description,
3069 p_item_id_tbl => p_lines.item_id,
3070 p_inventory_org_id => l_inventory_org_id,
3071 p_po_header_id_tbl => p_lines.po_header_id,
3072 p_po_line_id_tbl => p_lines.po_line_id,
3073 x_results => x_results,
3074 x_result_set_id => l_result_set_id,
3075 x_result_type => l_result_type);
3076 WHEN c_ip_category_id_update THEN
3077 -- Validate ip_category_id is valid if not empty.
3078 PO_VAL_LINES2.ip_category_id_update(p_id_tbl => p_lines.interface_id,
3079 p_ip_category_id_tbl => p_lines.ip_category_id,
3080 x_result_set_id => l_result_set_id,
3081 x_results => x_results,
3082 x_result_type => l_result_type);
3083 WHEN c_negotiated_by_preparer THEN
3084 ----------------------------------------------------------------------------------------
3085 -- Called in create case for Blanket AND SPO, negotiated_by_preparer must be 'Y' or 'N'.
3086 ----------------------------------------------------------------------------------------
3087 PO_VAL_LINES2.negotiated_by_preparer(p_id_tbl => p_lines.interface_id,
3088 p_negotiated_by_preparer_tbl => p_lines.negotiated_by_preparer_flag,
3089 x_results => x_results,
3090 x_result_type => l_result_type);
3091 WHEN c_negotiated_by_prep_update THEN
3092 --------------------------------------------------------------------------------------
3093 -- Called in update case for Blanket, negotiated_by_preparer must be NULL, 'Y' or 'N'.
3094 --------------------------------------------------------------------------------------
3095 PO_VAL_LINES2.negotiated_by_prep_update(p_id_tbl => p_lines.interface_id,
3096 p_negotiated_by_preparer_tbl => p_lines.negotiated_by_preparer_flag,
3097 x_results => x_results,
3098 x_result_type => l_result_type);
3099 WHEN c_category_id_update THEN
3100 -------------------------------------------------------------------------
3101 -- If either item_id or job_id are populated, then you are not allowed to change the po_category_id
3102 -- If change is allowed, the new category_id must be valid.
3103 -------------------------------------------------------------------------
3104 PO_VAL_LINES2.category_id_update(p_id_tbl => p_lines.interface_id,
3105 p_category_id_tbl => p_lines.category_id,
3106 p_po_line_id_tbl => p_lines.po_line_id,
3107 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3108 p_item_id_tbl => p_lines.item_id,
3109 p_job_id_tbl => p_lines.job_id,
3110 p_inventory_org_id => l_inventory_org_id,
3111 x_result_set_id => l_result_set_id,
3112 x_results => x_results,
3113 x_result_type => l_result_type);
3114
3115 WHEN c_negotiated_by_preparer_null THEN
3116 --------------------------------------------------------------------------------------
3117 -- Negotiated by preparer flag must be Null for Quotation.
3118 --------------------------------------------------------------------------------------
3119 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3120 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3121 p_entity_id_tbl => p_lines.interface_id,
3122 p_entity_type => c_entity_type_line,
3123 p_column_name => 'NEGOTIATED_BY_PREPARER',
3124 p_message_name => 'PO_PDOI_COLUMN_NULL',
3125 p_token1_name => 'COLUMN_NAME',
3126 p_token1_value => 'NEGOTIATED_BY_PREPARER',
3127 p_token2_name => 'VALUE',
3128 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3129 x_results => x_results,
3130 x_result_type => l_result_type);
3131 WHEN c_category_id_null THEN
3132 -- Validate category_id cannot be Null
3133 PO_VALIDATION_HELPER.not_null(p_calling_module => p_calling_program,
3134 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.category_id),
3135 p_entity_id_tbl => p_lines.interface_id,
3136 p_entity_type => c_entity_type_line,
3137 p_column_name => 'CATEGORY_ID',
3138 p_message_name => 'PO_PDOI_COLUMN_NOT_NULL',
3139 p_token1_name => 'COLUMN_NAME',
3140 p_token1_value => 'CATEGORY_ID',
3141 p_token2_name => 'VALUE',
3142 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.category_id),
3143 p_validation_id => PO_VAL_CONSTANTS.c_category_id_not_null,
3144 x_results => x_results,
3145 x_result_type => l_result_type);
3146 WHEN c_ip_category_id_null THEN
3147 -- Validate ip_category_id is empty
3148 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3149 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.ip_category_id),
3150 p_entity_id_tbl => p_lines.interface_id,
3151 p_entity_type => c_entity_type_line,
3152 p_column_name => 'IP_CATEGORY_ID',
3153 p_message_name => 'PO_PDOI_COLUMN_NULL',
3154 p_token1_name => 'COLUMN_NAME',
3155 p_token1_value => 'IP_CATEGORY_ID',
3156 p_token2_name => 'VALUE',
3157 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.ip_category_id),
3158 x_results => x_results,
3159 x_result_type => l_result_type);
3160 WHEN c_line_secondary_uom THEN
3161 PO_VALIDATION_HELPER.secondary_unit_of_measure(p_id_tbl => p_lines.interface_id,
3162 p_entity_type => c_entity_type_line,
3163 p_secondary_unit_of_meas_tbl => p_lines.secondary_unit_of_measure,
3164 p_item_id_tbl => p_lines.item_id,
3165 p_item_tbl => p_lines.item,
3166 p_organization_id_tbl => p_lines.inventory_org_id,
3167 p_doc_type => l_doc_type,
3168 p_create_or_update_item_flag => l_create_or_update_item,
3169 x_results => x_results,
3170 x_result_type => l_result_type);
3171 WHEN c_line_secondary_quantity THEN
3172 PO_VALIDATION_HELPER.secondary_quantity(p_id_tbl => p_lines.interface_id,
3173 p_entity_type => c_entity_type_line,
3174 p_secondary_quantity_tbl => p_lines.secondary_quantity,
3175 p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code,
3176 p_item_id_tbl => p_lines.item_id,
3177 p_item_tbl => p_lines.item,
3178 p_organization_id_tbl => p_lines.inventory_org_id,
3179 p_doc_type => l_doc_type,
3180 p_create_or_update_item_flag => l_create_or_update_item,
3181 x_results => x_results,
3182 x_result_type => l_result_type);
3183 WHEN c_line_preferred_grade THEN
3184 PO_VALIDATION_HELPER.preferred_grade(p_id_tbl => p_lines.interface_id,
3185 p_entity_type => c_entity_type_line,
3186 p_preferred_grade_tbl => p_lines.preferred_grade,
3187 p_item_id_tbl => p_lines.item_id,
3188 p_item_tbl => p_lines.item,
3189 p_organization_id_tbl => p_lines.inventory_org_id,
3190 p_create_or_update_item_flag => l_create_or_update_item,
3191 p_validation_id => PO_VAL_CONSTANTS.c_line_preferred_grade,
3192 x_results => x_results,
3193 x_result_set_id => l_result_set_id,
3194 x_result_type => l_result_type);
3195 WHEN c_release_num_null THEN
3196 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3197 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.release_num),
3198 p_entity_id_tbl => p_lines.interface_id,
3199 p_entity_type => c_entity_type_line,
3200 p_column_name => 'RELEASE_NUM',
3201 p_message_name => 'PO_PDOI_COLUMN_NULL',
3202 p_token1_name => 'COLUMN_NAME',
3203 p_token1_value => 'RELEASE_NUM',
3204 p_token2_name => 'VALUE',
3205 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.release_num),
3206 p_validation_id => PO_VAL_CONSTANTS.c_release_num_null,
3207 x_results => x_results,
3208 x_result_type => l_result_type);
3209 WHEN c_po_release_id_null THEN
3210 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3211 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.po_release_id),
3212 p_entity_id_tbl => p_lines.interface_id,
3213 p_entity_type => c_entity_type_line,
3214 p_column_name => 'PO_RELEASE_ID',
3215 p_message_name => 'PO_PDOI_COLUMN_NULL',
3216 p_token1_name => 'COLUMN_NAME',
3217 p_token1_value => 'PO_RELEASE_ID',
3218 p_token2_name => 'VALUE',
3219 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.po_release_id),
3220 p_validation_id => PO_VAL_CONSTANTS.c_po_release_id_null,
3221 x_results => x_results,
3222 x_result_type => l_result_type);
3223 WHEN c_source_shipment_id_null THEN
3224 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3225 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.source_shipment_id),
3226 p_entity_id_tbl => p_lines.interface_id,
3227 p_entity_type => c_entity_type_line,
3228 p_column_name => 'SOURCE_SHIPMENT_ID',
3229 p_message_name => 'PO_PDOI_COLUMN_NULL',
3230 p_token1_name => 'COLUMN_NAME',
3231 p_token1_value => 'SOURCE_SHIPMENT_ID',
3232 p_token2_name => 'VALUE',
3233 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.source_shipment_id),
3234 x_results => x_results,
3235 x_result_type => l_result_type);
3236 WHEN c_contract_num_null THEN
3237 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3238 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_num),
3239 p_entity_id_tbl => p_lines.interface_id,
3240 p_entity_type => c_entity_type_line,
3241 p_column_name => 'CONTRACT_NUM',
3242 p_message_name => 'PO_PDOI_COLUMN_NULL',
3243 p_token1_name => 'COLUMN_NAME',
3244 p_token1_value => 'CONTRACT_NUM',
3245 p_token2_name => 'VALUE',
3246 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_num),
3247 x_results => x_results,
3248 x_result_type => l_result_type);
3249 WHEN c_contract_id_null THEN
3250 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3251 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_id),
3252 p_entity_id_tbl => p_lines.interface_id,
3253 p_entity_type => c_entity_type_line,
3254 p_column_name => 'CONTRACT_ID',
3255 p_message_name => 'PO_PDOI_COLUMN_NULL',
3256 p_token1_name => 'COLUMN_NAME',
3257 p_token1_value => 'CONTRACT_ID',
3258 p_token2_name => 'VALUE',
3259 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_id),
3260 x_results => x_results,
3261 x_result_type => l_result_type);
3262 WHEN c_type_1099_null THEN
3263 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3264 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.type_1099),
3265 p_entity_id_tbl => p_lines.interface_id,
3266 p_entity_type => c_entity_type_line,
3267 p_column_name => 'TYPE_1099',
3268 p_message_name => 'PO_PDOI_COLUMN_NULL',
3269 p_token1_name => 'COLUMN_NAME',
3270 p_token1_value => 'TYPE_1099',
3271 p_token2_name => 'VALUE',
3272 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.type_1099),
3273 x_results => x_results,
3274 x_result_type => l_result_type);
3275 WHEN c_closed_code_null THEN
3276 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3277 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_code),
3278 p_entity_id_tbl => p_lines.interface_id,
3279 p_entity_type => c_entity_type_line,
3280 p_column_name => 'CLOSED_CODE',
3281 p_message_name => 'PO_PDOI_COLUMN_NULL',
3282 p_token1_name => 'COLUMN_NAME',
3283 p_token1_value => 'CLOSED_CODE',
3284 p_token2_name => 'VALUE',
3285 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_code),
3286 x_results => x_results,
3287 x_result_type => l_result_type);
3288 WHEN c_closed_date_null THEN
3289 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3290 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_date),
3291 p_entity_id_tbl => p_lines.interface_id,
3292 p_entity_type => c_entity_type_line,
3293 p_column_name => 'CLOSED_DATE',
3294 p_message_name => 'PO_PDOI_COLUMN_NULL',
3295 p_token1_name => 'COLUMN_NAME',
3296 p_token1_value => 'CLOSED_DATE',
3297 p_token2_name => 'VALUE',
3298 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_date),
3299 p_validation_id => PO_VAL_CONSTANTS.c_closed_date_null,
3300 x_results => x_results,
3301 x_result_type => l_result_type);
3302 WHEN c_closed_by_null THEN
3303 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3304 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_by),
3305 p_entity_id_tbl => p_lines.interface_id,
3306 p_entity_type => c_entity_type_line,
3307 p_column_name => 'CLOSED_BY',
3308 p_message_name => 'PO_PDOI_COLUMN_NULL',
3309 p_token1_name => 'COLUMN_NAME',
3310 p_token1_value => 'CLOSED_BY',
3311 p_token2_name => 'VALUE',
3312 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_by),
3313 x_results => x_results,
3314 x_result_type => l_result_type);
3315 WHEN c_over_tolerance_err_flag_null THEN
3316 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3317 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.over_tolerance_error_flag),
3318 p_entity_id_tbl => p_lines.interface_id,
3319 p_entity_type => c_entity_type_line,
3320 p_column_name => 'OVER_TOLERANCE_ERROR_FLAG',
3321 p_message_name => 'PO_PDOI_COLUMN_NULL',
3322 p_token1_name => 'COLUMN_NAME',
3323 p_token1_value => 'OVER_TOLERANCE_ERROR_FLAG',
3324 p_token2_name => 'VALUE',
3325 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.over_tolerance_error_flag),
3326 p_validation_id => PO_VAL_CONSTANTS.c_over_tolerance_err_flag_null,
3327 x_results => x_results,
3328 x_result_type => l_result_type);
3329 WHEN c_committed_amount_null THEN
3330 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3331 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.committed_amount),
3332 p_entity_id_tbl => p_lines.interface_id,
3333 p_entity_type => c_entity_type_line,
3334 p_column_name => 'COMMITTED_AMOUNT',
3335 p_message_name => 'PO_PDOI_COLUMN_NULL',
3336 p_token1_name => 'COLUMN_NAME',
3337 p_token1_value => 'COMMITTED_AMOUNT',
3338 p_token2_name => 'VALUE',
3339 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.committed_amount),
3340 p_validation_id => PO_VAL_CONSTANTS.c_committed_amount_null,
3341 x_results => x_results,
3342 x_result_type => l_result_type);
3343 WHEN c_allow_price_override_null THEN
3344 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3345 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.allow_price_override_flag),
3346 p_entity_id_tbl => p_lines.interface_id,
3347 p_entity_type => c_entity_type_line,
3348 p_column_name => 'ALLOW_PRICE_OVERRIDE_FLAG',
3349 p_message_name => 'PO_PDOI_COLUMN_NULL',
3350 p_token1_name => 'COLUMN_NAME',
3351 p_token1_value => 'ALLOW_PRICE_OVERRIDE_FLAG',
3352 p_token2_name => 'VALUE',
3353 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.allow_price_override_flag),
3354 p_validation_id => PO_VAL_CONSTANTS.c_allow_price_override_null,
3355 x_results => x_results,
3356 x_result_type => l_result_type);
3357 WHEN c_negotiated_by_preparer_null THEN
3358 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3359 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3360 p_entity_id_tbl => p_lines.interface_id,
3361 p_entity_type => c_entity_type_line,
3362 p_column_name => 'NEGOTIATED_BY_PREPARER_FLAG',
3363 p_message_name => 'PO_PDOI_COLUMN_NULL',
3364 p_token1_name => 'COLUMN_NAME',
3365 p_token1_value => 'NEGOTIATED_BY_PREPARER_FLAG',
3366 p_token2_name => 'VALUE',
3367 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3368 p_validation_id => PO_VAL_CONSTANTS.c_negotiated_by_preparer_null,
3369 x_results => x_results,
3370 x_result_type => l_result_type);
3371 WHEN c_capital_expense_flag_null THEN
3372 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3373 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.capital_expense_flag),
3374 p_entity_id_tbl => p_lines.interface_id,
3375 p_entity_type => c_entity_type_line,
3376 p_column_name => 'CAPITAL_EXPENSE_FLAG',
3377 p_message_name => 'PO_PDOI_COLUMN_NULL',
3378 p_token1_name => 'COLUMN_NAME',
3379 p_token1_value => 'CAPITAL_EXPENSE_FLAG',
3380 p_token2_name => 'VALUE',
3381 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.capital_expense_flag),
3382 p_validation_id => PO_VAL_CONSTANTS.c_capital_expense_flag_null,
3383 x_results => x_results,
3384 x_result_type => l_result_type);
3385 WHEN c_min_release_amount_null THEN
3386 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3387 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.min_release_amount),
3388 p_entity_id_tbl => p_lines.interface_id,
3389 p_entity_type => c_entity_type_line,
3390 p_column_name => 'MIN_RELEASE_AMOUNT',
3391 p_message_name => 'PO_PDOI_COLUMN_NULL',
3392 p_token1_name => 'COLUMN_NAME',
3393 p_token1_value => 'MIN_RELEASE_AMOUNT',
3394 p_token2_name => 'VALUE',
3395 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.min_release_amount),
3396 p_validation_id => PO_VAL_CONSTANTS.c_min_release_amount_null,
3397 x_results => x_results,
3398 x_result_type => l_result_type);
3399 WHEN c_qty_rcv_exception_code_null THEN
3400 IF l_create_or_update_item <> 'Y' THEN
3401 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3402 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.qty_rcv_exception_code),
3403 p_entity_id_tbl => p_lines.interface_id,
3404 p_entity_type => c_entity_type_line,
3405 p_column_name => 'QTY_RCV_EXCEPTION_CODE',
3406 p_message_name => 'PO_PDOI_COLUMN_NULL',
3407 p_token1_name => 'COLUMN_NAME',
3408 p_token1_value => 'QTY_RCV_EXCEPTION_CODE',
3409 p_token2_name => 'VALUE',
3410 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.qty_rcv_exception_code),
3411 x_results => x_results,
3412 x_result_type => l_result_type);
3413 END IF;
3414 WHEN c_market_price_null THEN
3415 IF l_create_or_update_item <> 'Y' THEN
3416 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3417 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.market_price),
3418 p_entity_id_tbl => p_lines.interface_id,
3419 p_entity_type => c_entity_type_line,
3420 p_column_name => 'MARKET_PRICE',
3421 p_message_name => 'PO_PDOI_COLUMN_NULL',
3422 p_token1_name => 'COLUMN_NAME',
3423 p_token1_value => 'MARKET_PRICE',
3424 p_token2_name => 'VALUE',
3425 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.market_price),
3426 p_validation_id => PO_VAL_CONSTANTS.c_market_price_null,
3427 x_results => x_results,
3428 x_result_type => l_result_type);
3429 END IF;
3430
3431 ---------------------------------------------------------------
3432 -- Shipment Validations
3433 ---------------------------------------------------------------
3434 -- ECO 4503425: Removed the planned item null date check as this
3435 -- has been moved to submission checks
3436
3437 WHEN c_days_early_gte_zero THEN
3438 PO_VAL_SHIPMENTS.days_early_gte_zero(
3439 p_line_loc_id_tbl => p_line_locations.line_location_id
3440 , p_days_early_rcpt_allowed_tbl => p_line_locations.days_early_receipt_allowed
3441 , x_results => x_results
3442 , x_result_type => l_result_type
3443 );
3444
3445 WHEN c_days_late_gte_zero THEN
3446 PO_VAL_SHIPMENTS.days_late_gte_zero(
3447 p_line_loc_id_tbl => p_line_locations.line_location_id
3448 , p_days_late_rcpt_allowed_tbl => p_line_locations.days_late_receipt_allowed
3449 , x_results => x_results
3450 , x_result_type => l_result_type
3451 );
3452
3453 WHEN c_rcv_close_tol_within_range THEN
3454 PO_VAL_SHIPMENTS.rcv_close_tol_within_range(
3455 p_line_loc_id_tbl => p_line_locations.line_location_id
3456 , p_receive_close_tolerance_tbl => p_line_locations.receive_close_tolerance
3457 , x_results => x_results
3458 , x_result_type => l_result_type
3459 );
3460
3461 WHEN c_over_rcpt_tol_within_range THEN
3462 PO_VAL_SHIPMENTS.over_rcpt_tol_within_range(
3463 p_line_loc_id_tbl => p_line_locations.line_location_id
3464 , p_qty_rcv_tolerance_tbl => p_line_locations.qty_rcv_tolerance
3465 , x_results => x_results
3466 , x_result_type => l_result_type
3467 );
3468
3469 WHEN c_match_4way_check THEN
3470 PO_VAL_SHIPMENTS.match_4way_check(
3471 p_line_loc_id_tbl => p_line_locations.line_location_id
3472 , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
3473 , p_receipt_required_flag_tbl => p_line_locations.receipt_required_flag
3474 , p_inspection_required_flag_tbl => p_line_locations.inspection_required_flag
3475 -- <Complex Work R12>: Pass payment_type
3476 , p_payment_type_tbl => p_line_locations.payment_type
3477 , x_results => x_results
3478 , x_result_type => l_result_type
3479 );
3480
3481 WHEN c_inv_close_tol_range_check THEN
3482 PO_VAL_SHIPMENTS.inv_close_tol_range_check(
3483 p_line_loc_id_tbl => p_line_locations.line_location_id
3484 , p_invoice_close_tolerance_tbl => p_line_locations.invoice_close_tolerance
3485 , x_results => x_results
3486 , x_result_type => l_result_type
3487 );
3488
3489 WHEN c_need_by_date_open_per_check THEN
3490 PO_VAL_SHIPMENTS.need_by_date_open_period_check(
3491 p_line_loc_id_tbl => p_line_locations.line_location_id
3492 --PBWC Message Change Impact: Adding a token
3493 , p_line_id_tbl => p_line_locations.po_line_id
3494 , p_need_by_date_tbl => p_line_locations.need_by_date
3495 , p_org_id_tbl => p_line_locations.org_id
3496 , x_result_set_id => l_result_set_id
3497 , x_result_type => l_result_type
3498 );
3499
3500 WHEN c_promise_date_open_per_check THEN
3501 PO_VAL_SHIPMENTS.promise_date_open_period_check(
3502 p_line_loc_id_tbl => p_line_locations.line_location_id
3503 --PBWC Message Change Impact: Adding a token
3504 , p_line_id_tbl => p_line_locations.po_line_id
3505 , p_promised_date_tbl => p_line_locations.promised_date
3506 , p_org_id_tbl => p_line_locations.org_id
3507 , x_result_set_id => l_result_set_id
3508 , x_result_type => l_result_type
3509 );
3510
3511 WHEN c_ship_to_org_null_check THEN
3512 PO_VAL_SHIPMENTS.ship_to_org_null_check(
3513 p_line_loc_id_tbl => p_line_locations.line_location_id
3514 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
3515 , p_shipment_type_tbl => p_line_locations.shipment_type
3516 , x_results => x_results
3517 , x_result_type => l_result_type
3518 );
3519
3520 WHEN c_ship_to_loc_null_check THEN
3521 PO_VAL_SHIPMENTS.ship_to_loc_null_check(
3522 p_line_loc_id_tbl => p_line_locations.line_location_id
3523 , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
3524 , p_shipment_type_tbl => p_line_locations.shipment_type
3525 , x_results => x_results
3526 , x_result_type => l_result_type
3527 );
3528
3529 WHEN c_ship_num_gt_zero THEN
3530 PO_VAL_SHIPMENTS.ship_num_gt_zero(
3531 p_line_loc_id_tbl => p_line_locations.line_location_id
3532 , p_shipment_num_tbl => p_line_locations.shipment_num
3533 -- <Complex Work R12>: Pass payment_type
3534 , p_payment_type_tbl => p_line_locations.payment_type
3535 , x_results => x_results
3536 , x_result_type => l_result_type
3537 );
3538
3539 WHEN c_ship_num_unique_check THEN
3540 PO_VAL_SHIPMENTS.ship_num_unique_check(
3541 p_line_loc_id_tbl => p_line_locations.line_location_id
3542 , p_line_id_tbl => p_line_locations.po_line_id
3543 , p_shipment_num_tbl => p_line_locations.shipment_num
3544 -- <Complex Work R12>: Pass in shipment_type
3545 , p_shipment_type_tbl => p_line_locations.shipment_type
3546 , x_result_set_id => l_result_set_id
3547 , x_result_type => l_result_type
3548 );
3549
3550 WHEN c_is_org_in_current_sob_check THEN
3551 PO_VAL_SHIPMENTS.is_org_in_current_sob_check(
3552 p_line_loc_id_tbl => p_line_locations.line_location_id
3553 --PBWC Message Change Impact: Adding a token
3554 , p_line_id_tbl => p_line_locations.po_line_id
3555 , p_org_id_tbl => p_line_locations.org_id
3556 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
3557 , p_consigned_flag_tbl => p_line_locations.consigned_flag
3558 , x_results => x_results
3559 , x_result_type => l_result_type
3560 );
3561
3562 WHEN c_ship_qty_gt_zero THEN
3563 PO_VAL_SHIPMENTS.quantity_gt_zero(
3564 p_line_loc_id_tbl => p_line_locations.line_location_id
3565 , p_quantity_tbl => p_line_locations.quantity
3566 , p_shipment_type_tbl => p_line_locations.shipment_type
3567 , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
3568 , x_results => x_results
3569 , x_result_type => l_result_type
3570 );
3571
3572 -- <Complex Work R12 Start>: Combine qty billed and rcvd into qty exec
3573 WHEN c_ship_qty_ge_qty_exec THEN
3574 PO_VAL_SHIPMENTS.quantity_ge_quantity_exec(
3575 p_line_loc_id_tbl => p_line_locations.line_location_id
3576 , p_quantity_tbl => p_line_locations.quantity
3577 , x_result_set_id => l_result_set_id
3578 , x_result_type => l_result_type
3579 );
3580 -- <Complex Work R12 End>
3581
3582 WHEN c_ship_amt_gt_zero THEN
3583 PO_VAL_SHIPMENTS.amount_gt_zero(
3584 p_line_loc_id_tbl => p_line_locations.line_location_id
3585 , p_amount_tbl => p_line_locations.amount
3586 , p_shipment_type_tbl => p_line_locations.shipment_type
3587 , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
3588 , x_results => x_results
3589 , x_result_type => l_result_type
3590 );
3591
3592 -- <Complex Work R12 Start>: Combine amt billed and rcvd into amt exec
3593 WHEN c_ship_amt_ge_amt_exec THEN
3594 PO_VAL_SHIPMENTS.amount_ge_amount_exec(
3595 p_line_loc_id_tbl => p_line_locations.line_location_id
3596 , p_amount_tbl => p_line_locations.amount
3597 , x_result_set_id => l_result_set_id
3598 , x_result_type => l_result_type
3599 );
3600 -- <Complex Work R12 End>
3601
3602 -- Opm related validation : OPM Integration R12 Start
3603 WHEN c_ship_sec_qty_gt_zero THEN
3604 PO_VAL_SHIPMENTS.ship_sec_quantity_gt_zero(
3605 p_line_loc_id_tbl => p_line_locations.line_location_id
3606 , p_item_id_tbl => p_line_locations.line_item_id
3607 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
3608 , p_sec_quantity_tbl => p_line_locations.secondary_quantity
3609 , x_results => x_results
3610 , x_result_type => l_result_type
3611 );
3612
3613 WHEN c_ship_qtys_within_deviation THEN
3614 PO_VAL_SHIPMENTS.ship_qtys_within_deviation(
3615 p_line_loc_id_tbl => p_line_locations.line_location_id
3616 , p_item_id_tbl => p_line_locations.line_item_id
3617 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
3618 , p_quantity_tbl => p_line_locations.quantity
3619 , p_primary_uom_tbl => p_line_locations.unit_meas_lookup_code
3620 , p_sec_quantity_tbl => p_line_locations.secondary_quantity
3621 , p_secondary_uom_tbl => p_line_locations.secondary_unit_of_measure
3622 , x_results => x_results
3623 , x_result_type => l_result_type
3624 );
3625 -- Opm related validation : OPM Integration R12 End
3626
3627 -- Bug 5385686 : Enforce not null check on UOM
3628 WHEN c_unit_of_measure_not_null THEN
3629 PO_VAL_SHIPMENTS.unit_of_measure_not_null(
3630 p_line_loc_id_tbl => p_line_locations.line_location_id
3631 , p_value_basis_tbl => p_line_locations.value_basis
3632 , p_payment_type_tbl => p_line_locations.payment_type
3633 , p_unit_meas_lookup_code_tbl => p_line_locations.unit_meas_lookup_code
3634 , x_results => x_results
3635 , x_result_type => l_result_type
3636 );
3637
3638 -- Bug 7516824: Validate PO_LINE_LOCATIONS DFF
3639 WHEN c_ship_dff_validate THEN
3640 PO_VALIDATION_HELPER.validate_desc_flex(
3641 p_calling_module => p_calling_program,
3642 p_id_tbl => p_line_locations.line_location_id,
3643 p_desc_flex_name => 'PO_LINE_LOCATIONS',
3644 p_attribute_category_tbl => p_line_locations.attribute_category,
3645 p_attribute1_tbl => p_line_locations.attribute1,
3646 p_attribute2_tbl => p_line_locations.attribute2,
3647 p_attribute3_tbl => p_line_locations.attribute3,
3648 p_attribute4_tbl => p_line_locations.attribute4,
3649 p_attribute5_tbl => p_line_locations.attribute5,
3650 p_attribute6_tbl => p_line_locations.attribute6,
3651 p_attribute7_tbl => p_line_locations.attribute7,
3652 p_attribute8_tbl => p_line_locations.attribute8,
3653 p_attribute9_tbl => p_line_locations.attribute9,
3654 p_attribute10_tbl => p_line_locations.attribute10,
3655 p_attribute11_tbl => p_line_locations.attribute11,
3656 p_attribute12_tbl => p_line_locations.attribute12,
3657 p_attribute13_tbl => p_line_locations.attribute13,
3658 p_attribute14_tbl => p_line_locations.attribute14,
3659 p_attribute15_tbl => p_line_locations.attribute15,
3660 p_entity_type => c_entity_type_line_location,
3661 x_results => x_results,
3662 x_result_type => l_result_type);
3663
3664 --------------------------------------------------------------------------
3665 -- PDOI Shipment Validation Subroutines
3666 --------------------------------------------------------------------------
3667 WHEN c_shipment_need_by_date THEN
3668 -- if purchase_basis is 'TEMP LABOR', the need_by_date column must be null
3669 PO_VAL_SHIPMENTS2.need_by_date(p_id_tbl => p_line_locations.interface_id,
3670 p_purchase_basis_tbl => p_line_locations.purchase_basis,
3671 p_need_by_date_tbl => p_line_locations.need_by_date,
3672 x_results => x_results,
3673 x_result_type => l_result_type);
3674 WHEN c_shipment_promised_date THEN
3675 -- if purchase_basis is 'TEMP LABOR', the promised_date must be null
3676 PO_VAL_SHIPMENTS2.promised_date(p_id_tbl => p_line_locations.interface_id,
3677 p_purchase_basis_tbl => p_line_locations.purchase_basis,
3678 p_promised_date_tbl => p_line_locations.promised_date,
3679 x_results => x_results,
3680 x_result_type => l_result_type);
3681 WHEN c_shipment_type_blanket THEN
3682 -- validate shipment type
3683 PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl => p_line_locations.interface_id,
3684 p_shipment_type_tbl => p_line_locations.shipment_type,
3685 p_doc_type => c_doc_type_blanket,
3686 x_results => x_results,
3687 x_result_type => l_result_type);
3688 WHEN c_shipment_type_standard THEN
3689 -- validate shipment type
3690 PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl => p_line_locations.interface_id,
3691 p_shipment_type_tbl => p_line_locations.shipment_type,
3692 p_doc_type => c_doc_type_standard,
3693 x_results => x_results,
3694 x_result_type => l_result_type);
3695 WHEN c_shipment_type_quotation THEN
3696 -- validate shipment type
3697 PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl => p_line_locations.interface_id,
3698 p_shipment_type_tbl => p_line_locations.shipment_type,
3699 p_doc_type => c_doc_type_quotation,
3700 x_results => x_results,
3701 x_result_type => l_result_type);
3702 WHEN c_shipment_num THEN
3703 -- validate shipment num is not null, greater than zero and unique
3704 -- bug 4642348: add two parameters - p_draft_id_tbl, p_doc_type
3705 PO_VAL_SHIPMENTS2.shipment_num(p_id_tbl => p_line_locations.interface_id,
3706 p_shipment_num_tbl => p_line_locations.shipment_num,
3707 p_shipment_type_tbl => p_line_locations.shipment_type,
3708 p_po_header_id_tbl => p_line_locations.po_header_id,
3709 p_po_line_id_tbl => p_line_locations.po_line_id,
3710 p_draft_id_tbl => p_line_locations.draft_id,
3711 p_doc_type => l_doc_type,
3712 x_result_set_id => l_result_set_id,
3713 x_results => x_results,
3714 x_result_type => l_result_type);
3715 WHEN c_terms_id_line_loc THEN
3716 PO_VALIDATION_HELPER.terms_id(p_calling_module => p_calling_program,
3717 p_terms_id_tbl => p_line_locations.terms_id,
3718 p_entity_id_tbl => p_line_locations.interface_id,
3719 p_entity_type => c_entity_type_line_location,
3720 p_validation_id => PO_VAL_CONSTANTS.c_terms_id_line_loc,
3721 x_result_set_id => l_result_set_id,
3722 x_result_type => l_result_type);
3723 WHEN c_shipment_quantity THEN
3724 -- If order_type_lookup_code is RATE or FIXED PRICE, validate quantity is not null
3725 PO_VAL_SHIPMENTS2.quantity(p_id_tbl => p_line_locations.interface_id,
3726 p_quantity_tbl => p_line_locations.quantity,
3727 p_order_type_lookup_code_tbl => p_line_locations.order_type_lookup_code,
3728 x_results => x_results,
3729 x_result_type => l_result_type);
3730 WHEN c_shipment_price_override THEN
3731 -- If order_type_lookup_code is not FIXED PRICE, price_override cannot be null
3732 PO_VAL_SHIPMENTS2.price_override(p_id_tbl => p_line_locations.interface_id,
3733 p_price_override_tbl => p_line_locations.price_override,
3734 p_order_type_lookup_code_tbl => p_line_locations.order_type_lookup_code,
3735 x_results => x_results,
3736 x_result_type => l_result_type);
3737 WHEN c_shipment_price_discount THEN
3738 -- If order_type_lookup_code is not FIXED PRICE, price_discount/price_override cannot both be null
3739 -- and price discount cannot be less than zero or greater than 100
3740 PO_VAL_SHIPMENTS2.price_discount(p_id_tbl => p_line_locations.interface_id,
3741 p_price_discount_tbl => p_line_locations.price_discount,
3742 p_price_override_tbl => p_line_locations.price_override,
3743 p_order_type_lookup_code_tbl => p_line_locations.order_type_lookup_code,
3744 x_results => x_results,
3745 x_result_type => l_result_type);
3746 WHEN c_ship_to_organization_id THEN
3747 -- validate ship_to_organization_id
3748 PO_VAL_SHIPMENTS2.ship_to_organization_id(p_id_tbl => p_line_locations.interface_id,
3749 p_ship_to_organization_id_tbl => p_line_locations.ship_to_organization_id,
3750 p_item_id_tbl => p_line_locations.item_id,
3751 p_item_revision_tbl => p_line_locations.item_revision,
3752 p_ship_to_location_id_tbl => p_line_locations.ship_to_location_id,
3753 x_result_set_id => l_result_set_id,
3754 x_result_type => l_result_type);
3755 WHEN c_shipment_effective_dates THEN
3756 -- validate_effective_dates
3757 -- bug5016163
3758 -- Added price break look up code as parameter
3759 PO_VAL_SHIPMENTS2.effective_dates(p_id_tbl => p_line_locations.interface_id,
3760 p_line_expiration_date_tbl => p_line_locations.line_expiration_date,
3761 p_to_date_tbl => p_line_locations.to_date,
3762 p_from_date_tbl => p_line_locations.from_date,
3763 p_header_start_date_tbl => p_line_locations.hdr_start_date,
3764 p_header_end_date_tbl => p_line_locations.hdr_end_date,
3765 p_price_break_lookup_code_tbl => p_line_locations.line_price_break_lookup_code,
3766 x_results => x_results,
3767 x_result_type => l_result_type);
3768 WHEN c_qty_rcv_exception_code THEN
3769 -- validate qty_rcv_exception_code against PO_LOOKUP_CODES
3770 PO_VAL_SHIPMENTS2.qty_rcv_exception_code(p_id_tbl => p_line_locations.interface_id,
3771 p_qty_rcv_exception_code_tbl => p_line_locations.qty_rcv_exception_code,
3772 x_result_set_id => l_result_set_id,
3773 x_result_type => l_result_type);
3774 WHEN c_enforce_ship_to_loc_code THEN
3775 -- If shipment_type is STANDARD and enforce_ship_to_loc_code is not equal
3776 -- to NONE, REJECT or WARNING
3777 PO_VAL_SHIPMENTS2.enforce_ship_to_loc_code(p_id_tbl => p_line_locations.interface_id,
3778 p_enforce_ship_to_loc_code_tbl => p_line_locations.enforce_ship_to_location_code,
3779 p_shipment_type_tbl => p_line_locations.shipment_type,
3780 x_results => x_results,
3781 x_result_type => l_result_type);
3782 WHEN c_allow_sub_receipts_flag THEN
3783 -- If shipment_type is STANDARD and allow_sub_receipts_flag is not equal
3784 -- to NONE, REJECT or WARNING
3785 PO_VAL_SHIPMENTS2.allow_sub_receipts_flag(p_id_tbl => p_line_locations.interface_id,
3786 p_shipment_type_tbl => p_line_locations.shipment_type,
3787 p_allow_sub_receipts_flag_tbl => p_line_locations.allow_substitute_receipts_flag,
3788 x_results => x_results,
3789 x_result_type => l_result_type);
3790 WHEN c_days_early_receipt_allowed THEN
3791 -- If shipment_type is STANDARD and days_early_receipt_allowed is not null
3792 -- and less than zero.
3793 PO_VAL_SHIPMENTS2.days_early_receipt_allowed(p_id_tbl => p_line_locations.interface_id,
3794 p_shipment_type_tbl => p_line_locations.shipment_type,
3795 p_days_early_rcpt_allowed_tbl => p_line_locations.days_early_receipt_allowed,
3796 x_results => x_results,
3797 x_result_type => l_result_type);
3798 WHEN c_receipt_days_exception_code THEN
3799 -- If shipment_type is STANDARD and receipt_days_expection_code is not null
3800 -- and not 'NONE', 'REJECT' not 'WARNING'
3801 PO_VAL_SHIPMENTS2.receipt_days_exception_code(p_id_tbl => p_line_locations.interface_id,
3802 p_shipment_type_tbl => p_line_locations.shipment_type,
3803 p_rcpt_days_exception_code_tbl => p_line_locations.receipt_days_exception_code,
3804 x_results => x_results,
3805 x_result_type => l_result_type);
3806 WHEN c_invoice_close_tolerance THEN
3807 -- If shipment_type is STANDARD and invoice_close_tolerance is not null
3808 -- and less than or equal to zero or greater than or equal to 100.
3809 PO_VAL_SHIPMENTS2.invoice_close_tolerance(p_id_tbl => p_line_locations.interface_id,
3810 p_shipment_type_tbl => p_line_locations.shipment_type,
3811 p_invoice_close_tolerance_tbl => p_line_locations.invoice_close_tolerance,
3812 x_results => x_results,
3813 x_result_type => l_result_type);
3814 WHEN c_receive_close_tolerance THEN
3815 -- If shipment_type is STANDARD and receive_close_tolerance is not null
3816 -- and less than or equal to zero or greater than or equal to 100.
3817 PO_VAL_SHIPMENTS2.receive_close_tolerance(p_id_tbl => p_line_locations.interface_id,
3818 p_shipment_type_tbl => p_line_locations.shipment_type,
3819 p_receive_close_tolerance_tbl => p_line_locations.receive_close_tolerance,
3820 x_results => x_results,
3821 x_result_type => l_result_type);
3822 WHEN c_receiving_routing_id THEN
3823 -- Validate that receiving routing id exists in rcv_routing_headers
3824 PO_VAL_SHIPMENTS2.receiving_routing_id(p_id_tbl => p_line_locations.interface_id,
3825 p_shipment_type_tbl => p_line_locations.shipment_type,
3826 p_receiving_routing_id_tbl => p_line_locations.receiving_routing_id,
3827 x_result_set_id => l_result_set_id,
3828 x_result_type => l_result_type);
3829 WHEN c_accrue_on_receipt_flag THEN
3830 -- Validate accrue_on_receipt_flag is Y or N, if not null.
3831 PO_VAL_SHIPMENTS2.accrue_on_receipt_flag(p_id_tbl => p_line_locations.interface_id,
3832 p_accrue_on_receipt_flag_tbl => p_line_locations.accrue_on_receipt_flag,
3833 x_results => x_results,
3834 x_result_type => l_result_type);
3835 WHEN c_fob_lookup_code_line_loc THEN
3836 PO_VAL_SHIPMENTS2.fob_lookup_code(p_id_tbl => p_line_locations.interface_id,
3837 p_fob_lookup_code_tbl => p_line_locations.fob_lookup_code,
3838 x_result_set_id => l_result_set_id,
3839 x_result_type => l_result_type);
3840 WHEN c_freight_terms_line_loc THEN
3841 PO_VAL_SHIPMENTS2.freight_terms(p_id_tbl => p_line_locations.interface_id,
3842 p_freight_terms_tbl => p_line_locations.freight_terms_lookup_code,
3843 x_result_set_id => l_result_set_id,
3844 x_result_type => l_result_type);
3845 WHEN c_freight_carrier_line_loc THEN
3846 PO_VAL_SHIPMENTS2.freight_carrier(p_id_tbl => p_line_locations.interface_id,
3847 p_freight_carrier_tbl => p_line_locations.freight_carrier,
3848 p_inventory_org_id => l_inventory_org_id,
3849 x_result_set_id => l_result_set_id,
3850 x_result_type => l_result_type);
3851 WHEN c_line_loc_style_related_info THEN
3852 PO_VAL_SHIPMENTS2.style_related_info(p_id_tbl => p_line_locations.interface_id,
3853 p_style_id_tbl => p_line_locations.hdr_style_id,
3854 x_result_set_id => l_result_set_id,
3855 x_result_type => l_result_type);
3856 WHEN c_price_break THEN
3857 -- Cannot create price breaks for Amount-Based or Fixed Price lines in a Blanket
3858 -- Purchase Agreement.
3859 PO_VAL_SHIPMENTS2.price_break(p_id_tbl => p_line_locations.interface_id,
3860 p_order_type_lookup_code_tbl => p_line_locations.order_type_lookup_code,
3861 x_results => x_results,
3862 x_result_type => l_result_type);
3863 WHEN c_tax_name THEN
3864 PO_VAL_SHIPMENTS2.tax_name(p_id_tbl => p_line_locations.interface_id,
3865 p_tax_name_tbl => p_line_locations.tax_name,
3866 p_tax_code_id_tbl => p_line_locations.tax_code_id,
3867 p_need_by_date_tbl => p_line_locations.need_by_date,
3868 p_allow_tax_code_override => l_allow_tax_code_override,
3869 p_operating_unit => l_operating_unit,
3870 x_result_set_id => l_result_set_id,
3871 x_result_type => l_result_type);
3872 WHEN c_line_loc_secondary_uom THEN
3873 PO_VALIDATION_HELPER.secondary_unit_of_measure(p_id_tbl => p_line_locations.interface_id,
3874 p_entity_type => c_entity_type_line_location,
3875 p_secondary_unit_of_meas_tbl => p_line_locations.secondary_unit_of_measure,
3876 p_item_id_tbl => p_line_locations.item_id,
3877 p_item_tbl => p_line_locations.item,
3878 p_organization_id_tbl => p_line_locations.ship_to_organization_id,
3879 p_doc_type => l_doc_type,
3880 p_create_or_update_item_flag => l_create_or_update_item,
3881 x_results => x_results,
3882 x_result_type => l_result_type);
3883 WHEN c_line_loc_secondary_quantity THEN
3884 PO_VALIDATION_HELPER.secondary_quantity(p_id_tbl => p_line_locations.interface_id,
3885 p_entity_type => c_entity_type_line_location,
3886 p_secondary_quantity_tbl => p_line_locations.secondary_quantity,
3887 p_order_type_lookup_code_tbl => p_line_locations.order_type_lookup_code,
3888 p_item_id_tbl => p_line_locations.item_id,
3889 p_item_tbl => p_line_locations.item,
3890 p_organization_id_tbl => p_line_locations.ship_to_organization_id,
3891 p_doc_type => l_doc_type,
3892 p_create_or_update_item_flag => l_create_or_update_item,
3893 x_results => x_results,
3894 x_result_type => l_result_type);
3895 WHEN c_line_loc_preferred_grade THEN
3896 PO_VALIDATION_HELPER.preferred_grade(p_id_tbl => p_line_locations.interface_id,
3897 p_entity_type => c_entity_type_line_location,
3898 p_preferred_grade_tbl => p_line_locations.preferred_grade,
3899 p_item_id_tbl => p_line_locations.item_id,
3900 p_item_tbl => p_line_locations.item,
3901 p_organization_id_tbl => p_line_locations.ship_to_organization_id,
3902 p_create_or_update_item_flag => l_create_or_update_item,
3903 p_validation_id => PO_VAL_CONSTANTS.c_loc_preferred_grade,
3904 x_results => x_results,
3905 x_result_set_id => l_result_set_id,
3906 x_result_type => l_result_type);
3907 WHEN c_firm_flag_null THEN
3908 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3909 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.firm_status_lookup_code),
3910 p_entity_id_tbl => p_line_locations.interface_id,
3911 p_entity_type => c_entity_type_line_location,
3912 p_column_name => 'FIRM_FLAG',
3913 p_message_name => 'PO_PDOI_COLUMN_NULL',
3914 p_token1_name => 'COLUMN_NAME',
3915 p_token1_value => 'FIRM_FLAG',
3916 p_token2_name => 'VALUE',
3917 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.firm_status_lookup_code),
3918 p_validation_id => PO_VAL_CONSTANTS.c_firm_flag_null,
3919 x_results => x_results,
3920 x_result_type => l_result_type);
3921 WHEN c_freight_carrier_null THEN
3922 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3923 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_carrier),
3924 p_entity_id_tbl => p_line_locations.interface_id,
3925 p_entity_type => c_entity_type_line_location,
3926 p_column_name => 'FREIGHT_CARRIER',
3927 p_message_name => 'PO_PDOI_COLUMN_NULL',
3928 p_token1_name => 'COLUMN_NAME',
3929 p_token1_value => 'FREIGHT_CARRIER',
3930 p_token2_name => 'VALUE',
3931 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_carrier),
3932 p_validation_id => PO_VAL_CONSTANTS.c_freight_carrier_null,
3933 x_results => x_results,
3934 x_result_type => l_result_type);
3935 WHEN c_fob_lookup_code_null THEN
3936 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3937 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.fob_lookup_code),
3938 p_entity_id_tbl => p_line_locations.interface_id,
3939 p_entity_type => c_entity_type_line_location,
3940 p_column_name => 'FOB_LOOKUP_CODE',
3941 p_message_name => 'PO_PDOI_COLUMN_NULL',
3942 p_token1_name => 'COLUMN_NAME',
3943 p_token1_value => 'FOB_LOOKUP_CODE',
3944 p_token2_name => 'VALUE',
3945 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.fob_lookup_code),
3946 p_validation_id => PO_VAL_CONSTANTS.c_fob_lookup_code_null,
3947 x_results => x_results,
3948 x_result_type => l_result_type);
3949 WHEN c_freight_terms_lookup_null THEN
3950 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3951 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_terms_lookup_code),
3952 p_entity_id_tbl => p_line_locations.interface_id,
3953 p_entity_type => c_entity_type_line_location,
3954 p_column_name => 'FREIGHT_TERMS_LOOKUP_CODE',
3955 p_message_name => 'PO_PDOI_COLUMN_NULL',
3956 p_token1_name => 'COLUMN_NAME',
3957 p_token1_value => 'FREIGHT_TERMS_LOOKUP_CODE',
3958 p_token2_name => 'VALUE',
3959 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_terms_lookup_code),
3960 p_validation_id => PO_VAL_CONSTANTS.c_freight_terms_null,
3961 x_results => x_results,
3962 x_result_type => l_result_type);
3963 WHEN c_qty_rcv_tolerance_null THEN
3964 IF l_create_or_update_item <> 'Y' THEN
3965 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3966 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.qty_rcv_tolerance),
3967 p_entity_id_tbl => p_line_locations.interface_id,
3968 p_entity_type => c_entity_type_line_location,
3969 p_column_name => 'QTY_RCV_TOLERANCE',
3970 p_message_name => 'PO_PDOI_COLUMN_NULL',
3971 p_token1_name => 'COLUMN_NAME',
3972 p_token1_value => 'QTY_RCV_TOLERANCE',
3973 p_token2_name => 'VALUE',
3974 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.qty_rcv_tolerance),
3975 p_validation_id => PO_VAL_CONSTANTS.c_qty_rcv_tolerance_null,
3976 x_results => x_results,
3977 x_result_type => l_result_type);
3978 END IF;
3979 WHEN c_receipt_required_flag_null THEN
3980 IF l_create_or_update_item <> 'Y' THEN
3981 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3982 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_required_flag),
3983 p_entity_id_tbl => p_line_locations.interface_id,
3984 p_entity_type => c_entity_type_line_location,
3985 p_column_name => 'RECEIPT_REQUIRED_FLAG',
3986 p_message_name => 'PO_PDOI_COLUMN_NULL',
3987 p_token1_name => 'COLUMN_NAME',
3988 p_token1_value => 'RECEIPT_REQUIRED_FLAG',
3989 p_token2_name => 'VALUE',
3990 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_required_flag),
3991 p_validation_id => PO_VAL_CONSTANTS.c_receipt_reqd_flag_null,
3992 x_results => x_results,
3993 x_result_type => l_result_type);
3994 END IF;
3995 WHEN c_inspection_reqd_flag_null THEN
3996 IF l_create_or_update_item <> 'Y' THEN
3997 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
3998 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.inspection_required_flag),
3999 p_entity_id_tbl => p_line_locations.interface_id,
4000 p_entity_type => c_entity_type_line_location,
4001 p_column_name => 'INSPECTION_REQUIRED_FLAG',
4002 p_message_name => 'PO_PDOI_COLUMN_NULL',
4003 p_validation_id => PO_VAL_CONSTANTS.c_inspection_reqd_flag_null,
4004 x_results => x_results,
4005 x_result_type => l_result_type);
4006 END IF;
4007 WHEN c_receipt_days_exception_null THEN
4008 IF l_create_or_update_item <> 'Y' THEN
4009 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4010 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_days_exception_code),
4011 p_entity_id_tbl => p_line_locations.interface_id,
4012 p_entity_type => c_entity_type_line_location,
4013 p_column_name => 'RECEIPT_DAYS_EXCEPTION_CODE',
4014 p_message_name => 'PO_PDOI_COLUMN_NULL',
4015 p_token1_name => 'COLUMN_NAME',
4016 p_token1_value => 'RECEIPT_DAYS_EXCEPTION_CODE',
4017 p_token2_name => 'VALUE',
4018 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_days_exception_code),
4019 p_validation_id => PO_VAL_CONSTANTS.c_receipt_days_except_null,
4020 x_results => x_results,
4021 x_result_type => l_result_type);
4022 END IF;
4023 WHEN c_invoice_close_toler_null THEN
4024 IF l_create_or_update_item <> 'Y' THEN
4025 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4026 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.invoice_close_tolerance),
4027 p_entity_id_tbl => p_line_locations.interface_id,
4028 p_entity_type => c_entity_type_line_location,
4029 p_column_name => 'INVOICE_CLOSE_TOLERANCE',
4030 p_message_name => 'PO_PDOI_COLUMN_NULL',
4031 p_token1_name => 'COLUMN_NAME',
4032 p_token1_value => 'INVOICE_CLOSE_TOLERANCE',
4033 p_token2_name => 'VALUE',
4034 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.invoice_close_tolerance),
4035 p_validation_id => PO_VAL_CONSTANTS.c_invoice_close_toler_null,
4036 x_results => x_results,
4037 x_result_type => l_result_type);
4038 END IF;
4039 WHEN c_receive_close_toler_null THEN
4040 IF l_create_or_update_item <> 'Y' THEN
4041 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4042 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receive_close_tolerance),
4043 p_entity_id_tbl => p_line_locations.interface_id,
4044 p_entity_type => c_entity_type_line_location,
4045 p_column_name => 'RECEIVE_CLOSE_TOLERANCE',
4046 p_message_name => 'PO_PDOI_COLUMN_NULL',
4047 p_token1_name => 'COLUMN_NAME',
4048 p_token1_value => 'RECEIVE_CLOSE_TOLERANCE',
4049 p_token2_name => 'VALUE',
4050 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receive_close_tolerance),
4051 p_validation_id => PO_VAL_CONSTANTS.c_receive_close_toler_null,
4052 x_results => x_results,
4053 x_result_type => l_result_type);
4054 END IF;
4055 WHEN c_days_early_rcpt_allowed_null THEN
4056 IF l_create_or_update_item <> 'Y' THEN
4057 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4058 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_early_receipt_allowed),
4059 p_entity_id_tbl => p_line_locations.interface_id,
4060 p_entity_type => c_entity_type_line_location,
4061 p_column_name => 'DAYS_EARLY_RECEIPT_ALLOWED',
4062 p_message_name => 'PO_PDOI_COLUMN_NULL',
4063 p_token1_name => 'COLUMN_NAME',
4064 p_token1_value => 'DAYS_EARLY_RECEIPT_ALLOWED',
4065 p_token2_name => 'VALUE',
4066 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_early_receipt_allowed),
4067 p_validation_id => PO_VAL_CONSTANTS.c_days_early_rcpt_allowed_null,
4068 x_results => x_results,
4069 x_result_type => l_result_type);
4070 END IF;
4071 WHEN c_days_late_rcpt_allowed_null THEN
4072 IF l_create_or_update_item <> 'Y' THEN
4073 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4074 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_late_receipt_allowed),
4075 p_entity_id_tbl => p_line_locations.interface_id,
4076 p_entity_type => c_entity_type_line_location,
4077 p_column_name => 'DAYS_LATE_RECEIPT_ALLOWED',
4078 p_message_name => 'PO_PDOI_COLUMN_NULL',
4079 p_token1_name => 'COLUMN_NAME',
4080 p_token1_value => 'DAYS_LATE_RECEIPT_ALLOWED',
4081 p_token2_name => 'VALUE',
4082 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_late_receipt_allowed),
4083 p_validation_id => PO_VAL_CONSTANTS.c_days_late_rcpt_allowed_null,
4084 x_results => x_results,
4085 x_result_type => l_result_type);
4086 END IF;
4087 WHEN c_enfrce_ship_to_loc_code_null THEN
4088 IF l_create_or_update_item <> 'Y' THEN
4089 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4090 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.enforce_ship_to_location_code),
4091 p_entity_id_tbl => p_line_locations.interface_id,
4092 p_entity_type => c_entity_type_line_location,
4093 p_column_name => 'ENFORCE_SHIP_TO_LOCATION_CODE',
4094 p_message_name => 'PO_PDOI_COLUMN_NULL',
4095 p_token1_name => 'COLUMN_NAME',
4096 p_token1_value => 'ENFORCE_SHIP_TO_LOCATION_CODE',
4097 p_token2_name => 'VALUE',
4098 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.enforce_ship_to_location_code),
4099 p_validation_id => PO_VAL_CONSTANTS.c_enforce_shipto_loc_code_null,
4100 x_results => x_results,
4101 x_result_type => l_result_type);
4102 END IF;
4103 WHEN c_allow_sub_receipts_flag_null THEN
4104 IF l_create_or_update_item <> 'Y' THEN
4105 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4106 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.allow_substitute_receipts_flag),
4107 p_entity_id_tbl => p_line_locations.interface_id,
4108 p_entity_type => c_entity_type_line_location,
4109 p_column_name => 'ALLOW_SUBSTITUTE_RECEIPTS_FLAG',
4110 p_message_name => 'PO_PDOI_COLUMN_NULL',
4111 p_token1_name => 'COLUMN_NAME',
4112 p_token1_value => 'ALLOW_SUBSTITUTE_RECEIPTS_FLAG',
4113 p_token2_name => 'VALUE',
4114 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.allow_substitute_receipts_flag),
4115 p_validation_id => PO_VAL_CONSTANTS.c_allow_sub_receipts_flag_null,
4116 x_results => x_results,
4117 x_result_type => l_result_type);
4118 END IF;
4119 WHEN c_receiving_routing_null THEN
4120 IF l_create_or_update_item <> 'Y' THEN
4121 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4122 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receiving_routing_id),
4123 p_entity_id_tbl => p_line_locations.interface_id,
4124 p_entity_type => c_entity_type_line_location,
4125 p_column_name => 'RECEIVING_ROUTING_ID',
4126 p_message_name => 'PO_PDOI_COLUMN_NULL',
4127 p_token1_name => 'COLUMN_NAME',
4128 p_token1_value => 'RECEIVING_ROUTING_ID',
4129 p_token2_name => 'VALUE',
4130 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receiving_routing_id),
4131 p_validation_id => PO_VAL_CONSTANTS.c_receiving_routing_null,
4132 x_results => x_results,
4133 x_result_type => l_result_type);
4134 END IF;
4135 WHEN c_need_by_date_null THEN
4136 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4137 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.need_by_date),
4138 p_entity_id_tbl => p_line_locations.interface_id,
4139 p_entity_type => c_entity_type_line_location,
4140 p_column_name => 'NEED_BY_DATE',
4141 p_message_name => 'PO_PDOI_COLUMN_NULL',
4142 p_token1_name => 'COLUMN_NAME',
4143 p_token1_value => 'NEED_BY_DATE',
4144 p_token2_name => 'VALUE',
4145 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.need_by_date),
4146 p_validation_id => PO_VAL_CONSTANTS.c_need_by_date_null,
4147 x_results => x_results,
4148 x_result_type => l_result_type);
4149 WHEN c_promised_date_null THEN
4150 PO_VALIDATION_HELPER.ensure_null(p_calling_module => p_calling_program,
4151 p_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.promised_date),
4152 p_entity_id_tbl => p_line_locations.interface_id,
4153 p_entity_type => c_entity_type_line_location,
4154 p_column_name => 'PROMISED_DATE',
4155 p_message_name => 'PO_PDOI_COLUMN_NULL',
4156 p_token1_name => 'COLUMN_NAME',
4157 p_token1_value => 'PROMISED_DATE',
4158 p_token2_name => 'VALUE',
4159 p_token2_value_tbl => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.promised_date),
4160 p_validation_id => PO_VAL_CONSTANTS.c_promised_date_null,
4161 x_results => x_results,
4162 x_result_type => l_result_type);
4163
4164
4165 ---------------------------------------------------------------
4166 -- Price Break Validations
4167 ---------------------------------------------------------------
4168
4169 WHEN c_at_least_one_required_field THEN
4170 IF (p_calling_program = c_program_PDOI) THEN
4171 PO_VAL_PRICE_BREAKS.at_least_one_required_field(
4172 p_line_loc_id_tbl => p_line_locations.interface_id
4173 , p_start_date_tbl => p_line_locations.from_date
4174 , p_end_date_tbl => p_line_locations.to_date
4175 , p_quantity_tbl => p_line_locations.quantity
4176 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
4177 , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
4178 , x_results => x_results
4179 , x_result_type => l_result_type
4180 );
4181 ELSE
4182 PO_VAL_PRICE_BREAKS.at_least_one_required_field(
4183 p_line_loc_id_tbl => p_line_locations.line_location_id
4184 , p_start_date_tbl => p_line_locations.start_date
4185 , p_end_date_tbl => p_line_locations.end_date
4186 , p_quantity_tbl => p_line_locations.quantity
4187 , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
4188 , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
4189 , x_results => x_results
4190 , x_result_type => l_result_type
4191 );
4192 END IF;
4193
4194 WHEN c_price_discount_in_percent THEN
4195 PO_VAL_PRICE_BREAKS.price_discount_in_percent(
4196 p_line_loc_id_tbl => p_line_locations.line_location_id
4197 , p_price_discount_tbl => p_line_locations.price_discount
4198 , x_results => x_results
4199 , x_result_type => l_result_type
4200 );
4201
4202 WHEN c_price_override_gt_zero THEN
4203 PO_VAL_PRICE_BREAKS.price_override_gt_zero(
4204 p_line_loc_id_tbl => p_line_locations.line_location_id
4205 , p_price_override_tbl => p_line_locations.price_override
4206 , x_results => x_results
4207 , x_result_type => l_result_type
4208 );
4209
4210 WHEN c_price_break_qty_ge_zero THEN
4211 PO_VAL_PRICE_BREAKS.quantity_ge_zero(
4212 p_line_loc_id_tbl => p_line_locations.line_location_id
4213 , p_quantity_tbl => p_line_locations.quantity
4214 , x_results => x_results
4215 , x_result_type => l_result_type
4216 );
4217
4218 WHEN c_price_break_start_le_end THEN
4219 PO_VAL_PRICE_BREAKS.start_date_le_end_date(
4220 p_line_loc_id_tbl => p_line_locations.line_location_id
4221 , p_start_date_tbl => p_line_locations.start_date
4222 , p_end_date_tbl => p_line_locations.end_date
4223 , x_results => x_results
4224 , x_result_type => l_result_type
4225 );
4226
4227 WHEN c_break_start_ge_blanket_start THEN
4228 PO_VAL_PRICE_BREAKS.break_start_ge_blanket_start(
4229 p_line_loc_id_tbl => p_line_locations.line_location_id
4230 , p_blanket_start_date_tbl => p_line_locations.hdr_start_date
4231 , p_price_break_start_date_tbl => p_line_locations.start_date
4232 , x_results => x_results
4233 , x_result_type => l_result_type
4234 );
4235
4236 WHEN c_break_start_le_blanket_end THEN
4237 PO_VAL_PRICE_BREAKS.break_start_le_blanket_end(
4238 p_line_loc_id_tbl => p_line_locations.line_location_id
4239 , p_blanket_end_date_tbl => p_line_locations.hdr_end_date
4240 , p_price_break_start_date_tbl => p_line_locations.start_date
4241 , x_results => x_results
4242 , x_result_type => l_result_type
4243 );
4244
4245 WHEN c_break_start_le_expiration THEN
4246 PO_VAL_PRICE_BREAKS.break_start_le_expiration(
4247 p_line_loc_id_tbl => p_line_locations.line_location_id
4248 , p_expiration_date_tbl => p_line_locations.line_expiration_date
4249 , p_price_break_start_date_tbl => p_line_locations.start_date
4250 , x_results => x_results
4251 , x_result_type => l_result_type
4252 );
4253
4254 WHEN c_break_end_le_expiration THEN
4255 PO_VAL_PRICE_BREAKS.break_end_le_expiration(
4256 p_line_loc_id_tbl => p_line_locations.line_location_id
4257 , p_expiration_date_tbl => p_line_locations.line_expiration_date
4258 , p_price_break_end_date_tbl => p_line_locations.end_date
4259 , x_results => x_results
4260 , x_result_type => l_result_type
4261 );
4262
4263 WHEN c_break_end_ge_blanket_start THEN
4264 PO_VAL_PRICE_BREAKS.break_end_ge_blanket_start(
4265 p_line_loc_id_tbl => p_line_locations.line_location_id
4266 , p_blanket_start_date_tbl => p_line_locations.hdr_start_date
4267 , p_price_break_end_date_tbl => p_line_locations.end_date
4268 , x_results => x_results
4269 , x_result_type => l_result_type
4270 );
4271
4272 WHEN c_break_end_le_blanket_end THEN
4273 PO_VAL_PRICE_BREAKS.break_end_le_blanket_end(
4274 p_line_loc_id_tbl => p_line_locations.line_location_id
4275 , p_blanket_end_date_tbl => p_line_locations.hdr_end_date
4276 , p_price_break_end_date_tbl => p_line_locations.end_date
4277 , x_results => x_results
4278 , x_result_type => l_result_type
4279 );
4280
4281 ---------------------------------------------------------------
4282 -- Distribution Validations
4283 ---------------------------------------------------------------
4284
4285 WHEN c_dist_num_unique THEN
4286 PO_VAL_DISTRIBUTIONS.dist_num_unique(
4287 p_dist_id_tbl => p_distributions.po_distribution_id
4288 , p_line_loc_id_tbl => p_distributions.line_location_id
4289 , p_dist_num_tbl => p_distributions.distribution_num
4290 , x_result_set_id => l_result_set_id
4291 , x_result_type => l_result_type
4292 );
4293
4294 WHEN c_dist_num_gt_zero THEN
4295 PO_VAL_DISTRIBUTIONS.dist_num_gt_zero(
4296 p_dist_id_tbl => p_distributions.po_distribution_id
4297 , p_dist_num_tbl => p_distributions.distribution_num
4298 , x_results => x_results
4299 , x_result_type => l_result_type
4300 );
4301
4302 WHEN c_dist_qty_gt_zero THEN
4303 PO_VAL_DISTRIBUTIONS.quantity_gt_zero(
4304 p_dist_id_tbl => p_distributions.po_distribution_id
4305 , p_qty_ordered_tbl => p_distributions.quantity_ordered
4306 -- <Complex Work R12>: Use value_basis instead of order_type_lookup_code
4307 , p_value_basis_tbl => p_distributions.ship_value_basis
4308 , x_results => x_results
4309 , x_result_type => l_result_type
4310 );
4311
4312 -- <Complex Work R12 Start>: Combined billed and del into exec
4313 WHEN c_dist_qty_ge_qty_exec THEN
4314 PO_VAL_DISTRIBUTIONS.quantity_ge_quantity_exec(
4315 p_dist_id_tbl => p_distributions.po_distribution_id
4316 , p_dist_type_tbl => p_distributions.distribution_type
4317 , p_qty_ordered_tbl => p_distributions.quantity_ordered
4318 , x_result_set_id => l_result_set_id
4319 , x_result_type => l_result_type
4320 );
4321 -- <Complex Work R12 End>
4322
4323 WHEN c_dist_amt_gt_zero THEN
4324 PO_VAL_DISTRIBUTIONS.amount_gt_zero(
4325 p_dist_id_tbl => p_distributions.po_distribution_id
4326 , p_amt_ordered_tbl => p_distributions.amount_ordered
4327 -- <Complex Work R12>: Use value_basis instead of order_type_lookup_code
4328 , p_value_basis_tbl => p_distributions.ship_value_basis
4329 , x_results => x_results
4330 , x_result_type => l_result_type
4331 );
4332
4333 -- <Complex Work R12 Start>: Combined billed and del into exec
4334 WHEN c_dist_amt_ge_amt_exec THEN
4335 PO_VAL_DISTRIBUTIONS.amount_ge_amount_exec(
4336 p_dist_id_tbl => p_distributions.po_distribution_id
4337 , p_dist_type_tbl => p_distributions.distribution_type
4338 , p_amt_ordered_tbl => p_distributions.amount_ordered
4339 , x_result_set_id => l_result_set_id
4340 , x_result_type => l_result_type
4341 );
4342 -- <Complex Work R12 End>
4343
4344 WHEN c_pjm_unit_number_effective THEN
4345 PO_VAL_DISTRIBUTIONS.pjm_unit_number_effective(
4346 p_dist_id_tbl => p_distributions.po_distribution_id
4347 , p_end_item_unit_number_tbl => p_distributions.end_item_unit_number
4348 , p_item_id_tbl => p_distributions.line_item_id
4349 , p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id
4350 -- Bug# 4338241: Adding destination type
4351 , p_destination_type_code_tbl => p_distributions.destination_type_code
4352 , x_results => x_results
4353 , x_result_type => l_result_type
4354 );
4355
4356 WHEN c_amount_to_encumber_ge_zero THEN
4357 PO_VAL_DISTRIBUTIONS.amount_to_encumber_ge_zero(
4358 p_dist_id_tbl => p_distributions.po_distribution_id
4359 , p_amount_to_encumber_tbl => p_distributions.amount_to_encumber
4360 , x_results => x_results
4361 , x_result_type => l_result_type
4362 );
4363
4364 WHEN c_budget_account_id_not_null THEN
4365 PO_VAL_DISTRIBUTIONS.budget_account_id_not_null(
4366 p_dist_id_tbl => p_distributions.po_distribution_id
4367 , p_budget_account_id_tbl => p_distributions.budget_account_id
4368 , x_results => x_results
4369 , x_result_type => l_result_type
4370 );
4371
4372 WHEN c_gl_encumbered_date_not_null THEN
4373 PO_VAL_DISTRIBUTIONS.gl_encumbered_date_not_null(
4374 p_dist_id_tbl => p_distributions.po_distribution_id
4375 , p_gl_encumbered_date_tbl => p_distributions.gl_encumbered_date
4376 , x_results => x_results
4377 , x_result_type => l_result_type
4378 );
4379
4380 WHEN c_gl_enc_date_not_null_open THEN
4381 PO_VAL_DISTRIBUTIONS.gl_enc_date_not_null_open(
4382 p_dist_id_tbl => p_distributions.po_distribution_id
4383 , p_org_id_tbl => p_distributions.org_id
4384 , p_gl_encumbered_date_tbl => p_distributions.gl_encumbered_date
4385 , x_results => x_results
4386 , x_result_type => l_result_type
4387 );
4388
4389 WHEN c_unencum_amt_le_amt_to_encum THEN
4390 PO_VAL_DISTRIBUTIONS.unencum_amt_le_amt_to_encum(
4391 p_dist_id_tbl => p_distributions.po_distribution_id
4392 , p_amount_to_encumber_tbl => p_distributions.amount_to_encumber
4393 , p_unencumbered_amount_tbl => p_distributions.unencumbered_amount
4394 , x_results => x_results
4395 , x_result_type => l_result_type
4396 );
4397
4398 WHEN c_oop_enter_all_fields THEN
4399 PO_VAL_DISTRIBUTIONS.oop_enter_all_fields(
4400 p_dist_id_tbl => p_distributions.po_distribution_id
4401 , p_line_line_type_id_tbl => p_distributions.line_line_type_id
4402 , p_wip_entity_id_tbl => p_distributions.wip_entity_id
4403 , p_wip_line_id_tbl => p_distributions.wip_line_id
4404 , p_wip_operation_seq_num_tbl => p_distributions.wip_operation_seq_num
4405 , p_destination_type_code_tbl => p_distributions.destination_type_code
4406 , p_wip_resource_seq_num_tbl => p_distributions.wip_resource_seq_num
4407 , x_results => x_results
4408 , x_result_type => l_result_type
4409 );
4410
4411 WHEN c_gms_data_valid THEN
4412 PO_VAL_DISTRIBUTIONS.gms_data_valid(
4413 p_dist_id_tbl => p_distributions.po_distribution_id
4414 , p_project_id_tbl => p_distributions.project_id
4415 , p_task_id_tbl => p_distributions.task_id
4416 , p_award_number_tbl => p_distributions.award_number
4417 , p_expenditure_type_tbl => p_distributions.expenditure_type
4418 , p_expenditure_item_date_tbl => p_distributions.expenditure_item_date
4419 , x_results => x_results
4420 , x_result_type => l_result_type
4421 );
4422
4423 -- ECO 4059111 : FV Validation
4424 WHEN c_check_fv_validations THEN
4425 PO_VAL_DISTRIBUTIONS.check_fv_validations(
4426 p_dist_id_tbl => p_distributions.po_distribution_id
4427 , p_ccid_tbl => p_distributions.code_combination_id
4428 , p_org_id_tbl => p_distributions.org_id
4429 , p_attribute1_tbl => p_distributions.attribute1
4430 , p_attribute2_tbl => p_distributions.attribute2
4431 , p_attribute3_tbl => p_distributions.attribute3
4432 , p_attribute4_tbl => p_distributions.attribute4
4433 , p_attribute5_tbl => p_distributions.attribute5
4434 , p_attribute6_tbl => p_distributions.attribute6
4435 , p_attribute7_tbl => p_distributions.attribute7
4436 , p_attribute8_tbl => p_distributions.attribute8
4437 , p_attribute9_tbl => p_distributions.attribute9
4438 , p_attribute10_tbl => p_distributions.attribute10
4439 , p_attribute11_tbl => p_distributions.attribute11
4440 , p_attribute12_tbl => p_distributions.attribute12
4441 , p_attribute13_tbl => p_distributions.attribute13
4442 , p_attribute14_tbl => p_distributions.attribute14
4443 , p_attribute15_tbl => p_distributions.attribute15
4444 , x_results => x_results
4445 , x_result_type => l_result_type
4446 );
4447
4448 -- Bug 5442682 : Validate project related fields
4449 -- Bug 7558385
4450 -- Need to check for PJM Parameters before making Task as mandatory.
4451 -- For fetching the PJM paramters passing ship to org id.
4452
4453 WHEN c_check_proj_rel_validations THEN
4454 PO_VAL_DISTRIBUTIONS.check_proj_related_validations(
4455 p_dist_id_tbl => p_distributions.po_distribution_id
4456 , p_dest_type_code_tbl => p_distributions.destination_type_code
4457 , p_project_id_tbl => p_distributions.project_id
4458 , p_task_id_tbl => p_distributions.task_id
4459 , p_award_id_tbl => p_distributions.award_id
4460 , p_expenditure_type_tbl => p_distributions.expenditure_type
4461 , p_expenditure_org_id_tbl => p_distributions.expenditure_organization_id
4462 , p_expenditure_item_date_tbl => p_distributions.expenditure_item_date
4463 , p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id
4464 , x_results => x_results
4465 , x_result_type => l_result_type
4466 );
4467
4468 -- Bug 7516824: Validate PO_DISTRIBUTIONS DFF
4469 WHEN c_dist_dff_validate THEN
4470 PO_VALIDATION_HELPER.validate_desc_flex(
4471 p_calling_module => p_calling_program,
4472 p_id_tbl => p_distributions.po_distribution_id,
4473 p_desc_flex_name => 'PO_DISTRIBUTIONS',
4474 p_attribute_category_tbl => p_distributions.attribute_category,
4475 p_attribute1_tbl => p_distributions.attribute1,
4476 p_attribute2_tbl => p_distributions.attribute2,
4477 p_attribute3_tbl => p_distributions.attribute3,
4478 p_attribute4_tbl => p_distributions.attribute4,
4479 p_attribute5_tbl => p_distributions.attribute5,
4480 p_attribute6_tbl => p_distributions.attribute6,
4481 p_attribute7_tbl => p_distributions.attribute7,
4482 p_attribute8_tbl => p_distributions.attribute8,
4483 p_attribute9_tbl => p_distributions.attribute9,
4484 p_attribute10_tbl => p_distributions.attribute10,
4485 p_attribute11_tbl => p_distributions.attribute11,
4486 p_attribute12_tbl => p_distributions.attribute12,
4487 p_attribute13_tbl => p_distributions.attribute13,
4488 p_attribute14_tbl => p_distributions.attribute14,
4489 p_attribute15_tbl => p_distributions.attribute15,
4490 p_entity_type => c_entity_type_distribution,
4491 x_results => x_results,
4492 x_result_type => l_result_type);
4493
4494 -------------------------------------------------------------------------
4495 -- PDOI Distributions Validation Subroutines
4496 -------------------------------------------------------------------------
4497 WHEN c_dist_amount_ordered THEN
4498 PO_VAL_DISTRIBUTIONS2.amount_ordered(p_id_tbl => p_distributions.interface_id,
4499 p_amount_ordered_tbl => p_distributions.amount_ordered,
4500 p_order_type_code_tbl => p_distributions.line_order_type_lookup_code,
4501 x_results => x_results,
4502 x_result_type => l_result_type);
4503 WHEN c_dist_quantity_ordered THEN
4504 PO_VAL_DISTRIBUTIONS2.quantity_ordered(p_id_tbl => p_distributions.interface_id,
4505 p_quantity_ordered_tbl => p_distributions.quantity_ordered,
4506 p_order_type_code_tbl => p_distributions.line_order_type_lookup_code,
4507 x_results => x_results,
4508 x_result_type => l_result_type);
4509 WHEN c_dist_destination_org_id THEN
4510 PO_VAL_DISTRIBUTIONS2.destination_org_id(p_id_tbl => p_distributions.interface_id,
4511 p_dest_org_id_tbl => p_distributions.destination_organization_id,
4512 p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id,
4513 x_results => x_results,
4514 x_result_type => l_result_type);
4515 WHEN c_dist_deliver_to_location_id THEN
4516 PO_VAL_DISTRIBUTIONS2.deliver_to_location_id(p_id_tbl => p_distributions.interface_id,
4517 p_deliver_to_location_id_tbl => p_distributions.deliver_to_location_id,
4518 p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id,
4519 x_result_set_id => l_result_set_id,
4520 x_result_type => l_result_type);
4521 WHEN c_dist_deliver_to_person_id THEN
4522 PO_VAL_DISTRIBUTIONS2.deliver_to_person_id(p_id_tbl => p_distributions.interface_id,
4523 p_deliver_to_person_id_tbl => p_distributions.deliver_to_person_id,
4524 x_result_set_id => l_result_set_id,
4525 x_result_type => l_result_type);
4526 WHEN c_dist_destination_type_code THEN
4527 PO_VAL_DISTRIBUTIONS2.destination_type_code(p_id_tbl => p_distributions.interface_id,
4528 p_dest_type_code_tbl => p_distributions.destination_type_code,
4529 p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id,
4530 p_item_id_tbl => p_distributions.line_item_id,
4531 p_txn_flow_header_id_tbl => p_distributions.transaction_flow_header_id,
4532 p_accrue_on_receipt_flag_tbl => p_distributions.accrue_on_receipt_flag,
4533 p_value_basis_tbl => p_distributions.line_order_type_lookup_code,
4534 p_purchase_basis_tbl => p_distributions.line_purchase_basis, --bug7644072
4535 p_expense_accrual_code => l_expense_accrual_code,
4536 p_loc_outsourced_assembly_tbl => p_distributions.loc_outsourced_assembly,
4537 x_result_set_id => l_result_set_id,
4538 x_results => x_results,
4539 x_result_type => l_result_type);
4540 WHEN c_dist_destination_subinv THEN
4541 PO_VAL_DISTRIBUTIONS2.destination_subinv(p_id_tbl => p_distributions.interface_id,
4542 p_destination_subinv_tbl => p_distributions.destination_subinventory,
4543 p_dest_type_code_tbl => p_distributions.destination_type_code,
4544 p_item_id_tbl => p_distributions.line_item_id,
4545 p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id,
4546 p_loc_outsourced_assembly_tbl => p_distributions.loc_outsourced_assembly,
4547 x_result_set_id => l_result_set_id,
4548 x_results => x_results,
4549 x_result_type => l_result_type);
4550 WHEN c_dist_wip_entity_id THEN
4551 PO_VAL_DISTRIBUTIONS2.wip_entity_id(p_id_tbl => p_distributions.interface_id,
4552 p_wip_entity_id_tbl => p_distributions.wip_entity_id,
4553 p_wip_rep_schedule_id_tbl => p_distributions.wip_repetitive_schedule_id,
4554 p_dest_type_code_tbl => p_distributions.destination_type_code,
4555 p_destination_org_id_tbl => p_distributions.destination_organization_id,
4556 x_result_set_id => l_result_set_id,
4557 x_results => x_results,
4558 x_result_type => l_result_type);
4559 WHEN c_prevent_encumberance_flag THEN
4560 PO_VAL_DISTRIBUTIONS2.prevent_encumbrance_flag(p_id_tbl => p_distributions.interface_id,
4561 p_prevent_encum_flag_tbl => p_distributions.prevent_encumbrance_flag,
4562 p_dest_type_code_tbl => p_distributions.destination_type_code,
4563 x_results => x_results,
4564 x_result_type => l_result_type);
4565 WHEN c_charge_account_id THEN
4566 PO_VAL_DISTRIBUTIONS2.charge_account_id(p_id_tbl => p_distributions.interface_id,
4567 p_charge_account_id_tbl => p_distributions.code_combination_id,
4568 p_gl_date_tbl => p_distributions.gl_encumbered_date,
4569 p_chart_of_account_id => l_chart_of_account_id,
4570 x_result_set_id => l_result_set_id,
4571 x_result_type => l_result_type);
4572 WHEN c_budget_account_id THEN
4573 PO_VAL_DISTRIBUTIONS2.budget_account_id(p_id_tbl => p_distributions.interface_id,
4574 p_budget_account_id_tbl => p_distributions.budget_account_id,
4575 p_gl_date_tbl => p_distributions.gl_encumbered_date,
4576 p_dest_type_code_tbl => p_distributions.destination_type_code,
4577 p_chart_of_account_id => l_chart_of_account_id,
4578 p_po_encumberance_flag => l_po_encumbrance_flag,
4579 x_result_set_id => l_result_set_id,
4580 x_result_type => l_result_type);
4581 WHEN c_accrual_account_id THEN
4582 PO_VAL_DISTRIBUTIONS2.account_id(p_id_tbl => p_distributions.interface_id,
4583 p_account_id_tbl => p_distributions.accrual_account_id,
4584 p_gl_date_tbl => p_distributions.gl_encumbered_date,
4585 p_chart_of_account_id => l_chart_of_account_id,
4586 p_message_name => 'PO_PDOI_INVALID_ACCRUAL_ACCT',
4587 p_column_name => 'ACCRUAL_ACCOUNT_ID',
4588 p_token_name => 'ACCRUAL_ACCOUNT',
4589 x_result_set_id => l_result_set_id,
4590 x_result_type => l_result_type);
4591 WHEN c_variance_account_id THEN
4592 PO_VAL_DISTRIBUTIONS2.account_id(p_id_tbl => p_distributions.interface_id,
4593 p_account_id_tbl => p_distributions.variance_account_id,
4594 p_gl_date_tbl => p_distributions.gl_encumbered_date,
4595 p_chart_of_account_id => l_chart_of_account_id,
4596 p_message_name => 'PO_PDOI_INVALID_VAR_ACCT',
4597 p_column_name => 'VARIANCE_ACCOUNT_ID',
4598 p_token_name => 'VARIANCE_ACCOUNT',
4599 x_result_set_id => l_result_set_id,
4600 x_result_type => l_result_type);
4601 WHEN c_project_acct_context THEN
4602 PO_VAL_DISTRIBUTIONS2.project_acct_context(p_id_tbl => p_distributions.interface_id,
4603 p_project_acct_ctx_tbl => p_distributions.project_accounting_context,
4604 p_project_id_tbl => p_distributions.project_id,
4605 p_task_id_tbl => p_distributions.task_id,
4606 p_exp_type_tbl => p_distributions.expenditure_type,
4607 p_exp_org_id_tbl => p_distributions.expenditure_organization_id,
4608 x_results => x_results,
4609 x_result_type => l_result_type);
4610 WHEN c_project_info THEN
4611 PO_VAL_DISTRIBUTIONS2.project_info(p_id_tbl => p_distributions.interface_id,
4612 p_project_acct_ctx_tbl => p_distributions.project_accounting_context,
4613 p_dest_type_code_tbl => p_distributions.destination_type_code,
4614 p_project_id_tbl => p_distributions.project_id,
4615 p_task_id_tbl => p_distributions.task_id,
4616 p_expenditure_type_tbl => p_distributions.expenditure_type,
4617 p_expenditure_org_id_tbl => p_distributions.expenditure_organization_id,
4618 p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id,
4619 p_need_by_date_tbl => p_distributions.header_need_by_date,
4620 p_promised_date_tbl => p_distributions.promised_date,
4621 p_expenditure_item_date_tbl => p_distributions.expenditure_item_date,
4622 p_ship_to_ou_id => l_operating_unit,
4623 p_deliver_to_person_id_tbl => p_distributions.deliver_to_person_id,
4624 p_agent_id_tbl => p_distributions.hdr_agent_id,
4625 p_txn_flow_header_id_tbl => p_distributions.transaction_flow_header_id,
4626 x_results => x_results,
4627 x_result_type => l_result_type);
4628
4629 WHEN c_tax_recovery_override_flag THEN
4630 PO_VAL_DISTRIBUTIONS2.tax_recovery_override_flag(p_id_tbl => p_distributions.interface_id,
4631 p_recovery_override_flag_tbl => p_distributions.tax_recovery_override_flag,
4632 p_allow_tax_rate_override => l_allow_tax_rate_override,
4633 x_results => x_results,
4634 x_result_type => l_result_type);
4635 ---------------------------------------------------------------
4636 -- GA Org Assignment Validations
4637 ---------------------------------------------------------------
4638
4639 WHEN c_assign_purch_org_not_null THEN
4640 PO_VAL_GA_ORG_ASSIGNMENTS.purchasing_org_id_not_null(
4641 p_org_assignment_id_tbl => p_ga_org_assignments.org_assignment_id
4642 , p_purchasing_org_id_tbl => p_ga_org_assignments.purchasing_org_id
4643 , x_results => x_results
4644 , x_result_type => l_result_type
4645 );
4646
4647 WHEN c_assign_vendor_site_not_null THEN
4648 PO_VAL_GA_ORG_ASSIGNMENTS.vendor_site_id_not_null(
4649 p_org_assignment_id_tbl => p_ga_org_assignments.org_assignment_id
4650 , p_vendor_site_id_tbl => p_ga_org_assignments.vendor_site_id
4651 , x_results => x_results
4652 , x_result_type => l_result_type
4653 );
4654
4655
4656 ---------------------------------------------------------------
4657 -- Notification Control Validations
4658 ---------------------------------------------------------------
4659
4660 WHEN c_notif_start_date_le_end_date THEN
4661 PO_VAL_NOTIFICATION_CONTROLS.start_date_le_end_date(
4662 p_notification_id_tbl => p_notification_controls.notification_id
4663 , p_start_date_active_tbl => p_notification_controls.start_date_active
4664 , p_end_date_active_tbl => p_notification_controls.end_date_active
4665 , x_results => x_results
4666 , x_result_type => l_result_type
4667 );
4668
4669 WHEN c_notif_percent_le_one_hundred THEN
4670 PO_VAL_NOTIFICATION_CONTROLS.percent_le_one_hundred(
4671 p_notification_id_tbl => p_notification_controls.notification_id
4672 , p_notif_qty_percentage_tbl => p_notification_controls.notification_qty_percentage
4673 , x_results => x_results
4674 , x_result_type => l_result_type
4675 );
4676
4677 WHEN c_notif_amount_gt_zero THEN
4678 PO_VAL_NOTIFICATION_CONTROLS.amount_gt_zero(
4679 p_notification_id_tbl => p_notification_controls.notification_id
4680 , p_notification_amount_tbl => p_notification_controls.notification_amount
4681 , x_results => x_results
4682 , x_result_type => l_result_type
4683 );
4684
4685 WHEN c_notif_amount_not_null THEN
4686 PO_VAL_NOTIFICATION_CONTROLS.amount_not_null(
4687 p_notif_id_tbl => p_notification_controls.notification_id
4688 , p_notif_amount_tbl => p_notification_controls.notification_amount
4689 , p_notif_condition_code_tbl => p_notification_controls.notification_condition_code
4690 , x_results => x_results
4691 , x_result_type => l_result_type
4692 );
4693
4694 WHEN c_notif_start_date_not_null THEN
4695 PO_VAL_NOTIFICATION_CONTROLS.start_date_active_not_null(
4696 p_notif_id_tbl => p_notification_controls.notification_id
4697 , p_start_date_active_tbl => p_notification_controls.start_date_active
4698 , p_notif_condition_code_tbl => p_notification_controls.notification_condition_code
4699 , x_results => x_results
4700 , x_result_type => l_result_type
4701 );
4702
4703
4704 ---------------------------------------------------------------
4705 -- Price Differential Validations
4706 ---------------------------------------------------------------
4707
4708 WHEN c_unique_price_diff_num THEN
4709 PO_VAL_PRICE_DIFFS.unique_price_diff_num(
4710 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4711 , p_entity_id_tbl => p_price_differentials.entity_id
4712 , p_entity_type_tbl => p_price_differentials.entity_type
4713 , p_price_differential_num_tbl => p_price_differentials.price_differential_num
4714 , x_result_set_id => l_result_set_id
4715 , x_result_type => l_result_type
4716 );
4717
4718 WHEN c_price_diff_num_gt_zero THEN
4719 PO_VAL_PRICE_DIFFS.price_diff_num_gt_zero(
4720 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4721 , p_price_differential_num_tbl => p_price_differentials.price_differential_num
4722 , x_results => x_results
4723 , x_result_type => l_result_type
4724 );
4725
4726 WHEN c_unique_price_type THEN
4727 PO_VAL_PRICE_DIFFS.unique_price_type(
4728 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4729 , p_entity_id_tbl => p_price_differentials.entity_id
4730 , p_entity_type_tbl => p_price_differentials.entity_type
4731 , p_price_type_tbl => p_price_differentials.price_type
4732 , x_result_set_id => l_result_set_id
4733 , x_result_type => l_result_type
4734 );
4735
4736 WHEN c_max_mul_ge_zero THEN
4737 PO_VAL_PRICE_DIFFS.max_mul_ge_zero(
4738 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4739 , p_max_multiplier_tbl => p_price_differentials.max_multiplier
4740 , x_results => x_results
4741 , x_result_type => l_result_type
4742 );
4743
4744 WHEN c_max_mul_ge_min_mul THEN
4745 PO_VAL_PRICE_DIFFS.max_mul_ge_min_mul(
4746 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4747 , p_min_multiplier_tbl => p_price_differentials.min_multiplier
4748 , p_max_multiplier_tbl => p_price_differentials.max_multiplier
4749 , x_results => x_results
4750 , x_result_type => l_result_type
4751 );
4752
4753 WHEN c_min_mul_ge_zero THEN
4754 PO_VAL_PRICE_DIFFS.min_mul_ge_zero(
4755 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4756 , p_min_multiplier_tbl => p_price_differentials.min_multiplier
4757 , x_results => x_results
4758 , x_result_type => l_result_type
4759 );
4760
4761 WHEN c_mul_ge_zero THEN
4762 PO_VAL_PRICE_DIFFS.mul_ge_zero(
4763 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4764 , p_multiplier_tbl => p_price_differentials.multiplier
4765 , x_results => x_results
4766 , x_result_type => l_result_type
4767 );
4768
4769 WHEN c_spo_price_type_on_src_doc THEN
4770 PO_VAL_PRICE_DIFFS.spo_price_type_on_src_doc(
4771 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4772 , p_entity_type_tbl => p_price_differentials.entity_type
4773 , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
4774 , p_from_line_id_tbl => p_price_differentials.line_from_line_id
4775 , p_price_type_tbl => p_price_differentials.price_type
4776 , x_result_set_id => l_result_set_id
4777 , x_result_type => l_result_type
4778 );
4779
4780 WHEN c_spo_mul_btwn_min_max THEN
4781 PO_VAL_PRICE_DIFFS.spo_mul_btwn_min_max(
4782 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4783 , p_entity_type_tbl => p_price_differentials.entity_type
4784 , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
4785 , p_from_line_id_tbl => p_price_differentials.line_from_line_id
4786 , p_multiplier_tbl => p_price_differentials.multiplier
4787 , p_price_type_tbl => p_price_differentials.price_type --Bug 5415284
4788 , x_result_set_id => l_result_set_id
4789 , x_result_type => l_result_type
4790 );
4791
4792 WHEN c_spo_mul_ge_min THEN
4793 PO_VAL_PRICE_DIFFS.spo_mul_ge_min(
4794 p_price_differential_id_tbl => p_price_differentials.price_differential_id
4795 , p_entity_type_tbl => p_price_differentials.entity_type
4796 , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
4797 , p_from_line_id_tbl => p_price_differentials.line_from_line_id
4798 , p_multiplier_tbl => p_price_differentials.multiplier
4799 , p_price_type_tbl => p_price_differentials.price_type --Bug 5415284
4800 , x_result_set_id => l_result_set_id
4801 , x_result_type => l_result_type
4802 );
4803
4804 --------------------------------------------------------------------------
4805 -- Price Differentials Validation Subroutines
4806 --------------------------------------------------------------------------
4807 WHEN c_price_type THEN
4808 PO_VAL_PRICE_DIFFS2.price_type(p_id_tbl => p_price_differentials.interface_id,
4809 p_price_type_tbl => p_price_differentials.price_type,
4810 x_result_set_id => l_result_set_id,
4811 x_result_type => l_result_type);
4812 WHEN c_multiple_price_diff THEN
4813 PO_VAL_PRICE_DIFFS2.multiple_price_diff(p_id_tbl => p_price_differentials.interface_id,
4814 p_price_type_tbl => p_price_differentials.price_type,
4815 p_entity_type_tbl => p_price_differentials.entity_type,
4816 p_entity_id_tbl => p_price_differentials.entity_id,
4817 x_result_set_id => l_result_set_id,
4818 x_result_type => l_result_type);
4819 WHEN c_entity_type THEN
4820 PO_VAL_PRICE_DIFFS2.entity_type(p_id_tbl => p_price_differentials.interface_id,
4821 p_entity_type_tbl => p_price_differentials.entity_type,
4822 p_doc_type => l_doc_type,
4823 x_results => x_results,
4824 x_result_type => l_result_type);
4825 WHEN c_multiplier THEN
4826 PO_VAL_PRICE_DIFFS2.multiplier(p_id_tbl => p_price_differentials.interface_id,
4827 p_entity_type_tbl => p_price_differentials.entity_type,
4828 p_multiplier_tbl => p_price_differentials.multiplier,
4829 x_results => x_results,
4830 x_result_type => l_result_type);
4831 WHEN c_min_multiplier THEN
4832 PO_VAL_PRICE_DIFFS2.min_multiplier(p_id_tbl => p_price_differentials.interface_id,
4833 p_entity_type_tbl => p_price_differentials.entity_type,
4834 p_min_multiplier_tbl => p_price_differentials.min_multiplier,
4835 x_results => x_results,
4836 x_result_type => l_result_type);
4837 WHEN c_max_multiplier THEN
4838 PO_VAL_PRICE_DIFFS2.max_multiplier(p_id_tbl => p_price_differentials.interface_id,
4839 p_entity_type_tbl => p_price_differentials.entity_type,
4840 p_max_multiplier_tbl => p_price_differentials.max_multiplier,
4841 x_results => x_results,
4842 x_result_type => l_result_type);
4843 WHEN c_price_diff_style_info THEN
4844 PO_VAL_PRICE_DIFFS2.style_related_info(p_id_tbl => p_price_differentials.interface_id,
4845 p_style_id_tbl => p_price_differentials.hdr_style_id,
4846 x_result_set_id => l_result_set_id,
4847 x_result_type => l_result_type);
4848
4849
4850
4851 ---------------------------------------------------------------
4852 -- Price Update Allowed Validations
4853 ---------------------------------------------------------------
4854
4855 WHEN c_no_dists_reserved THEN
4856 PO_PRICE_HELPER.no_dists_reserved(
4857 p_line_id_tbl => p_lines.po_line_id
4858 , x_result_set_id => l_result_set_id
4859 , x_result_type => l_result_type
4860 );
4861
4862 WHEN c_accruals_allow_update THEN
4863 PO_PRICE_HELPER.accruals_allow_update(
4864 p_line_id_tbl => p_lines.po_line_id
4865 , x_results => x_results
4866 , x_result_type => l_result_type
4867 );
4868
4869 WHEN c_no_timecards_exist THEN
4870 PO_PRICE_HELPER.no_timecards_exist(
4871 p_line_id_tbl => p_lines.po_line_id
4872 , x_results => x_results
4873 , x_result_type => l_result_type
4874 );
4875
4876 WHEN c_no_pending_receipts THEN
4877 PO_PRICE_HELPER.no_pending_receipts(
4878 p_line_id_tbl => p_lines.po_line_id
4879 , x_result_set_id => l_result_set_id
4880 , x_result_type => l_result_type
4881 );
4882
4883 WHEN c_retro_account_allows_update THEN
4884 PO_PRICE_HELPER.retro_account_allows_update(
4885 p_line_id_tbl => p_lines.po_line_id
4886 , p_price_break_lookup_code_tbl => p_lines.price_break_lookup_code
4887 , x_results => x_results
4888 , x_result_type => l_result_type
4889 );
4890
4891 WHEN c_warn_amt_based_notif_ctrls THEN
4892 PO_PRICE_HELPER.warn_amt_based_notif_ctrls(
4893 p_line_id_tbl => p_lines.po_line_id
4894 , x_result_set_id => l_result_set_id
4895 , x_result_type => l_result_type
4896 );
4897
4898 ELSE
4899 IF PO_LOG.d_exc THEN
4900 PO_LOG.exc(d_mod,d_position,'Invalid identifier in validation set: '||l_val);
4901 END IF;
4902 RAISE CASE_NOT_FOUND;
4903
4904 END CASE;
4905
4906 EXCEPTION
4907 WHEN OTHERS THEN
4908 IF PO_LOG.d_exc THEN
4909 PO_LOG.exc(d_mod,d_position,
4910 'Validation subroutine '||l_val||' threw exception');
4911 END IF;
4912
4913 l_result_type := c_result_type_FATAL;
4914
4915 x_results.add_result(
4916 p_result_type => c_result_type_FATAL
4917 , p_entity_type => NULL
4918 , p_entity_id => NULL
4919 , p_column_name => NULL
4920 , p_message_name => PO_MESSAGE_S.PO_ALL_SQL_ERROR
4921 , p_token1_name => PO_MESSAGE_S.c_ROUTINE_token
4922 , p_token1_value => d_mod
4923 , p_token2_name => PO_MESSAGE_S.c_ERR_NUMBER_token
4924 , p_token2_value => TO_CHAR(d_position)
4925 , p_token3_name => PO_MESSAGE_S.c_SQL_ERR_token
4926 , p_token3_value => l_val
4927 , p_token4_name => PO_MESSAGE_S.c_LSQL_ERR_token
4928 , p_token4_value => SQLERRM
4929 );
4930
4931 END;
4932
4933 d_position := 200;
4934 IF d_stmt THEN
4935 PO_LOG.stmt(d_mod,d_position,'l_result_type',l_result_type);
4936 PO_LOG.stmt(d_mod,d_position,'l_result_set_id',l_result_set_id);
4937 END IF;
4938
4939 -- Fix the result set id.
4940 IF (l_result_set_id <> x_result_set_id) THEN
4941 d_position := 210;
4942 replace_result_set_id(
4943 p_old_result_set_id => l_result_set_id
4944 , p_new_result_set_id => x_result_set_id
4945 );
4946 END IF;
4947
4948 d_position := 300;
4949
4950 -- Update the result type if the new result takes priority
4951 -- over the old rank.
4952
4953 l_new_rank := result_type_rank(l_result_type);
4954
4955 IF (l_new_rank < l_result_rank) THEN
4956 d_position := 310;
4957
4958 x_result_type := l_result_type;
4959 l_result_rank := l_new_rank;
4960
4961 IF d_stmt THEN
4962 PO_LOG.stmt(d_mod,d_position,'x_result_type',x_result_type);
4963 PO_LOG.stmt(d_mod,d_position,'l_result_rank',l_result_rank);
4964 END IF;
4965
4966 -- If the validation has encountered a serious problem
4967 -- or the stopping result, stop processing.
4968 IF (l_result_rank <= g_result_type_rank_FATAL
4969 OR l_result_rank <= l_stop_rank
4970 )
4971 THEN
4972 d_position := 400;
4973 IF d_stmt THEN
4974 PO_LOG.stmt(d_mod,d_position,'Stopping loop. x_result_type',x_result_type);
4975 END IF;
4976
4977 EXIT;
4978 END IF;
4979
4980 END IF;
4981
4982 END LOOP;
4983
4984 d_position := 500;
4985
4986 -- Commit the result set autonomously.
4987
4988 IF (p_autocommit_results_flag = c_parameter_YES) THEN
4989 d_position := 600;
4990 commit_result_set(p_result_set_id => x_result_set_id);
4991 END IF;
4992
4993 IF PO_LOG.d_proc THEN
4994 PO_LOG.proc_end(d_mod,'x_result_set_id',x_result_set_id);
4995 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
4996 END IF;
4997
4998 EXCEPTION
4999 WHEN OTHERS THEN
5000 IF PO_LOG.d_exc THEN
5001 PO_LOG.exc(d_mod,d_position,NULL);
5002 PO_LOG.proc_end(d_mod,'x_result_set_id',x_result_set_id);
5003 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5004 END IF;
5005 RAISE;
5006
5007 END validate_set;
5008
5009
5010 ----------------------------------------------------------------------------
5011 --Pre-reqs: None.
5012 --Modifies:
5013 -- PO_VALIDATION_RESULTS
5014 --Locks: None.
5015 --Function:
5016 -- See the description for validate_set above.
5017 -- This procedure performs the validations as above.
5018 -- Additionally, it removes the data from PO_VALIDATION_RESULTS
5019 -- and extracts it into the output parameter.
5020 --Parameters:
5021 --OUT:
5022 --x_results
5023 -- The results of the validation cycle.
5024 ----------------------------------------------------------------------------
5025 PROCEDURE validate_set(
5026 p_validation_set IN PO_TBL_VARCHAR2000
5027 , p_headers IN PO_HEADERS_VAL_TYPE DEFAULT NULL
5028 , p_lines IN PO_LINES_VAL_TYPE DEFAULT NULL
5029 , p_line_locations IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
5030 , p_distributions IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
5031 , p_price_differentials IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
5032 , p_ga_org_assignments IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
5033 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
5034 , p_calling_program IN VARCHAR2 DEFAULT NULL
5035 , p_stopping_result_type IN VARCHAR2 DEFAULT NULL
5036 , p_parameter_name_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL
5037 , p_parameter_value_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL
5038 , x_result_type IN OUT NOCOPY VARCHAR2
5039 , x_results OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
5040 )
5041 IS
5042 d_mod CONSTANT VARCHAR2(100) := D_validate_set;
5043 d_position NUMBER := 0;
5044 l_result_set_id NUMBER;
5045 l_table_results PO_VALIDATION_RESULTS_TYPE;
5046 BEGIN
5047
5048 IF PO_LOG.d_proc THEN
5049 PO_LOG.proc_begin(d_mod);
5050 END IF;
5051
5052 d_position := 100;
5053
5054 SAVEPOINT PO_VALIDATIONS_VALIDATE_SET_SP;
5055
5056 validate_set(
5057 p_validation_set => p_validation_set
5058 , p_headers => p_headers
5059 , p_lines => p_lines
5060 , p_line_locations => p_line_locations
5061 , p_distributions => p_distributions
5062 , p_price_differentials => p_price_differentials
5063 , p_ga_org_assignments => p_ga_org_assignments
5064 , p_notification_controls => p_notification_controls
5065 , p_autocommit_results_flag => c_parameter_NO
5066 , p_calling_program => p_calling_program
5067 , p_stopping_result_type => p_stopping_result_type
5068 , p_parameter_name_tbl => p_parameter_name_tbl
5069 , p_parameter_value_tbl => p_parameter_value_tbl
5070 , x_result_type => x_result_type
5071 , x_result_set_id => l_result_set_id
5072 , x_results => x_results
5073 );
5074
5075 d_position := 200;
5076
5077 l_table_results :=
5078 PO_VALIDATION_RESULTS_TYPE.get_result_set_from_gt(
5079 p_result_set_id => l_result_set_id
5080 );
5081
5082 d_position := 300;
5083
5084 ROLLBACK TO SAVEPOINT PO_VALIDATIONS_VALIDATE_SET_SP;
5085
5086 d_position := 400;
5087
5088 x_results.append( p_results => l_table_results );
5089
5090 d_position := 500;
5091
5092 IF PO_LOG.d_proc THEN
5093 PO_LOG.proc_end(d_mod,'l_result_set_id',l_result_set_id);
5094 PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
5095 END IF;
5096
5097 EXCEPTION
5098 WHEN OTHERS THEN
5099 IF PO_LOG.d_exc THEN
5100 PO_LOG.exc(d_mod,d_position,NULL);
5101 PO_LOG.proc_end(d_mod,'l_result_set_id',l_result_set_id);
5102 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5103 END IF;
5104 RAISE;
5105
5106 END validate_set;
5107
5108
5109 -------------------------------------------------------------------------------
5110 --Start of Comments
5111 --Pre-reqs: None.
5112 --Modifies: None.
5113 --Locks: None.
5114 --Function:
5115 -- Ranks the result types in ascending order from
5116 -- most severe error (FATAL) to least severe (SUCCESS).
5117 --Parameters:
5118 --IN:
5119 --p_result_type
5120 -- The result type whose value should be ranked.
5121 --Returns:
5122 -- The rank of the result type.
5123 -- If the input result type cannot be ranked (or is NULL),
5124 -- -1 is returned.
5125 --End of Comments
5126 -------------------------------------------------------------------------------
5127 FUNCTION result_type_rank(p_result_type IN VARCHAR2)
5128 RETURN NUMBER
5129 IS
5130 d_mod CONSTANT VARCHAR2(100) := D_result_type_rank;
5131 l_rank NUMBER;
5132 BEGIN
5133
5134 IF PO_LOG.d_proc THEN
5135 PO_LOG.proc_begin(d_mod,'p_result_type',p_result_type);
5136 END IF;
5137
5138 FOR i IN 1 .. c_result_type_rank_tbl.COUNT LOOP
5139 IF (c_result_type_rank_tbl(i) = p_result_type) THEN
5140 l_rank := i;
5141 EXIT;
5142 END IF;
5143 END LOOP;
5144
5145 IF (l_rank IS NULL) THEN
5146 l_rank := -1;
5147 END IF;
5148
5149 IF PO_LOG.d_proc THEN
5150 PO_LOG.proc_return(d_mod,l_rank);
5151 END IF;
5152
5153 RETURN l_rank;
5154
5155 END result_type_rank;
5156
5157
5158 -------------------------------------------------------------------------------
5159 --Start of Comments
5160 --Pre-reqs: None.
5161 --Modifies: PO_VALIDATION_RESULTS, sequences.
5162 --Locks: None.
5163 --Function:
5164 -- Determines whether or not the unit price of a line is allowed
5165 -- to be updated based on external data.
5166 --Parameters:
5167 --IN:
5168 --p_line_id_tbl
5169 -- Identifies the lines to be validated.
5170 --p_draft_id_tbl
5171 -- Further identifies the lines, used in result messages.
5172 --p_stopping_result_type
5173 -- Indicates that if this result type is encountered,
5174 -- processing should stop and return.
5175 -- Use one of the c_result_type_XXX variables.
5176 -- For no stopping, use NULL.
5177 --OUT:
5178 --x_result_set_id
5179 -- Identifier for the output results in PO_VALIDATION_RESULTS.
5180 --x_result_type
5181 -- Provides a summary of the validation results.
5182 -- VARCHAR2(30)
5183 --End of Comments
5184 -------------------------------------------------------------------------------
5185 PROCEDURE validate_unit_price_change(
5186 p_line_id_tbl IN PO_TBL_NUMBER
5187 , p_price_break_lookup_code_tbl IN PO_TBL_VARCHAR30
5188 , p_stopping_result_type IN VARCHAR2 DEFAULT NULL
5189 , x_result_type OUT NOCOPY VARCHAR2
5190 , x_result_set_id IN OUT NOCOPY NUMBER
5191 , x_results IN OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
5192 )
5193 IS
5194 d_mod CONSTANT VARCHAR2(100) := D_validate_unit_price_change;
5195 l_lines PO_LINES_VAL_TYPE;
5196 BEGIN
5197
5198 IF PO_LOG.d_proc THEN
5199 PO_LOG.proc_begin(d_mod,'p_line_id_tbl',p_line_id_tbl);
5200 PO_LOG.proc_begin(d_mod,'p_stopping_result_type',p_stopping_result_type);
5201 END IF;
5202
5203 l_lines := PO_LINES_VAL_TYPE();
5204 l_lines.po_line_id := p_line_id_tbl;
5205 l_lines.price_break_lookup_code := p_price_break_lookup_code_tbl;
5206
5207 validate_set(
5208 p_validation_set => c_allow_unit_price_change_vs
5209 , p_lines => l_lines
5210 , p_autocommit_results_flag => c_parameter_NO
5211 , p_stopping_result_type => p_stopping_result_type
5212 , x_result_type => x_result_type
5213 , x_result_set_id => x_result_set_id
5214 , x_results => x_results
5215 );
5216
5217 IF PO_LOG.d_proc THEN
5218 PO_LOG.stmt(d_mod,0,'x_result_set_id',x_result_set_id);
5219 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5220 END IF;
5221
5222 EXCEPTION
5223 WHEN OTHERS THEN
5224 IF PO_LOG.d_exc THEN
5225 PO_LOG.exc(d_mod,0,NULL);
5226 END IF;
5227 RAISE;
5228
5229 END validate_unit_price_change;
5230
5231
5232
5233
5234 -------------------------------------------------------------------------------
5235 --Start of Comments
5236 --Pre-reqs: None.
5237 --Modifies: PO_VALIDATION_RESULTS sequences.
5238 --Locks: None.
5239 --Function:
5240 -- Performs the necessary validations for OA flows on the entities provided.
5241 -- The results are removed from the table, as they are collected into the
5242 -- output object.
5243 --Parameters:
5244 --IN:
5245 --p_headers
5246 --p_lines
5247 --p_line_locations
5248 --p_distributions
5249 --p_price_differentials
5250 -- The data that needs to be validated.
5251 -- Pass NULL if nothing of a particular entity type needs to be validated.
5252 --OUT:
5253 --x_result_type
5254 -- Provides a summary of the validation results.
5255 -- VARCHAR2(30)
5256 --x_results
5257 -- The results of the validations.
5258 --End of Comments
5259 -------------------------------------------------------------------------------
5260 PROCEDURE validate_html_order(
5261 p_headers IN PO_HEADERS_VAL_TYPE DEFAULT NULL
5262 , p_lines IN PO_LINES_VAL_TYPE DEFAULT NULL
5263 , p_line_locations IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
5264 , p_distributions IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
5265 , p_price_differentials IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
5266 , x_result_type OUT NOCOPY VARCHAR2
5267 , x_results OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
5268 )
5269 IS
5270 d_mod CONSTANT VARCHAR2(100) := D_validate_html_order;
5271 d_position NUMBER := 0;
5272 l_validation_set PO_TBL_VARCHAR2000;
5273 BEGIN
5274
5275 IF PO_LOG.d_proc THEN
5276 PO_LOG.proc_begin(d_mod);
5277 END IF;
5278
5279 d_position := 1;
5280
5281 l_validation_set := PO_TBL_VARCHAR2000();
5282
5283 IF (p_headers IS NOT NULL) THEN
5284 d_position := 10;
5285 l_validation_set :=
5286 l_validation_set MULTISET UNION DISTINCT c_html_order_header_vs;
5287 END IF;
5288
5289 IF (p_lines IS NOT NULL) THEN
5290 d_position := 20;
5291 l_validation_set :=
5292 l_validation_set MULTISET UNION DISTINCT c_html_order_line_vs;
5293 END IF;
5294
5295 IF (p_line_locations IS NOT NULL) THEN
5296 d_position := 30;
5297 l_validation_set :=
5298 l_validation_set MULTISET UNION DISTINCT c_html_order_shipment_vs;
5299 END IF;
5300
5301 IF (p_distributions IS NOT NULL) THEN
5302 d_position := 40;
5303 l_validation_set :=
5304 l_validation_set MULTISET UNION DISTINCT c_html_order_distribution_vs;
5305 END IF;
5306
5307 IF (p_price_differentials IS NOT NULL) THEN
5308 d_position := 50;
5309 l_validation_set :=
5310 l_validation_set MULTISET UNION DISTINCT c_html_order_price_diff_vs;
5311 END IF;
5312
5313 IF PO_LOG.d_stmt THEN
5314 PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
5315 END IF;
5316
5317 d_position := 100;
5318
5319 validate_set(
5320 p_validation_set => l_validation_set
5321 , p_headers => p_headers
5322 , p_lines => p_lines
5323 , p_line_locations => p_line_locations
5324 , p_distributions => p_distributions
5325 , p_price_differentials => p_price_differentials
5326 , p_calling_program => c_program_OA
5327 , x_result_type => x_result_type
5328 , x_results => x_results
5329 );
5330
5331 IF PO_LOG.d_proc THEN
5332 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5333 PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
5334 END IF;
5335
5336 EXCEPTION
5337 WHEN OTHERS THEN
5338 IF PO_LOG.d_exc THEN
5339 PO_LOG.exc(d_mod,d_position,NULL);
5340 END IF;
5341 RAISE;
5342
5343 END validate_html_order;
5344
5345
5346
5347 PROCEDURE validate_html_agreement(
5348 p_headers IN PO_HEADERS_VAL_TYPE DEFAULT NULL
5349 , p_lines IN PO_LINES_VAL_TYPE DEFAULT NULL
5350 , p_line_locations IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
5351 , p_distributions IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
5352 , p_price_differentials IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
5353 , p_ga_org_assignments IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
5354 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
5355 , x_result_type OUT NOCOPY VARCHAR2
5356 , x_results OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
5357 )
5358 IS
5359 d_mod CONSTANT VARCHAR2(100) := D_validate_html_agreement;
5360 d_position NUMBER := 0;
5361 l_validation_set PO_TBL_VARCHAR2000;
5362 BEGIN
5363
5364 IF PO_LOG.d_proc THEN
5365 PO_LOG.proc_begin(d_mod);
5366 END IF;
5367
5368 d_position := 1;
5369
5370 l_validation_set := PO_TBL_VARCHAR2000();
5371
5372 IF (p_headers IS NOT NULL) THEN
5373 d_position := 10;
5374 l_validation_set :=
5375 l_validation_set MULTISET UNION DISTINCT c_html_agmt_header_vs;
5376 END IF;
5377
5378 IF (p_lines IS NOT NULL) THEN
5379 d_position := 20;
5380 l_validation_set :=
5381 l_validation_set MULTISET UNION DISTINCT c_html_agmt_line_vs;
5382 END IF;
5383
5384 IF (p_line_locations IS NOT NULL) THEN
5385 d_position := 30;
5386 l_validation_set :=
5387 l_validation_set MULTISET UNION DISTINCT c_html_agmt_price_break_vs;
5388 END IF;
5389
5390 IF (p_ga_org_assignments IS NOT NULL) THEN
5391 d_position := 40;
5392 l_validation_set :=
5393 l_validation_set MULTISET UNION DISTINCT c_html_agmt_ga_org_assign_vs;
5394 END IF;
5395
5396 IF (p_price_differentials IS NOT NULL) THEN
5397 d_position := 50;
5398 l_validation_set :=
5399 l_validation_set MULTISET UNION DISTINCT c_html_agmt_price_diff_vs;
5400 END IF;
5401
5402 IF (p_notification_controls IS NOT NULL) THEN
5403 d_position := 60;
5404 l_validation_set :=
5405 l_validation_set MULTISET UNION DISTINCT c_html_agmt_notif_ctrl_vs;
5406 END IF;
5407
5408 IF (p_distributions IS NOT NULL) THEN
5409 d_position := 70;
5410 l_validation_set :=
5411 l_validation_set MULTISET UNION DISTINCT c_html_agmt_distribution_vs;
5412 END IF;
5413
5414 IF PO_LOG.d_stmt THEN
5415 PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
5416 END IF;
5417
5418 d_position := 100;
5419
5420 validate_set(
5421 p_validation_set => l_validation_set
5422 , p_headers => p_headers
5423 , p_lines => p_lines
5424 , p_line_locations => p_line_locations
5425 , p_distributions => p_distributions
5426 , p_price_differentials => p_price_differentials
5427 , p_ga_org_assignments => p_ga_org_assignments
5428 , p_notification_controls => p_notification_controls
5429 , p_calling_program => c_program_OA
5430 , x_result_type => x_result_type
5431 , x_results => x_results
5432 );
5433
5434 IF PO_LOG.d_proc THEN
5435 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5436 PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
5437 END IF;
5438
5439 EXCEPTION
5440 WHEN OTHERS THEN
5441 IF PO_LOG.d_exc THEN
5442 PO_LOG.exc(d_mod,d_position,NULL);
5443 END IF;
5444 RAISE;
5445
5446 END validate_html_agreement;
5447
5448
5449 -------------------------------------------------------------------------------
5450 --Start of Comments
5451 --Pre-reqs: None.
5452 --Modifies: PO_VALIDATION_RESULTS sequences.
5453 --Locks: None.
5454 --Function:
5455 -- Performs the necessary validations for PDOI on the entities provided.
5456 -- The results are removed from the table, as they are collected into the
5457 -- output object.
5458 --Parameters:
5459 --IN:
5460 --p_headers
5461 --p_lines
5462 --p_line_locations
5463 --p_distributions
5464 --p_price_differentials
5465 -- The data that needs to be validated.
5466 -- Pass NULL if nothing of a particular entity type needs to be validated.
5467 --OUT:
5468 --x_result_type
5469 -- Provides a summary of the validation results.
5470 -- VARCHAR2(30)
5471 --x_results
5472 -- The results of the validations.
5473 --End of Comments
5474 -------------------------------------------------------------------------------
5475 PROCEDURE validate_pdoi(
5476 p_headers IN PO_HEADERS_VAL_TYPE DEFAULT NULL,
5477 p_lines IN PO_LINES_VAL_TYPE DEFAULT NULL,
5478 p_line_locations IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL,
5479 p_distributions IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL,
5480 p_price_differentials IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL,
5481 p_doc_type IN VARCHAR2 DEFAULT NULL,
5482 p_action IN VARCHAR2 DEFAULT 'CREATE',
5483 p_parameter_name_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL,
5484 p_parameter_value_tbl IN PO_TBL_VARCHAR2000 DEFAULT NULL,
5485 x_result_type OUT NOCOPY VARCHAR2,
5486 x_results OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
5487 )
5488 IS
5489
5490 d_mod CONSTANT VARCHAR2(100) := D_validate_pdoi;
5491 d_position NUMBER := 0;
5492 l_validation_set PO_TBL_VARCHAR2000;
5493
5494 BEGIN
5495
5496 IF PO_LOG.d_proc THEN
5497 po_log.proc_begin(d_mod, 'p_doc_type', p_doc_type);
5498 po_log.proc_begin(d_mod, 'p_action', p_action);
5499 END IF;
5500
5501 d_position := 1;
5502
5503 l_validation_set := PO_TBL_VARCHAR2000();
5504
5505 IF (p_headers IS NOT NULL AND p_lines IS NULL AND p_line_locations IS NULL AND
5506 p_distributions IS NULL AND p_price_differentials IS NULL) THEN
5507 d_position := 10;
5508 l_validation_set :=
5509 l_validation_set MULTISET UNION DISTINCT c_pdoi_header_common_vs;
5510
5511 CASE p_doc_type
5512 WHEN c_doc_type_blanket THEN
5513 l_validation_set :=
5514 l_validation_set MULTISET UNION DISTINCT c_pdoi_header_blanket_vs;
5515 WHEN c_doc_type_standard THEN
5516 l_validation_set :=
5517 l_validation_set MULTISET UNION DISTINCT c_pdoi_header_standard_vs;
5518 WHEN c_doc_type_quotation THEN
5519 l_validation_set :=
5520 l_validation_set MULTISET UNION DISTINCT c_pdoi_header_quotation_vs;
5521 ELSE
5522 IF PO_LOG.d_exc THEN
5523 PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
5524 END IF;
5525 END CASE;
5526
5527 ELSIF (p_lines IS NOT NULL AND p_action='CREATE' AND p_headers IS NULL AND p_line_locations IS NULL AND
5528 p_distributions IS NULL AND p_price_differentials IS NULL) THEN
5529 d_position := 20;
5530 l_validation_set :=
5531 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_common_vs;
5532
5533 CASE p_doc_type
5534 WHEN c_doc_type_blanket THEN
5535 l_validation_set :=
5536 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_blanket_vs;
5537 WHEN c_doc_type_standard THEN
5538 l_validation_set :=
5539 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_standard_vs;
5540 WHEN c_doc_type_quotation THEN
5541 l_validation_set :=
5542 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_quotation_vs;
5543 ELSE
5544 IF PO_LOG.d_exc THEN
5545 PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
5546 END IF;
5547 END CASE;
5548
5549 ELSIF (p_lines IS NOT NULL AND p_action='UPDATE' AND p_headers IS NULL AND p_line_locations IS NULL AND
5550 p_distributions IS NULL AND p_price_differentials IS NULL) THEN
5551
5552 d_position := 20;
5553 l_validation_set :=
5554 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_update_vs;
5555
5556 CASE p_doc_type
5557 WHEN c_doc_type_blanket THEN
5558 l_validation_set :=
5559 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_blanket_update_vs;
5560 ELSE
5561 IF PO_LOG.d_exc THEN
5562 PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
5563 END IF;
5564 END CASE;
5565
5566 ELSIF (p_line_locations IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
5567 p_distributions IS NULL AND p_price_differentials IS NULL) THEN
5568
5569 d_position := 30;
5570 l_validation_set :=
5571 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_common_vs;
5572
5573 CASE p_doc_type
5574 WHEN c_doc_type_blanket THEN
5575 l_validation_set :=
5576 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_blanket_vs;
5577 WHEN c_doc_type_standard THEN
5578 l_validation_set :=
5579 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_standard_vs;
5580 WHEN c_doc_type_quotation THEN
5581 l_validation_set :=
5582 l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_quotation_vs;
5583 ELSE
5584 IF PO_LOG.d_exc THEN
5585 PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
5586 END IF;
5587 END CASE;
5588
5589 ELSIF (p_distributions IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
5590 p_line_locations IS NULL AND p_price_differentials IS NULL) THEN
5591
5592 d_position := 40;
5593 l_validation_set :=
5594 l_validation_set MULTISET UNION DISTINCT c_pdoi_dist_common_vs;
5595
5596 ELSIF(p_price_differentials IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
5597 p_line_locations IS NULL AND p_distributions IS NULL) THEN
5598
5599 d_position := 50;
5600 l_validation_set :=
5601 l_validation_set MULTISET UNION DISTINCT c_pdoi_price_diff_common_vs;
5602
5603 ELSE
5604
5605 IF PO_LOG.d_exc THEN
5606 PO_LOG.exc(d_mod,d_position,'Call to validate_pdoi was incorrectly called.');
5607 END IF;
5608
5609 END IF;
5610
5611 IF PO_LOG.d_stmt THEN
5612 PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
5613 END IF;
5614
5615 d_position := 100;
5616
5617 validate_set(p_validation_set => l_validation_set,
5618 p_headers => p_headers,
5619 p_lines => p_lines,
5620 p_line_locations => p_line_locations,
5621 p_distributions => p_distributions,
5622 p_price_differentials => p_price_differentials,
5623 p_calling_program => c_program_pdoi,
5624 p_parameter_name_tbl => p_parameter_name_tbl,
5625 p_parameter_value_tbl => p_parameter_value_tbl,
5626 x_result_type => x_result_type,
5627 x_results => x_results
5628 );
5629
5630 IF PO_LOG.d_proc THEN
5631 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
5632 PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
5633 END IF;
5634
5635 EXCEPTION
5636 WHEN OTHERS THEN
5637 IF PO_LOG.d_exc THEN
5638 PO_LOG.exc(d_mod,d_position,NULL);
5639 END IF;
5640 RAISE;
5641
5642 END validate_pdoi;
5643
5644 ----------------------------------------------------------------------
5645 -- Logs the result set in the results table at the statement level.
5646 ----------------------------------------------------------------------
5647 PROCEDURE log_validation_results_gt(
5648 p_module_base IN VARCHAR2
5649 , p_position IN NUMBER
5650 , p_result_set_id IN NUMBER
5651 )
5652 IS
5653 l_rowid_tbl PO_TBL_VARCHAR2000;
5654 BEGIN
5655 IF PO_LOG.d_stmt THEN
5656 SELECT VR.rowid
5657 BULK COLLECT INTO l_rowid_tbl
5658 FROM PO_VALIDATION_RESULTS_GT VR
5659 WHERE VR.result_set_id = p_result_set_id
5660 ;
5661 PO_LOG.stmt_table(p_module_base,p_position,'PO_VALIDATION_RESULTS_GT',l_rowid_tbl);
5662 END IF;
5663 END log_validation_results_gt;
5664
5665
5666
5667 -- Initialize package variables.
5668 BEGIN
5669 g_result_type_rank_SUCCESS := result_type_rank(c_result_type_SUCCESS);
5670 g_result_type_rank_FATAL := result_type_rank(c_result_type_FATAL);
5671
5672 END PO_VALIDATIONS;