DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_VALIDATIONS

Source


1 PACKAGE BODY po_validations AS
2 -- $Header: PO_VALIDATIONS.plb 120.119.12020000.16 2013/04/25 12:30:18 akyanama 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 D_validate_modification_sync CONSTANT VARCHAR2(100) := --CLM Modifications
64   PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'validate_modification_sync');
65 
66 -- Bug#13503748
67 D_check_encumbered_amount CONSTANT VARCHAR2(100) :=
68   PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'check_encumbered_amount');
69 
70 -- Indicates that the calling program is the OA HTML UI.
71 c_program_OA CONSTANT VARCHAR2(10) := 'OA';
72 
73 -- Indicates that the calling program is PDOI.
74 c_program_PDOI CONSTANT VARCHAR2(10) := 'PDOI';
75 
76 -- The application name of PO.
77 c_PO CONSTANT VARCHAR2(2) := 'PO';
78 
79 c_parameter_YES CONSTANT VARCHAR2(1) := PO_CORE_S.g_parameter_YES;
80 c_parameter_NO CONSTANT VARCHAR2(1) := PO_CORE_S.g_parameter_NO;
81 
82 c_doc_type_blanket   CONSTANT VARCHAR2(30) := 'BLANKET';
83 c_doc_type_standard  CONSTANT VARCHAR2(30) := 'STANDARD';
84 c_doc_type_quotation CONSTANT VARCHAR2(30) := 'QUOTATION';
85 
86 
87 /**
88   Used to rank result types, for summary results and other purposes.
89   For example, if one result is WARNING and the other is FAILURE,
90   then the overall result should be FAILURE.  This is indicated
91   by the fact that FAILURE has a lower index in this list than WARNING.
92 */
93 c_result_type_rank_tbl CONSTANT PO_TBL_VARCHAR30 :=
94   PO_TBL_VARCHAR30(
95     c_result_type_FATAL
96   , c_result_type_FAILURE
97   , c_result_type_WARNING
98   , c_result_type_SUCCESS
99   );
100 
101 --------------------------------------------------------------
102 -- Validation Subroutine Constants
103 --------------------------------------------------------------
104 
105 --------------------------------------------------------------------------
106 -- Header Validation Constants
107 --------------------------------------------------------------------------
108 -- Common
109 c_warn_supplier_on_hold CONSTANT VARCHAR2(30) := 'C_WARN_SUPPLIER_ON_HOLD';
110 c_rate_gt_zero CONSTANT VARCHAR2(30) := 'C_RATE_GT_ZERO';
111 c_fax_email_address_valid CONSTANT VARCHAR2(30) := 'C_FAX_EMAIL_ADDRESS_VALID';
112 c_rate_combination_valid CONSTANT VARCHAR2(30) := 'C_RATE_COMBINATION_VALID';
113 c_doc_num_chars_valid CONSTANT VARCHAR2(30) := 'C_DOC_NUM_CHARS_VALID';
114 c_doc_num_unique CONSTANT VARCHAR2(30) := 'C_DOC_NUM_UNIQUE';
115 c_agent_id_not_null CONSTANT VARCHAR2(30) := 'C_AGENT_ID_NOT_NULL';
116 c_hdr_ship_to_loc_not_null CONSTANT VARCHAR2(30) := 'C_HDR_SHIP_TO_LOC_NOT_NULL';
117 c_segment1_not_null CONSTANT VARCHAR2(30) := 'C_SEGMENT1_NOT_NULL';
118 c_ship_via_lookup_code_valid CONSTANT VARCHAR2(30) := 'C_SHIP_VIA_LOOKUP_CODE_VALID'; --Bug 9213424
119 -- Agreements
120 c_price_update_tol_ge_zero CONSTANT VARCHAR2(30) := 'C_PRICE_UPDATE_TOL_GE_ZERO';
121 c_amount_limit_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_LIMIT_GE_ZERO';
122 c_amt_limit_ge_amt_agreed CONSTANT VARCHAR2(30) := 'C_AMT_LIMIT_GE_AMT_AGREED';
123 c_amount_agreed_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED_GE_ZERO';
124 c_amount_agreed_not_null CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED_NOT_NULL';
125 c_effective_le_expiration CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_LE_EXPIRATION';
126 c_effective_from_le_order_date CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_FROM_LE_ORDER_DATE';
127 c_effective_to_ge_order_date CONSTANT VARCHAR2(30) := 'C_EFFECTIVE_TO_GE_ORDER_DATE';
128 c_vendor_id_not_null CONSTANT VARCHAR2(30) := 'C_VENDOR_ID_NOT_NULL';
129 c_vendor_site_id_not_null CONSTANT VARCHAR2(30) := 'C_VENDOR_SITE_ID_NOT_NULL';
130 -- Contracts
131 c_contract_start_le_order_date CONSTANT VARCHAR2(30) := 'C_CONTRACT_START_LE_ORDER_DATE';
132 c_contract_end_ge_order_date CONSTANT VARCHAR2(30) := 'C_CONTRACT_END_GE_ORDER_DATE';
133 -- Mod Project
134 c_hmod_no_cancel_shp_complt CONSTANT VARCHAR2(30) := 'C_HMOD_NO_CANCEL_SHP_COMPLT';
135 c_lmod_no_cancel_shp_complt CONSTANT VARCHAR2(30) := 'C_LMOD_NO_CANCEL_SHP_COMPLT';
136 c_smod_no_cancel_shp_complt CONSTANT VARCHAR2(30) := 'C_SMOD_NO_CANCEL_SHP_COMPLT';
137 
138 --<Bug 16474640>
139 c_validate_mod_number CONSTANT VARCHAR2(30) := 'C_VALIDATE_MOD_NUMBER';
140 
141 -- For CLM Project
142 c_ord_st_dt_gt_effec_dt CONSTANT VARCHAR2(30) := 'C_ORD_ST_DT_GT_EFFEC_DT';
143 c_max_ceil_awd_amt_gt_min CONSTANT VARCHAR2(30) := 'C_MAX_CEIL_AWD_AMT_GT_MIN';
144 c_max_ceil_amt_gt_min_ord CONSTANT VARCHAR2(30) := 'C_MAX_CEIL_AMT_GT_MIN_ORD';
145 c_max_ceil_amt_gt_max_ord CONSTANT VARCHAR2(30) := 'C_MAX_CEIL_AMT_GT_MAX_ORD';
146 c_max_ord_amt_gt_min CONSTANT VARCHAR2(30) := 'C_MAX_ORD_AMT_GT_MIN';
147 c_min_guar_perc_range_check CONSTANT VARCHAR2(30) := 'C_MIN_GUAR_PERC_RANGE_CHECK';
148 c_print_form_format_valid CONSTANT VARCHAR2(30) := 'C_PRINT_FORM_FORMAT_VALID';
149 
150 --CLM PDOI Integration
151 c_validate_clm_standard_form CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_STANDARD_FORM';
152 c_validate_clm_document_format CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_DOCUMENT_FORMAT';
153 c_validate_source_idv CONSTANT VARCHAR2(30) := 'C_VALIDATE_SOURCE_IDV';
154 c_validate_award_admin CONSTANT VARCHAR2(30) := 'C_VALIDATE_AWARD_ADMIN';
155 c_validate_contract_officer CONSTANT VARCHAR2(30) := 'C_CLM_CONTRACT_OFFICER';
156 c_validate_umbrella_program_id CONSTANT VARCHAR2(30) := 'C_UMBRELLA_PROGRAM_ID';
157 c_validate_clm_award_type CONSTANT VARCHAR2(30) := 'C_CLM_AWARD_TYPE';
158 c_validate_style_id CONSTANT VARCHAR2(30) := 'C_VALIDATE_STYLE_ID';
159 c_validate_idv_style_id CONSTANT VARCHAR2(30) := 'C_VALIDATE_IDV_STYLE_ID';
160 c_val_po_idv_vendor_site_id CONSTANT VARCHAR2(30) := 'C_VAL_PO_IDV_VENDOR_SITE_ID';
161 c_validate_po_idv_vendor_id CONSTANT VARCHAR2(30) := 'C_VALIDATE_PO_IDV_VENDOR_ID';
162 
163 
164 
165 
166   --------------------------------------------------------------
167   -- PDOI Header Validation Subroutine Constants
168   --------------------------------------------------------------
169   c_po_header_id CONSTANT VARCHAR2(30) := 'C_PO_HEADER_ID';
170   c_end_date CONSTANT VARCHAR2(30) := 'C_END_DATE';
171   c_type_lookup_code CONSTANT VARCHAR2(30) := 'C_TYPE_LOOKUP_CODE';
172   c_revision_num CONSTANT VARCHAR2(30) := 'C_REVISION_NUM';
173   c_document_num CONSTANT VARCHAR2(30) := 'C_DOCUMENT_NUM';
174   c_currency_code CONSTANT VARCHAR2(30) := 'C_CURRENCY_CODE';
175   c_rate_info CONSTANT VARCHAR2(30) := 'C_RATE_INFO';
176   c_agent_id CONSTANT VARCHAR2(30) := 'C_AGENT_ID';
177   c_vendor_info CONSTANT VARCHAR2(30) := 'C_VENDOR_INFO';
178   c_ship_to_location_id CONSTANT VARCHAR2(30) := 'C_SHIP_TO_LOCATION_ID';
179   c_bill_to_location_id CONSTANT VARCHAR2(30) := 'C_BILL_TO_LOCATION_ID';
180   c_last_updated_by CONSTANT VARCHAR2(30) := 'C_LAST_UPDATED_BY';
181   c_last_update_date CONSTANT VARCHAR2(30) := 'C_LAST_UPDATE_DATE';
182   c_release_num CONSTANT VARCHAR2(30) := 'C_RELEASE_NUM';
183   c_po_release_id CONSTANT VARCHAR2(30) := 'C_PO_RELEASE_ID';
184   c_release_date CONSTANT VARCHAR2(30) := 'C_RELEASE_DATE';
185   c_revised_date CONSTANT VARCHAR2(30) := 'C_REVISED_DATE';
186   c_printed_date CONSTANT VARCHAR2(30) := 'C_PRINTED_DATE';
187   c_closed_date CONSTANT VARCHAR2(30) := 'C_CLOSED_DATE';
188   c_terms_id_header CONSTANT VARCHAR2(30) := 'C_TERMS_ID_HEADERS';
189   c_ship_via_lookup_code CONSTANT VARCHAR2(30) := 'C_SHIP_VIA_LOOKUP_CODE';
190   c_fob_lookup_code CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE';
191   c_freight_terms_lookup_code CONSTANT VARCHAR2(30) := 'C_FREIGHT_TERMS_LOOKUP_CODE';
192   c_shipping_control CONSTANT VARCHAR2(30) := 'C_SHIPPING_CONTROL';
193   c_approval_status CONSTANT VARCHAR2(30) := 'C_APPROVAL_STATUS';
194   c_acceptance_required_flag CONSTANT VARCHAR2(30) := 'C_ACCEPTANCE_REQUIRED_FLAG';
195   c_confirming_order_flag CONSTANT VARCHAR2(30) := 'C_CONFIRMING_ORDER_FLAG';
196   c_acceptance_due_date CONSTANT VARCHAR2(30) := 'C_ACCEPTANCE_DUE_DATE';
197   c_amount_agreed CONSTANT VARCHAR2(30) := 'C_AMOUNT_AGREED';
198   c_firm_status_lookup_header CONSTANT VARCHAR2(30) := 'C_FIRM_STATUS_LOOKUP_HEADER';
199   c_cancel_flag CONSTANT VARCHAR2(30) := 'C_CANCEL_FLAG';
200   c_closed_code CONSTANT VARCHAR2(30) := 'C_CLOSED_CODE';
201   c_print_count CONSTANT VARCHAR2(30) := 'C_PRINT_COUNT';
202   c_frozen_flag CONSTANT VARCHAR2(30) := 'C_FROZEN_FLAG';
203   c_amount_to_encumber CONSTANT VARCHAR2(30) := 'C_AMOUNT_TO_ENCUMBER';
204   c_quote_warning_delay CONSTANT VARCHAR2(30) := 'C_QUOTE_WARNING_DELAY';
205   c_approval_required_flag CONSTANT VARCHAR2(30) := 'C_APPROVAL_REQUIRED_FLAG';
206   c_style_id CONSTANT VARCHAR2(30) := 'C_STYLE_ID';
207   c_amount_limit CONSTANT VARCHAR2(30) := 'C_AMOUNT_LIMIT';
208   c_advance_amount CONSTANT VARCHAR2(30) := 'C_ADVANCE_AMOUNT';
209 
210 --------------------------------------------------------------------------
211 -- Line Validation Constants
212 --------------------------------------------------------------------------
213 -- Common
214 c_src_doc_line_not_null CONSTANT VARCHAR2(30) := 'C_SRC_DOC_LINE_NOT_NULL';
215 c_validate_category CONSTANT VARCHAR2(30) := 'C_VALIDATE_CATEGORY';  --bug 8633959
216 -- Orders
217 c_amt_agreed_ge_zero CONSTANT VARCHAR2(30) := 'C_AMT_AGREED_GE_ZERO';
218 c_min_rel_amt_ge_zero CONSTANT VARCHAR2(30) := 'C_MIN_REL_AMT_GE_ZERO';
219 c_line_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GT_ZERO';
220 -- <Complex Work R12>: Consolidated qty billed/rcvd checks into exec check
221 c_line_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GE_QTY_EXEC';
222 c_line_qty_ge_qty_enc CONSTANT VARCHAR2(30) := 'C_LINE_QTY_GE_QTY_ENC';
223 c_quantity_notif_change CONSTANT VARCHAR2(30) := 'C_QUANTITY_NOTIF_CHANGE';
224 c_line_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GT_ZERO';
225 -- <Complex Work R12>: Consolidated amt billed/rcvd checks into exec check
226 c_line_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GE_AMT_EXEC';
227 c_line_amt_ge_timecard CONSTANT VARCHAR2(30) := 'C_LINE_AMT_GE_TIMECARD';
228 c_line_num_unique CONSTANT VARCHAR2(30) := 'C_LINE_NUM_UNIQUE';
229 c_line_num_gt_zero CONSTANT VARCHAR2(30) := 'C_LINE_NUM_GT_ZERO';
230 c_vmi_asl_exists CONSTANT VARCHAR2(30) := 'C_VMI_ASL_EXISTS';
231 c_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_START_DATE_LE_END_DATE';
232 c_otl_inv_start_date_change CONSTANT VARCHAR2(30) := 'C_OTL_INV_START_DATE_CHANGE';
233 c_otl_inv_end_date_change CONSTANT VARCHAR2(30) := 'C_OTL_INV_END_DATE_CHANGE';
234 c_unit_price_ge_zero CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE_GE_ZERO';
235 c_list_price_ge_zero CONSTANT VARCHAR2(30) := 'C_LIST_PRICE_GE_ZERO';
236 c_market_price_ge_zero CONSTANT VARCHAR2(30) := 'C_MARKET_PRICE_GE_ZERO';
237 c_validate_unit_price_change CONSTANT VARCHAR2(30) := 'C_VALIDATE_UNIT_PRICE_CHANGE';
238 -- Agreements
239 c_expiration_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_EXPIRATION_GE_BLANKET_START';
240 c_expiration_le_blanket_end CONSTANT VARCHAR2(30) := 'C_EXPIRATION_LE_BLANKET_END';
241 -- <Complex Work R12 Start>
242 c_qty_ge_qty_milestone_exec CONSTANT VARCHAR2(30) := 'C_QTY_GE_QTY_MILESTONE_EXEC';
243 c_price_ge_price_mstone_exec CONSTANT VARCHAR2(30) := 'C_PRICE_GE_PRICE_MSTONE_EXEC';
244 c_recoupment_rate_range_check CONSTANT VARCHAR2(30) := 'C_RECOUPMENT_RATE_RANGE_CHECK'; -- Bug 5072189
245 c_retainage_rate_range_check CONSTANT VARCHAR2(30) := 'C_RETAINAGE_RATE_RANGE_CHECK'; -- Bug 5072189
246 c_prog_pay_rate_range_check CONSTANT VARCHAR2(30) := 'C_PROG_PAY_RATE_RANGE_CHECK'; -- Bug 5072189
247 c_max_retain_amt_ge_zero CONSTANT VARCHAR2(30) := 'C_MAX_RETAIN_AMT_GE_ZERO'; -- Bug 5221843
248 c_max_retain_amt_ge_retained CONSTANT VARCHAR2(30) := 'C_MAX_RETAIN_AMT_LE_RETAINED'; -- Bug 5453079
249 -- <Complex Work R12 End>
250 c_unit_meas_not_null CONSTANT VARCHAR2(30) := 'C_UNIT_MEAS_NOT_NULL';
251 c_item_description_not_null CONSTANT VARCHAR2(30) := 'C_ITEM_DESCRIPTION_NOT_NULL';
252 c_category_id_not_null CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_NOT_NULL';
253 c_item_id_not_null CONSTANT VARCHAR2(30) := 'C_ITEM_ID_NOT_NULL';
254 c_temp_labor_job_id_not_null CONSTANT VARCHAR2(30) := 'C_TEMP_LABOR_JOB_ID_NOT_NULL';
255 c_line_type_id_not_null CONSTANT VARCHAR2(30) := 'C_LINE_TYPE_ID_NOT_NULL';
256 c_temp_lbr_start_date_not_null CONSTANT VARCHAR2(30) := 'C_TEMP_LBR_START_DATE_NOT_NULL';
257 -- OPM Integration R12
258 c_line_sec_qty_gt_zero   CONSTANT VARCHAR2(30) :=  'C_LINE_SEC_QTY_GT_ZERO';
259 c_line_qtys_within_deviation CONSTANT VARCHAR2(30) := 'C_LINE_QTYS_WITHIN_DEVIATION';
260 c_from_line_id_not_null CONSTANT VARCHAR2(30) := 'C_FROM_LINE_ID_NOT_NULL';
261 c_amt_ge_advance_amt CONSTANT VARCHAR2(30) := 'C_AMT_GE_ADVANCE_AMT'; -- Bug 5446881
262 c_option_from_date_not_null CONSTANT VARCHAR2(30) := 'C_OPTION_FROM_DATE_NOT_NULL';	-- CLM Changes
263 c_option_to_date_not_null CONSTANT VARCHAR2(30) := 'C_OPTION_TO_DATE_NOT_NULL';		-- CLM Changes
264 c_line_num_disp_check CONSTANT VARCHAR2(30) := 'C_LINE_NUM_DISP_CHECK';			-- CLM Changes
265 c_option_to_date_le_from_date CONSTANT VARCHAR2(30) := 'C_OPTION_TO_DATE_LE_FROM_DATE';	-- CLM Changes
266 c_option_from_date_le_sysdate CONSTANT VARCHAR2(30) := 'C_OPTION_FROM_DATE_LE_SYSDATE';	-- CLM Changes
267 c_option_fm_date_le_ex_date CONSTANT VARCHAR2(30) := 'C_OPTION_FM_DATE_LE_EX_DATE';	-- CLM Changes
268 c_clin_slin_num_check CONSTANT VARCHAR2(30) := 'C_CLIN_SLIN_NUM_CHECK';
269 
270 -- For Fed Fields
271 c_order_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_ORDER_START_DATE_LE_END_DATE';
272 c_order_start_date_gt_sysdate CONSTANT VARCHAR2(30) := 'C_ORDER_START_DATE_GT_SYSDATE';
273 c_max_tot_amt_le_line_tot_amt CONSTANT VARCHAR2(30) := 'C_MAX_TOT_AMT_LE_LINE_TOT_AMT';
274 c_max_tot_amt_ge_min_tot_amt CONSTANT VARCHAR2(30) := 'C_MAX_TOT_AMT_GE_MIN_TOT_AMT';
275 c_max_tot_qty_le_line_tot_qty CONSTANT VARCHAR2(30) := 'C_MAX_TOT_QTY_LE_LINE_TOT_QTY';
276 c_max_tot_qty_ge_min_tot_qty CONSTANT VARCHAR2(30) := 'C_MAX_TOT_QTY_GE_MIN_TOT_QTY';
277 c_max_ord_amt_le_max_tot_amt CONSTANT VARCHAR2(30) := 'C_MAX_ORD_AMT_LE_MAX_TOT_AMT';
278 c_max_ord_amt_ge_min_ord_amt CONSTANT VARCHAR2(30) := 'C_MAX_ORD_AMT_GE_MIN_ORD_AMT';
279 c_max_ord_qty_le_max_tot_qty CONSTANT VARCHAR2(30) := 'C_MAX_ORD_QTY_LE_MAX_TOT_QTY';
280 c_max_ord_qty_ge_min_ord_qty CONSTANT VARCHAR2(30) := 'C_MAX_ORD_QTY_GE_MIN_ORD_QTY';
281 
282   ------------------------------------------------
283   -- PDOI Line Validation constants
284   -------------------------------------------------------------------
285   c_over_tolerance_error_flag CONSTANT VARCHAR2(30) := 'C_OVER_TOLERANCE_ERROR_FLAG';
286   c_expiration_date_blanket CONSTANT VARCHAR2(30) := 'C_EXPIRATION_DATE_BLANKET';
287   c_global_agreement_flag CONSTANT VARCHAR2(30) := 'C_GLOBAL_AGREEMENT_FLAG';
288   c_amount_blanket CONSTANT VARCHAR2(30) := 'C_AMOUNT_BLANKET';
289   c_order_type_lookup_code CONSTANT VARCHAR2(30) := 'C_ORDER_TYPE_LOOKUP_CODE';
290   c_contractor_name CONSTANT VARCHAR2(30) := 'C_CONTRACTOR_NAME';
291   c_job_id CONSTANT VARCHAR2(30) := 'C_JOB_ID';
292   c_job_business_group_id CONSTANT VARCHAR2(30) := 'C_JOB_BUSINESS_GROUP_ID';
293   c_capital_expense_flag CONSTANT VARCHAR2(30) := 'C_CAPITAL_EXPENSE_FLAG';
294   c_un_number_id CONSTANT VARCHAR2(30) := 'C_UN_NUMBER_ID';
295   c_hazard_class_id CONSTANT VARCHAR2(30) := 'C_HAZARD_CLASS_ID';
296   c_item_id CONSTANT VARCHAR2(30) := 'C_ITEM_ID';
297   c_item_description CONSTANT VARCHAR2(30) := 'C_ITEM_DESCRIPTION';
298   c_unit_meas_lookup_code CONSTANT VARCHAR2(30) := 'C_UNIT_MEAS_LOOKUP_CODE';
299   c_item_revision CONSTANT VARCHAR2(30) := 'C_ITEM_REVISION';
300   c_category_id CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID';
301   c_category_id_null CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_NULL';
302   c_ip_category_id CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID';
303   c_unit_price CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE';
304   c_quantity CONSTANT VARCHAR2(30) := 'C_QUANTITY';
305   c_amount CONSTANT VARCHAR2(30) := 'C_AMOUNT';
306   c_rate_type CONSTANT VARCHAR2(30) := 'C_RATE_TYPE';
307   c_line_num CONSTANT VARCHAR2(30) := 'C_LINE_NUM';
308   c_po_line_id CONSTANT VARCHAR2(30) := 'C_PO_LINE_ID';
309   c_line_type_id CONSTANT VARCHAR2(30) := 'C_LINE_TYPE_ID';
310   c_price_type_lookup_code CONSTANT VARCHAR2(30) := 'C_PRICE_TYPE_LOOKUP_CODE';
311   c_start_date_standard CONSTANT VARCHAR2(30) := 'C_START_DATE_STANDARD';
312   c_item_id_standard CONSTANT VARCHAR2(30) := 'C_ITEM_ID_STANDARD';
313   c_quantity_standard CONSTANT VARCHAR2(30) := 'C_QUANTITY_STANDARD';
314   c_amount_standard CONSTANT VARCHAR2(30) := 'C_AMOUNT_STANDARD';
315   c_price_break_lookup_code CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_LOOKUP_CODE';
316   c_not_to_exceed_price CONSTANT VARCHAR2(30) := 'C_NOT_TO_EXCEED_PRICE';
317   c_release_num_null CONSTANT VARCHAR2(30) := 'C_RELEASE_NUM_NULL';
318   c_po_release_id_null CONSTANT VARCHAR2(30) := 'C_PO_RELEASE_ID_NULL';
319   c_source_shipment_id_null CONSTANT VARCHAR2(30) := 'C_SOURCE_SHIPMENT_ID_NULL';
320   c_contract_num_null CONSTANT VARCHAR2(30) := 'C_CONTRACT_NUM_NULL';
321   c_contract_id_null CONSTANT VARCHAR2(30) := 'C_CONTRACT_ID_NULL';
322   c_type_1099_null CONSTANT VARCHAR2(30) := 'C_TYPE_1099_NULL';
323   c_closed_code_null CONSTANT VARCHAR2(30) := 'C_CLOSED_CODE_NULL';
324   c_closed_date_null CONSTANT VARCHAR2(30) := 'C_CLOSED_DATE_NULL';
325   c_closed_by_null CONSTANT VARCHAR2(30) := 'C_CLOSED_BY_NULL';
326   c_committed_amount_null CONSTANT VARCHAR2(30) := 'C_COMMITTED_AMOUNT_NULL';
327   c_allow_price_override_null CONSTANT VARCHAR2(30) := 'C_ALLOW_PRICE_OVERRIDE_NULL';
328   c_negotiated_by_preparer_null CONSTANT VARCHAR2(30) := 'C_NEGOTIATED_BY_PREPARER_NULL';
329   c_capital_expense_flag_null CONSTANT VARCHAR2(30) := 'C_CAPTIAL_EXPENSE_FLAG_NULL';
330   c_min_release_amount_null CONSTANT VARCHAR2(30) := 'C_MIN_RELEASE_AMOUNT_NULL';
331   c_market_price_null CONSTANT VARCHAR2(30) := 'C_MARKET_PRICE_NULL';
332   c_ip_category_id_null CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID_NULL';
333   c_uom_update CONSTANT VARCHAR2(30) := 'C_UOM_UPDATE';
334   c_item_desc_update CONSTANT VARCHAR2(30) := 'C_ITEM_DESC_UPDATE';
335   c_ip_category_id_update CONSTANT VARCHAR2(30) := 'C_IP_CATEGORY_ID_UPDATE';
336   c_line_secondary_uom CONSTANT VARCHAR2(30) := 'C_LINE_SECONDARY_UOM';
337   c_line_secondary_quantity CONSTANT VARCHAR2(30) := 'C_LINE_SECONDARY_QUANTITY';
338   c_line_preferred_grade CONSTANT VARCHAR2(30) := 'C_LINE_PREFERRED_GRADE';
339   c_line_style_related_info CONSTANT VARCHAR2(30) := 'C_LINE_STYLE_RELATED_INFO';
340   c_negotiated_by_preparer CONSTANT VARCHAR2(30) := 'C_NEGOTIATED_BY_PREPARER';
341   c_negotiated_by_prep_update CONSTANT VARCHAR2(50) := 'C_NEGOTIATED_BY_PREPARER_UPDATE';
342   c_category_id_update CONSTANT VARCHAR2(30) := 'C_CATEGORY_ID_UPDATE';
343   c_unit_price_update CONSTANT VARCHAR2(30) := 'C_UNIT_PRICE_UPDATE';
344   c_amount_update CONSTANT VARCHAR2(30) := 'C_AMOUNT_UPDATE';
345   -- <PDOI for Complex PO Project: Start>
346   c_pdoi_qty_ge_qty_mstone_exec CONSTANT VARCHAR2(30) := 'C_PDOI_QTY_GE_QTY_MSTONE_EXEC';
347   c_pdoi_prc_ge_prc_mstone_exec CONSTANT VARCHAR2(30) := 'C_PDOI_PRC_GE_PRC_MSTONE_EXEC';
348   c_pdoi_recoupment_range_check CONSTANT VARCHAR2(30) := 'C_PDOI_RECOUPMENT_RANGE_CHECK';
349   c_pdoi_retainage_range_check CONSTANT VARCHAR2(30) := 'C_PDOI_RETAINAGE_RANGE_CHECK';
350   c_pdoi_prog_pay_range_check CONSTANT VARCHAR2(30) := 'C_PDOI_PROG_PAY_RANGE_CHECK';
351   c_pdoi_max_retain_amt_ge_zero CONSTANT VARCHAR2(30) := 'C_PDOI_MAX_RETAIN_AMT_GE_ZERO';
352   c_pdoi_max_retain_amt_ge_retnd CONSTANT VARCHAR2(30) := 'C_PDOI_MAX_RETAIN_AMT_GE_RETND';
353   c_pdoi_amt_ge_line_advance_amt CONSTANT VARCHAR2(30) := 'C_PDOI_AMT_GE_LINE_ADVANCE_AMT';
354   c_pdoi_complex_po_att_check CONSTANT VARCHAR2(30) := 'C_PDOI_COMPLEX_PO_ATT_CHECK';
355   -- <PDOI for Complex PO Project: End>
356 
357   --PDOI CLM Integration
358   c_pdoi_clin_slin_structure  CONSTANT VARCHAR2(30) := 'C_PDOI_CLIN_SLIN_STRUCTURE';
359   c_validate_contract_type CONSTANT VARCHAR2(30) := 'C_VALIDATE_CONTRACT_TYPE';
360   c_validate_option_indicator CONSTANT VARCHAR2(30) := 'C_VALIDATE_OPTION_INDICATOR';
361   c_validate_clm_base_line_num CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_BASE_LINE_NUM';
362   c_validate_clm_option_num CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_OPTION_NUM';
363   c_validate_clm_idc_type  CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_IDC_TYPE';
364   c_validate_clin_line_num_disp CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLIN_LINE_NUM_DISP';
365   c_idv_reference_equal_check CONSTANT VARCHAR2(30) := 'C_IDV_REFERENCE_EQUAL_CHECK';
366   c_validate_clm_line_type_id CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_LINE_TYPE_ID';
367 --------------------------------------------------------------------------
368 -- Shipment Validation Constants
369 --------------------------------------------------------------------------
370 c_days_early_gte_zero CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_GTE_ZERO';
371 c_days_late_gte_zero CONSTANT VARCHAR2(30) := 'C_DAYS_LATE_GTE_ZERO';
372 c_rcv_close_tol_within_range CONSTANT VARCHAR2(30) := 'C_RCV_CLOSE_TOL_WITHIN_RANGE';
373 c_over_rcpt_tol_within_range CONSTANT VARCHAR2(30) := 'C_OVER_RCPT_TOL_WITHIN_RANGE';
374 c_match_4way_check CONSTANT VARCHAR2(30) := 'C_MATCH_4WAY_CHECK';
375 c_inv_close_tol_range_check CONSTANT VARCHAR2(30) := 'C_INV_CLOSE_TOL_RANGE_CHECK';
376 c_need_by_date_open_per_check CONSTANT VARCHAR2(30) := 'C_NEED_BY_DATE_OPEN_PER_CHECK';
377 c_promise_date_open_per_check CONSTANT VARCHAR2(30) := 'C_PROMISE_DATE_OPEN_PER_CHECK';
378 c_ship_to_org_null_check CONSTANT VARCHAR2(30) := 'C_SHIP_TO_ORG_NULL_CHECK';
379 c_ship_to_loc_null_check CONSTANT VARCHAR2(30) := 'C_SHIP_TO_LOC_NULL_CHECK';
380 c_ship_num_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_NUM_GT_ZERO';
381 c_ship_num_unique_check CONSTANT VARCHAR2(30) := 'C_SHIP_NUM_UNIQUE_CHECK';
382 c_is_org_in_current_sob_check CONSTANT VARCHAR2(30) := 'C_IS_ORG_IN_CURRENT_SOB_CHECK';
383 c_ship_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_QTY_GT_ZERO';
384 -- <Complex Work R12>: Consolidated qty billed/rcvd checks into exec check
385 c_ship_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_SHIP_QTY_GE_QTY_EXEC';
386 c_ship_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_SHIP_AMT_GT_ZERO';
387 -- <Complex Work R12>: Consolidated amt billed/rcvd checks into exec check
388 c_ship_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_SHIP_AMT_GE_AMT_EXEC';
389 -- OPM Integration R12
390 c_ship_sec_qty_gt_zero   CONSTANT VARCHAR2(30) :=  'C_SHIP_SEC_QTY_GT_ZERO';
391 c_ship_qtys_within_deviation CONSTANT VARCHAR2(30) := 'C_SHIP_QTYS_WITHIN_DEVIATION';
392 c_unit_of_measure_not_null CONSTANT VARCHAR2(30) := 'C_UNIT_OF_MEAS_NOT_NULL'; -- Bug 5385686
393 
394 -- For PO Fed Fields CLM
395 c_pop_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_POP_START_DATE_LE_END_DATE';
396 c_pop_date_need_by_date CONSTANT VARCHAR2(30) := 'C_POP_DATE_NEED_BY_DATE';
397 c_complex_price_or_gt_zero CONSTANT VARCHAR2(30) := 'C_COMPLEX_PRICE_OR_GT_ZERO';
398 
399 
400 
401   ------------------------------------------------------------------
402   -- PDOI Shipment Validation Subroutine Constants
403   ------------------------------------------------------------------
404   c_shipment_need_by_date CONSTANT VARCHAR2(30) := 'C_SHIPMENT_NEED_BY_DATE';
405   c_shipment_promised_date CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PROMISED_DATE';
406   c_shipment_type_blanket CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_BLANKET';
407   c_shipment_type_standard CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_STANDARD';
408   c_shipment_type_quotation CONSTANT VARCHAR2(30) := 'C_SHIPMENT_TYPE_QUOTATION';
409   c_shipment_num CONSTANT VARCHAR2(30) := 'C_SHIPMENT_NUM';
410   c_shipment_quantity CONSTANT VARCHAR2(30) := 'C_SHIPMENT_QUANTITY';
411   c_shipment_price_override CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PRICE_OVERRIDE';
412   c_shipment_price_discount CONSTANT VARCHAR2(30) := 'C_SHIPMENT_PRICE_DISCOUNT';
413   c_ship_to_organization_id CONSTANT VARCHAR2(30) := 'C_SHIP_TO_ORGANIZATION_ID';
414   c_shipment_effective_dates CONSTANT VARCHAR2(30) := 'C_SHIPMENT_EFFECTIVE_DATES';
415   c_qty_rcv_exception_code CONSTANT VARCHAR2(30) := 'C_QTY_RCV_EXCEPTION_CODE';
416   c_enforce_ship_to_loc_code CONSTANT VARCHAR2(30) := 'C_ENFORCE_SHIP_TO_LOC_CODE';
417   c_allow_sub_receipts_flag CONSTANT VARCHAR2(30) := 'C_ALLOW_SUB_RECEIPTS_FLAG';
418   c_days_early_receipt_allowed CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_RECEIPT_ALLOWD';
419   c_receipt_days_exception_code CONSTANT VARCHAR2(30) := 'C_RECEIPT_DAYS_EXCEPTION_CODE';
420   c_invoice_close_tolerance CONSTANT VARCHAR2(30) := 'C_INVOICE_CLOSE_TOLERANCE';
421   c_receive_close_tolerance CONSTANT VARCHAR2(30) := 'C_RECEIVE_CLOSE_TOLERANCE';
422   c_receiving_routing_id CONSTANT VARCHAR2(30) := 'C_RECEIVING_ROUTING_ID';
423   c_accrue_on_receipt_flag CONSTANT VARCHAR2(30) := 'C_ACCRUE_ON_RECEIPT_FLAG';
424   c_terms_id_line_loc CONSTANT VARCHAR2(30) := 'C_TERMS_ID_LINE_LOC';
425   c_need_by_date_null CONSTANT VARCHAR2(30) := 'C_NEED_BY_DATE_NULL';
426   c_firm_flag_null CONSTANT VARCHAR2(30) := 'C_FIRM_FLAG_NULL';
427   c_promised_date_null CONSTANT VARCHAR2(30) := 'C_PROMISED_DATE_NULL';
428   c_over_tolerance_err_flag_null CONSTANT VARCHAR2(30) := 'C_OVER_TOLERANCE_ERR_FLAG_NULL';
429   c_qty_rcv_tolerance_null CONSTANT VARCHAR2(30) := 'C_QTY_RCV_TOLERANCE_NULL';
430   c_qty_rcv_exception_code_null CONSTANT VARCHAR2(30) := 'C_QTY_RCV_EXCEPTION_CODE_NULL';
431   c_receipt_required_flag_null CONSTANT VARCHAR2(30) := 'C_RECEIPT_REQUIRED_FLAG_NULL';
432   c_inspection_reqd_flag_null CONSTANT VARCHAR2(30) := 'C_INSPECTION_REQD_FLAG_NULL';
433   c_receipt_days_exception_null CONSTANT VARCHAR2(30) := 'C_RECEIPT_DATES_EXCEPTION_NULL';
434   c_invoice_close_toler_null CONSTANT VARCHAR2(30) := 'C_INVOICE_CLOSE_TOLER_NULL';
435   c_receive_close_toler_null CONSTANT VARCHAR2(30) := 'C_RECEIVE_CLOSE_TOLER_NULL';
436   c_days_early_rcpt_allowed_null CONSTANT VARCHAR2(30) := 'C_DAYS_EARLY_RCPT_ALLOWED_NULL';
437   c_days_late_rcpt_allowed_null CONSTANT VARCHAR2(30) := 'C_DAYS_LATE_RCPT_ALLOWED_NULL';
438   c_enfrce_ship_to_loc_code_null CONSTANT VARCHAR2(30) := 'C_ENFRCE_SHIP_TO_LOC_CODE_NULL';
439   c_allow_sub_receipts_flag_null CONSTANT VARCHAR2(30) := 'C_ALLOW_SUB_RECEIPTS_FLAG_NULL';
440   c_receiving_routing_null CONSTANT VARCHAR2(30) := 'C_RECEIVING_ROUTING_NULL';
441   c_line_loc_secondary_uom CONSTANT VARCHAR2(30) := 'C_LINE_LOC_SECONDARY_UOM';
442   c_line_loc_secondary_quantity CONSTANT VARCHAR2(30) := 'C_LINE_LOC_SECONDARY_QUANTITY';
443   c_line_loc_preferred_grade CONSTANT VARCHAR2(30) := 'C_LINE_LOC_PREFERRED_GRADE';
444   c_line_loc_style_related_info CONSTANT VARCHAR2(30) := 'C_LINE_LOC_STYLE_RELATED_INFO';
445   c_price_break CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK';
446   c_tax_name CONSTANT VARCHAR2(30) := 'C_TAX_NAME';
447   c_fob_lookup_code_line_loc CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE_LINE_LOC';
448   c_freight_terms_line_loc CONSTANT VARCHAR2(40) := 'C_FREIGHT_TERMS_LOOKUP_LINE_LOC';
449   c_freight_carrier_line_loc CONSTANT VARCHAR2(30) := 'C_FREIGHT_CARRIER_LINE_LOC';
450   c_freight_carrier_null CONSTANT VARCHAR2(30) := 'C_FREIGHT_CARRIER_NULL';
451   c_fob_lookup_code_null CONSTANT VARCHAR2(30) := 'C_FOB_LOOKUP_CODE_NULL';
452   c_freight_terms_lookup_null CONSTANT VARCHAR2(30) := 'C_FREIGHT_TERMS_LOOKUP_NULL';
453   -- <PDOI for Complex PO Project: Start>
454   c_pdoi_amt_ge_ship_advance_amt CONSTANT VARCHAR2(30) := 'C_PDOI_AMT_GE_SHIP_ADVANCE_AMT';
455   c_pdoi_shipment_amount CONSTANT VARCHAR2(30) := 'C_PDOI_SHIPMENT_AMOUNT';
456   c_pdoi_payment_type CONSTANT VARCHAR2(30) := 'C_PDOI_PAYMENT_TYPE';
457   -- <PDOI for Complex PO Project: End>
458 
459   --PDOI CLM Integration
460   c_pdoi_check_clin_slin_funding CONSTANT VARCHAR2(30) := 'C_PDOI_CHECK_CLIN_SLIN_FUNDING';
461   c_validate_cost_constraint CONSTANT VARCHAR2(30) := 'C_VALIDATE_COST_CONSTRAINT';
462   c_check_contract_num_and_ver CONSTANT VARCHAR2(30) := 'C_CHECK_CONTRACT_NUM_AND_VER';
463   c_validate_clm_defence_funding CONSTANT VARCHAR2(30) := 'C_VALIDATE_CLM_DEFENCE_FUNDING';
464   c_validate_option_distribution CONSTANT VARCHAR2(30) := 'C_VALIDATE_OPTION_DISTRIBUTION';
465 --------------------------------------------------------------------------
466 -- Price Break Validation Constants
467 --------------------------------------------------------------------------
468 c_at_least_one_required_field CONSTANT VARCHAR2(30) := 'C_AT_LEAST_ONE_REQUIRED_FIELD';
469 c_price_discount_in_percent CONSTANT VARCHAR2(30) := 'C_PRICE_DISCOUNT_IN_PERCENT';
470 c_price_override_gt_zero CONSTANT VARCHAR2(30) := 'C_PRICE_OVERRIDE_GT_ZERO';
471 c_price_break_qty_ge_zero CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_QTY_GE_ZERO';
472 c_price_break_start_le_end CONSTANT VARCHAR2(30) := 'C_PRICE_BREAK_START_LE_END';
473 c_break_start_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_BREAK_START_GE_BLANKET_START';
474 c_break_start_le_blanket_end CONSTANT VARCHAR2(30) := 'C_BREAK_START_LE_BLANKET_END';
475 c_break_start_le_expiration CONSTANT VARCHAR2(30) := 'C_BREAK_START_LE_EXPIRATION';
476 c_break_end_le_expiration CONSTANT VARCHAR2(30) := 'C_BREAK_END_LE_EXPIRATION';
477 c_break_end_ge_blanket_start CONSTANT VARCHAR2(30) := 'C_BREAK_END_GE_BLANKET_START';
478 c_break_end_le_blanket_end CONSTANT VARCHAR2(30) := 'C_BREAK_END_LE_BLANKET_END';
479 
480 --------------------------------------------------------------------------
481 -- Distribution Validation Constants
482 --------------------------------------------------------------------------
483 c_dist_num_unique CONSTANT VARCHAR2(30) := 'C_DIST_NUM_UNIQUE';
484 c_dist_num_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_NUM_GT_ZERO';
485 c_dist_qty_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_QTY_GT_ZERO';
486 -- <Complex Work R12>: Combine del and billed into exec
487 c_dist_qty_ge_qty_exec CONSTANT VARCHAR2(30) := 'C_DIST_QTY_GE_QTY_EXEC';
488 c_dist_amt_gt_zero CONSTANT VARCHAR2(30) := 'C_DIST_AMT_GT_ZERO';
489 -- <Complex Work R12>: Combine del and billed into exec
490 c_dist_amt_ge_amt_exec CONSTANT VARCHAR2(30) := 'C_DIST_AMT_GE_AMT_EXEC';
491 c_pjm_unit_number_effective CONSTANT VARCHAR2(30) := 'C_PJM_UNIT_NUMBER_EFFECTIVE';
492 c_oop_enter_all_fields CONSTANT VARCHAR2(30) := 'C_OOP_ENTER_ALL_FIELDS';
493 -- Agreements
494 c_amount_to_encumber_ge_zero CONSTANT VARCHAR2(30) := 'C_AMOUNT_TO_ENCUMBER_GE_ZERO';
495 c_budget_account_id_not_null CONSTANT VARCHAR2(30) := 'C_BUDGET_ACCOUNT_ID_NOT_NULL';
496 c_gl_encumbered_date_not_null CONSTANT VARCHAR2(30) := 'C_GL_ENCUMBERED_DATE_NOT_NULL';
497 c_gl_enc_date_not_null_open CONSTANT VARCHAR2(30) := 'C_GL_ENC_DATE_NOT_NULL_OPEN';
498 c_gms_data_valid CONSTANT VARCHAR2(30) := 'C_GMS_DATA_VALID';
499 c_unencum_amt_le_amt_to_encum CONSTANT VARCHAR2(30) := 'C_UNENCUM_AMT_LE_AMT_TO_ENCUM';
500 
501 
502   c_dist_amount_ordered CONSTANT VARCHAR2(30) := 'C_DIST_AMOUNT_ORDERED';
503   c_dist_quantity_ordered CONSTANT VARCHAR2(30) := 'C_DIST_QUANTITY_ORDERED';
504   c_dist_destination_org_id CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_ORG_ID';
505   c_dist_deliver_to_location_id CONSTANT VARCHAR2(30) := 'C_DIST_DELIVER_TO_LOCATION_ID';
506   c_dist_deliver_to_person_id CONSTANT VARCHAR2(30) := 'C_DIST_DELIVER_TO_PERSON_ID';
507   c_dist_destination_type_code CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_TYPE_CODE';
508   c_dist_destination_subinv CONSTANT VARCHAR2(30) := 'C_DIST_DESTINATION_SUBINV';
509   c_dist_wip_entity_id CONSTANT VARCHAR2(30) := 'C_DIST_WIP_ENTITY_ID';
510   c_prevent_encumberance_flag CONSTANT VARCHAR2(30) := 'C_PREVENT_ENCUMBERANCE_FLAG';
511   c_charge_account_id CONSTANT VARCHAR2(30) := 'C_CHARGE_ACCOUNT_ID';
512   c_budget_account_id CONSTANT VARCHAR2(30) := 'C_BUDGET_ACCOUNT_ID';
513   c_accrual_account_id CONSTANT VARCHAR2(30) := 'C_ACCRUAL_ACCOUNT_ID';
514   c_variance_account_id CONSTANT VARCHAR2(30) := 'C_VARIANCE_ACCOUNT_ID';
515   c_project_acct_context CONSTANT VARCHAR2(30) := 'C_PROJECT_ACCT_CONTEXT';
516   c_project_info CONSTANT VARCHAR2(30) := 'C_PROJECT_INFO';
517   c_tax_recovery_override_flag CONSTANT VARCHAR2(30) := 'C_TAX_RECOVERY_OVERRIDE_FLAG';
518   c_check_fv_validations CONSTANT VARCHAR2(30) := 'C_CHECK_FV_VALIDATIONS';
519   c_check_proj_rel_validations CONSTANT VARCHAR2(30) := 'C_CHECK_PROJ_REL_VALIDATIONS'; -- Bug 5442682
520   -- ACRN proj
521   c_ACRN_value_valid CONSTANT VARCHAR2(30) := 'C_ACRN_VALUE_VALID';
522   /* CLM Partial Funding Changes -- START */
523   c_partial_funded_flag CONSTANT VARCHAR2(30) := 'C_PARTIAL_FUNDED_FLAG';
524   c_fund_value_ge_zero CONSTANT VARCHAR2(30) := 'C_FUND_VALUE_GE_ZERO';
525   c_fund_value_le_tot_ord_value CONSTANT VARCHAR2(30) := 'C_FUND_VALUE_LE_TOT_ORD_VALUE';
526   c_qty_fund_ge_exc_qty CONSTANT VARCHAR2(30) := 'C_QTY_FUND_GE_EXC_QTY';
527   c_amt_fund_ge_exc_amt CONSTANT VARCHAR2(30) := 'C_AMT_FUND_GE_EXC_AMT';
528   c_fund_value_gt_backing_req CONSTANT VARCHAR2(30) := 'C_FUND_VALUE_GT_BACKING_REQ';
529   /* CLM Partial Funding Changes -- END */
530   c_funded_val_gt_req_funds_rmn CONSTANT VARCHAR2(30) := 'C_FUNDED_VAL_GT_REQ_FUNDS_RMN'; -- CLM-LnSc
531   c_par_dist_value_increased CONSTANT VARCHAR2(30) := 'C_PAR_DIST_VALUE_INCREASED'; -- PAR Project
532   c_par_line_comments_not_null CONSTANT VARCHAR2(30) := 'C_PAR_LINE_COMMENTS_NOT_NULL'; -- PAR PROJECT
533 
534 
535 --------------------------------------------------------------------------
536 -- Notification Control Validation Constants
537 --------------------------------------------------------------------------
538 c_notif_start_date_le_end_date CONSTANT VARCHAR2(30) := 'C_NOTIF_START_DATE_LE_END_DATE';
539 c_notif_percent_le_one_hundred CONSTANT VARCHAR2(30) := 'C_NOTIF_PERCENT_LE_ONE_HUNDRED';
540 c_notif_amount_gt_zero CONSTANT VARCHAR2(30) := 'C_NOTIF_AMOUNT_GT_ZERO';
541 c_notif_amount_not_null CONSTANT VARCHAR2(30) := 'C_NOTIF_AMOUNT_NOT_NULL';
542 c_notif_start_date_not_null CONSTANT VARCHAR2(30) := 'C_NOTIF_START_DATE_NOT_NULL';
543 
544 
545 --------------------------------------------------------------------------
546 -- GA Org Assignment Validation Constants
547 --------------------------------------------------------------------------
548 c_assign_purch_org_not_null CONSTANT VARCHAR2(30) := 'C_ASSIGN_PURCH_ORG_NOT_NULL';
549 c_assign_vendor_site_not_null CONSTANT VARCHAR2(30) := 'C_ASSIGN_VENDOR_SITE_NOT_NULL';
550 
551 
552 --------------------------------------------------------------------------
553 -- Price Differential Validation Constants
554 --------------------------------------------------------------------------
555 -- Common
556 c_unique_price_diff_num CONSTANT VARCHAR2(30) := 'C_UNIQUE_PRICE_DIFF_NUM';
557 c_price_diff_num_gt_zero CONSTANT VARCHAR2(30) := 'C_PRICE_DIFF_NUM_GT_ZERO';
558 c_unique_price_type CONSTANT VARCHAR2(30) := 'C_UNIQUE_PRICE_TYPE';
559 -- Agreements
560 c_max_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MAX_MUL_GE_ZERO';
561 c_max_mul_ge_min_mul CONSTANT VARCHAR2(30) := 'C_MAX_MUL_GE_MIN_MUL';
562 c_min_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MIN_MUL_GE_ZERO';
563 -- Orders
564 c_mul_ge_zero CONSTANT VARCHAR2(30) := 'C_MUL_GE_ZERO';
565 c_spo_price_type_on_src_doc CONSTANT VARCHAR2(30) := 'C_SPO_PRICE_TYPE_ON_SRC_DOC';
566 c_spo_mul_btwn_min_max CONSTANT VARCHAR2(30) := 'C_SPO_MUL_BTWN_MIN_MAX';
567 c_spo_mul_ge_min CONSTANT VARCHAR2(30) := 'C_SPO_MUL_GE_MIN';
568 
569   -------------------------------------------------------------
570   -- PDOI Price Differential Validation constants
571   -------------------------------------------------------------
572   c_price_type CONSTANT VARCHAR2(30) := 'C_PRICE_TYPE';
573   c_multiple_price_diff CONSTANT VARCHAR2(30) := 'C_MULTIPLE_PRICE_DIFF';
574   c_entity_type CONSTANT VARCHAR2(30) := 'C_ENTITY_TYPE';
575   c_multiplier CONSTANT VARCHAR2(30) := 'C_MULTIPLIER';
576   c_min_multiplier CONSTANT VARCHAR2(30) := 'C_MIN_MULTIPLIER';
577   c_max_multiplier CONSTANT VARCHAR2(30) := 'C_MAX_MULTIPLIER';
578   c_price_diff_style_info CONSTANT VARCHAR2(30) := 'C_PRICE_DIFF_STYLE_INFO';
579 
580 
581 
582 --------------------------------------------------------------------------
583 -- Used to validate that a change to the unit price is allowed.
584 --------------------------------------------------------------------------
585 c_no_dists_reserved CONSTANT VARCHAR2(30) := 'C_NO_DISTS_RESERVED';
586 c_accruals_allow_update CONSTANT VARCHAR2(30) := 'C_ACCRUALS_ALLOW_UPDATE';
587 c_no_timecards_exist CONSTANT VARCHAR2(30) := 'C_NO_TIMECARDS_EXIST';
588 c_no_pending_receipts CONSTANT VARCHAR2(30) := 'C_NO_PENDING_RECEIPTS';
589 c_retro_account_allows_update CONSTANT VARCHAR2(30) := 'C_RETRO_ACCOUNT_ALLOWS_UPDATE';
590 c_warn_amt_based_notif_ctrls CONSTANT VARCHAR2(30) := 'C_WARN_AMT_BASED_NOTIF_CTRLS';
591 
592 
593 --------------------------------------------------------------------------
594 -- Line Price Adjustments Validation Constants
595 --------------------------------------------------------------------------
596 c_change_reason_code_not_null CONSTANT VARCHAR2(30) := 'C_CHANGE_REASON_CODE_NOT_NULL';
597 c_change_reason_text_not_null CONSTANT VARCHAR2(30) := 'C_CHANGE_REASON_TEXT_NOT_NULL';
598 
599 --UCA Project - CLMR4 Changes Begin
600 -------------------------------------------------------------------------
601 --PO Line UCAS Validation Constants
602 -------------------------------------------------------------------------
603 c_lgl_le_nte  CONSTANT VARCHAR2(30) := 'C_LGL_LE_NTE';
604 c_undef_amt_le_nte  CONSTANT VARCHAR2(30) := 'C_UNDEF_AMT_LE_NTE';
605 c_undef_amt_le_line_amt  CONSTANT VARCHAR2(30) := 'C_UNDEF_AMT_LE_LINE_AMT';
606 c_undef_amt_gt_zero  CONSTANT VARCHAR2(30) := 'C_UNDEF_AMT_GT_ZERO';
607 c_lgl_gt_zero  CONSTANT VARCHAR2(30) := 'C_LGL_GT_ZERO';
608 c_nte_gt_zero  CONSTANT VARCHAR2(30) := 'C_NTE_GT_ZERO';
609 --c_pdd_ge_sysdate  CONSTANT VARCHAR2(30) := 'C_PDD_GE_SYSDATE';
610 
611 --UCA Project - CLMR4 Changes End
612 
613 c_validate_exhibit_name  CONSTANT VARCHAR2(30) := 'C_VALIDATE_EXHIBIT_NAME';
614 
615 ---------------------------------------------------------------
616 -- Validation Sets.
617 ---------------------------------------------------------------
618 
619 -- Validation set for HTML Orders headers.
620 c_html_order_header_vs CONSTANT PO_TBL_VARCHAR2000 :=
621   PO_TBL_VARCHAR2000(
622   -- Bug# 4779226 remove c_warn_supplier_on_hold from header check
623     c_rate_gt_zero
624   , c_rate_combination_valid
625   , c_doc_num_chars_valid
626   , c_doc_num_unique
627   , c_agent_id_not_null
628   , c_hdr_ship_to_loc_not_null
629   , c_fax_email_address_valid
630   , c_segment1_not_null
631   , c_ship_via_lookup_code_valid -- bug 9213424
632   , c_print_form_format_valid
633   , c_validate_mod_number        --<Bug 16474640>
634   );
635 
636 -- Validation set for HTML Orders lines.
637 c_html_order_line_vs CONSTANT PO_TBL_VARCHAR2000 :=
638   PO_TBL_VARCHAR2000(
639     c_amt_agreed_ge_zero
640   , c_min_rel_amt_ge_zero
641   , c_line_qty_gt_zero
642   , c_line_qty_ge_qty_exec  -- <Complex Work R12>: Consolidate rcvd/billed
643   -- < Bug:13503748 : Encumbrance ER Edit without unreserve>--
644   --, c_line_qty_ge_qty_enc
645   -- ECO# 4708990/4586199: Obsoleting some messages
646   --, c_quantity_notif_change
647   , c_line_amt_gt_zero
648   , c_line_amt_ge_amt_exec  -- <Complex Work R12>: Consolidate rcvd/billed
649   , c_line_amt_ge_timecard
650   , c_line_num_gt_zero
651   , c_line_num_unique
652   , c_validate_category  -- bug 8633959
653   -- Bug# 4634769: Do not do the vmi check any more, it is done in
654   -- submission check.
655   --, c_vmi_asl_exists
656   , c_start_date_le_end_date
657   , c_otl_inv_start_date_change
658   , c_otl_inv_end_date_change
659   , c_unit_price_ge_zero
660   , c_list_price_ge_zero
661   , c_market_price_ge_zero
662   , c_validate_unit_price_change
663   -- <Complex Work R12 Start>
664   , c_qty_ge_qty_milestone_exec
665   , c_price_ge_price_mstone_exec
666   , c_recoupment_rate_range_check   -- Bug 5072189
667   , c_retainage_rate_range_check   -- Bug 5072189
668   , c_prog_pay_rate_range_check   -- Bug 5072189
669   , c_max_retain_amt_ge_zero      --Bug 5221843
670   , c_max_retain_amt_ge_retained  --Bug 5453079
671   -- <Complex Work R12 End>
672   , c_item_id_not_null
673   , c_temp_labor_job_id_not_null
674   , c_category_id_not_null
675   , c_item_description_not_null
676   , c_unit_meas_not_null
677   , c_line_type_id_not_null
678   , c_temp_lbr_start_date_not_null
679   , c_line_sec_qty_gt_zero          -- OPM Integration R12
680   , c_line_qtys_within_deviation    -- OPM Integration R12
681   , c_from_line_id_not_null
682   , c_src_doc_line_not_null
683   , c_amt_ge_advance_amt   -- Bug 5070210
684   , c_option_from_date_not_null		-- CLM Changes
685   , c_option_to_date_not_null		-- CLM Changes
686   , c_line_num_disp_check		-- CLM Changes
687   , c_option_to_date_le_from_date	-- CLM Changes
688   , c_option_from_date_le_sysdate	-- CLM Changes
689   , c_option_fm_date_le_ex_date		-- CLM Changes
690   , c_clin_slin_num_check -- <Bug 9851804>
691   , c_par_line_comments_not_null  --<PAR PROJECT>
692   , c_validate_exhibit_name -- Elins project
693   );
694 
695 -- Validation set for HTML Order price differentials.
696 c_html_order_price_diff_vs CONSTANT PO_TBL_VARCHAR2000 :=
697   PO_TBL_VARCHAR2000(
698     c_unique_price_diff_num
699   , c_price_diff_num_gt_zero
700   , c_unique_price_type
701   , c_mul_ge_zero
702   , c_spo_price_type_on_src_doc
703   , c_spo_mul_btwn_min_max
704   , c_spo_mul_ge_min
705   );
706 
707 -- Validation set for HTML Orders shipments.
708 -- ECO 4503425: Removed the planned item null date check as this
709 -- has been moved to submission checks
710 c_html_order_shipment_vs CONSTANT PO_TBL_VARCHAR2000 :=
711   PO_TBL_VARCHAR2000(
712     c_days_early_gte_zero
713   , c_days_late_gte_zero
714   , c_rcv_close_tol_within_range
715   , c_over_rcpt_tol_within_range
716   -- ECO# 4708990/4586199: Obsoleting some messages
717   --, c_match_4way_check
718   , c_inv_close_tol_range_check
719   , c_need_by_date_open_per_check
720   , c_promise_date_open_per_check
721   , c_ship_to_org_null_check
722   , c_ship_to_loc_null_check
723   , c_ship_num_gt_zero
724   , c_ship_num_unique_check
725   , c_is_org_in_current_sob_check
726   , c_ship_qty_gt_zero
727   , c_ship_qty_ge_qty_exec    -- <Complex Work R12>: Combined billed/rcvd
728   , c_ship_amt_gt_zero
729   , c_ship_amt_ge_amt_exec    -- <Complex Work R12>: Combined billed/rcvd
730   , c_ship_sec_qty_gt_zero       -- OPM Integration R12
731   , c_ship_qtys_within_deviation -- OPM Integration R12
732   , c_unit_of_measure_not_null -- Bug 5385686
733   , c_pop_start_date_le_end_date
734   , c_pop_date_need_by_date
735   , c_complex_price_or_gt_zero
736   );
737 
738 -- Validation set for HTML Orders distributions.
739 c_html_order_distribution_vs CONSTANT PO_TBL_VARCHAR2000 :=
740   PO_TBL_VARCHAR2000(
741     c_dist_num_unique
742   , c_dist_num_gt_zero
743   -- < Bug:13503748 : Encumbrance ER Edit without unreserve>--
744   --, c_dist_qty_gt_zero
745   , c_dist_qty_ge_qty_exec    -- <Complex Work R12>: Combined billed/rcvd
746   -- < Bug:13503748 : Encumbrance ER Edit without unreserve>--
747   --, c_dist_amt_gt_zero
748   , c_dist_amt_ge_amt_exec    -- <Complex Work R12>: Combined billed/rcvd
749   , c_pjm_unit_number_effective
750   , c_project_info            -- PBWC Order Phase 3: Project Validations
751   , c_gl_enc_date_not_null_open
752   , c_oop_enter_all_fields
753   , c_check_proj_rel_validations -- Bug 5442682 : Validate project required fields. Need to validate before award data is validated.
754   , c_gms_data_valid
755   , c_check_fv_validations    -- ECO 4059111 : FV Validations
756     /* CLM Partial Funding Changes -- START */
757   , c_fund_value_ge_zero
758   , c_fund_value_le_tot_ord_value
759   , c_qty_fund_ge_exc_qty
760   , c_amt_fund_ge_exc_amt
761   , c_fund_value_gt_backing_req
762     /* CLM Partial Funding Changes -- END */
763   , c_funded_val_gt_req_funds_rmn -- CLM LnSc
764   , c_par_dist_value_increased -- PAR Project
765   );
766 
767 -- Validation set for HTML Agreement headers.
768 c_html_agmt_header_vs CONSTANT PO_TBL_VARCHAR2000 :=
769   PO_TBL_VARCHAR2000(
770     -- Bug# 4779226 remove c_warn_supplier_on_hold from header check
771     c_rate_gt_zero
772   , c_rate_combination_valid
773   , c_fax_email_address_valid
774   , c_doc_num_chars_valid
775   , c_doc_num_unique
776   , c_price_update_tol_ge_zero
777   , c_amount_limit_ge_zero
778   , c_amt_limit_ge_amt_agreed
779   , c_amount_agreed_ge_zero
780   , c_amount_agreed_not_null
781   , c_effective_le_expiration
782   -- Bug # 13550798, c_effective_from_le_order_date
783   , c_effective_to_ge_order_date
784   -- Bug # 13550798, c_contract_start_le_order_date
785   , c_contract_end_ge_order_date
786   , c_agent_id_not_null
787   , c_hdr_ship_to_loc_not_null
788   , c_vendor_id_not_null
789   , c_vendor_site_id_not_null
790   , c_segment1_not_null
791   , c_ship_via_lookup_code_valid -- bug 9213424
792   , c_ord_st_dt_gt_effec_dt
793   , c_max_ceil_awd_amt_gt_min
794   , c_min_guar_perc_range_check
795   , c_max_ceil_amt_gt_min_ord
796   , c_max_ceil_amt_gt_max_ord
797   , c_max_ord_amt_gt_min
798   , c_print_form_format_valid
799   , c_validate_mod_number        --<Bug 16474640>
800   );
801 
802 -- Validation set for HTML Agreement lines.
803 c_html_agmt_line_vs CONSTANT PO_TBL_VARCHAR2000 :=
804   PO_TBL_VARCHAR2000(
805     c_line_num_gt_zero
806   , c_line_num_unique
807   , c_item_id_not_null
808   , c_unit_price_ge_zero
809   , c_temp_labor_job_id_not_null
810   , c_category_id_not_null
811   , c_validate_category  -- bug 8633959
812   , c_item_description_not_null
813   , c_unit_meas_not_null
814   , c_expiration_ge_blanket_start
815   , c_expiration_le_blanket_end
816   , c_line_type_id_not_null
817   , c_from_line_id_not_null
818   , c_src_doc_line_not_null
819   , c_option_from_date_not_null		-- CLM Changes
820   , c_option_to_date_not_null		-- CLM Changes
821   , c_line_num_disp_check		-- CLM Changes
822   , c_option_to_date_le_from_date	-- CLM Changes
823   , c_option_from_date_le_sysdate	-- CLM Changes
824   , c_option_fm_date_le_ex_date		-- CLM Changes
825   , c_order_start_date_le_end_date
826   , c_order_start_date_gt_sysdate
827   , c_max_tot_amt_le_line_tot_amt
828   , c_max_tot_amt_ge_min_tot_amt
829   , c_max_tot_qty_le_line_tot_qty
830   , c_max_tot_qty_ge_min_tot_qty
831   , c_max_ord_amt_le_max_tot_amt
832   , c_max_ord_amt_ge_min_ord_amt
833   , c_max_ord_qty_le_max_tot_qty
834   , c_max_ord_qty_ge_min_ord_qty
835   , c_clin_slin_num_check -- <Bug 9851804>
836   , c_validate_exhibit_name -- Elins project
837   );
838 
839 -- Validation set for HTML Agreement GA org assignments.
840 c_html_agmt_ga_org_assign_vs CONSTANT PO_TBL_VARCHAR2000 :=
841   PO_TBL_VARCHAR2000(
842     c_assign_purch_org_not_null
843   , c_assign_vendor_site_not_null
844   );
845 
846 -- Validation set for HTML Agreement notification controls.
847 c_html_agmt_notif_ctrl_vs CONSTANT PO_TBL_VARCHAR2000 :=
848   PO_TBL_VARCHAR2000(
849     c_notif_start_date_le_end_date
850   , c_notif_percent_le_one_hundred
851   , c_notif_amount_gt_zero
852   , c_notif_amount_not_null
853   , c_notif_start_date_not_null
854   );
855 
856 -- Validation set for HTML Agreement price differentials.
857 c_html_agmt_price_diff_vs CONSTANT PO_TBL_VARCHAR2000 :=
858   PO_TBL_VARCHAR2000(
859     c_unique_price_diff_num
860   , c_price_diff_num_gt_zero
861   , c_unique_price_type
862   , c_max_mul_ge_zero
863   , c_max_mul_ge_min_mul
864   , c_min_mul_ge_zero
865   );
866 
867 -- Validation set for HTML Agreement price breaks.
868 c_html_agmt_price_break_vs CONSTANT PO_TBL_VARCHAR2000 :=
869   PO_TBL_VARCHAR2000(
870     c_ship_num_gt_zero
871   , c_ship_num_unique_check
872   , c_at_least_one_required_field
873   , c_price_discount_in_percent
874   , c_price_override_gt_zero
875   , c_price_break_qty_ge_zero
876   , c_price_break_start_le_end
877   , c_break_start_ge_blanket_start
878   , c_break_start_le_blanket_end
879   , c_break_start_le_expiration
880   , c_break_end_le_expiration
881   , c_break_end_ge_blanket_start
882   , c_break_end_le_blanket_end
883   );
884 
885 -- Validation set for HTML Agreement distributions.
886 c_html_agmt_distribution_vs CONSTANT PO_TBL_VARCHAR2000 :=
887   PO_TBL_VARCHAR2000(
888     c_amount_to_encumber_ge_zero
889   , c_budget_account_id_not_null
890   , c_gl_enc_date_not_null_open
891   , c_unencum_amt_le_amt_to_encum
892   );
893 
894 -- Used to validate that a change to the unit price is allowed.
895 c_allow_unit_price_change_vs CONSTANT PO_TBL_VARCHAR2000 :=
896   PO_TBL_VARCHAR2000(
897     c_no_dists_reserved
898   , c_accruals_allow_update
899   , c_no_timecards_exist
900   , c_no_pending_receipts
901   , c_retro_account_allows_update
902   -- ECO# 4708990/4586199: Obsoleting some messages
903   --, c_warn_amt_based_notif_ctrls
904   );
905 
906 -- Validation set for HTML Price Adjustments
907 c_html_price_adjustments_vs CONSTANT PO_TBL_VARCHAR2000 :=
908   PO_TBL_VARCHAR2000(
909     c_change_reason_code_not_null
910   , c_change_reason_text_not_null
911   );
912 
913 ----------------------------------------------------------------------------
914 -- PDOI Validation Common Set Definitions
915 ----------------------------------------------------------------------------
916   c_pdoi_header_common_vs CONSTANT po_tbl_varchar2000
917     := po_tbl_varchar2000(c_po_header_id,
918                           c_end_date,
919                           c_type_lookup_code,
920                           c_revision_num,
921                           c_document_num,
922                           c_currency_code,
923                           c_rate_info,
924                           c_agent_id,
925                           c_vendor_info,
926                           c_ship_to_location_id,
927                           c_bill_to_location_id,
928                           c_last_updated_by,
929                           c_last_update_date,
930                           c_release_num,
931                           c_po_release_id,
932                           c_release_date,
933                           c_revised_date,
934                           c_printed_date,
935                           c_closed_date,
936                           c_terms_id_header,
937                           c_ship_via_lookup_code,
938                           c_fob_lookup_code,
939                           c_freight_terms_lookup_code,
940                           c_shipping_control,
941                           c_approval_status,
942                           c_acceptance_required_flag);
943 
944   c_pdoi_line_common_vs CONSTANT po_tbl_varchar2000
945     := po_tbl_varchar2000(c_release_num_null,
946                           c_po_release_id_null,
947                           c_closed_date_null,
948                           c_contractor_name,
949                           c_order_type_lookup_code,
950                           c_job_id,
951                           c_job_business_group_id,
952                           c_item_description,
953                           c_category_id,
954                           c_category_id_null,
955                           c_hazard_class_id,
956                           c_un_number_id,
957                           c_unit_meas_lookup_code,
958                           c_unit_price,
959                           c_item_id_not_null,
960                           c_item_id,
961                           c_item_revision,
962                           c_line_type_id,
963                           c_quantity,
964                           c_amount,
965                           c_rate_type,
966                           c_line_num,
967                           c_po_line_id,
968                           c_price_type_lookup_code,
969                           c_line_secondary_quantity);
970 
971   c_pdoi_line_update_vs CONSTANT po_tbl_varchar2000
972     := po_tbl_varchar2000(c_uom_update,
973                           c_unit_price_update,
974                           c_amount_update,  -- bug 5258790
975                           c_item_desc_update,
976                           c_ip_category_id_update,
977                           c_category_id_update);
978 
979 
980   c_pdoi_line_loc_common_vs CONSTANT po_tbl_varchar2000
981     := po_tbl_varchar2000(c_shipment_need_by_date,
982                           c_shipment_quantity,
983                           c_shipment_price_override,
984                           c_shipment_price_discount,
985                           c_ship_to_organization_id,
986                           c_terms_id_line_loc,
987                           c_shipment_num,
988                           c_line_loc_secondary_quantity,
989                           c_tax_name);
990 
991   c_pdoi_dist_common_vs CONSTANT po_tbl_varchar2000
992     := po_tbl_varchar2000(c_dist_amount_ordered,
993                           c_dist_quantity_ordered,
994                           c_dist_destination_org_id,
995                           c_dist_deliver_to_location_id,
996                           c_dist_deliver_to_person_id,
997                           c_dist_destination_type_code,
998                           c_dist_destination_subinv,
999                           c_dist_wip_entity_id,
1000                           c_prevent_encumberance_flag,
1001                           c_charge_account_id,
1002                           c_budget_account_id,
1003                           c_accrual_account_id,
1004                           c_variance_account_id,
1005                           c_project_acct_context,
1006                           c_project_info,
1007                           c_tax_recovery_override_flag,
1008                           c_ACRN_value_valid, -- ACRN proj
1009 			              c_partial_funded_flag);  -- CLM Partial Funding Changes
1010 
1011 
1012   c_pdoi_price_diff_common_vs CONSTANT po_tbl_varchar2000
1013     := po_tbl_varchar2000(c_price_type,
1014                           c_multiple_price_diff,
1015                           c_entity_type,
1016                           c_multiplier,
1017                           c_min_multiplier,
1018                           c_max_multiplier,
1019                           c_price_diff_style_info);
1020 
1021 ----------------------------------------------------------------------------
1022 -- PDOI Set Definitions for Blanket PO
1023 ----------------------------------------------------------------------------
1024   c_pdoi_header_blanket_vs CONSTANT po_tbl_varchar2000
1025     := po_tbl_varchar2000(c_confirming_order_flag,
1026                           c_acceptance_due_date,
1027                           c_amount_agreed,
1028                           c_amount_limit,
1029                           c_firm_status_lookup_header,
1030                           c_cancel_flag,
1031                           c_closed_code,
1032                           c_print_count,
1033                           c_frozen_flag,
1034                           c_amount_to_encumber,
1035                           c_style_id);
1036 
1037 
1038   c_pdoi_line_blanket_vs CONSTANT po_tbl_varchar2000
1039     := po_tbl_varchar2000(c_global_agreement_flag,
1040                           c_capital_expense_flag,
1041                           c_price_break_lookup_code,
1042                           c_not_to_exceed_price,
1043                           c_amount_blanket,
1044                           c_expiration_date_blanket,
1045                           c_over_tolerance_err_flag_null,
1046                           c_ip_category_id,
1047                           c_line_secondary_uom,
1048                           c_line_preferred_grade,
1049                           c_line_style_related_info,
1050                           c_negotiated_by_preparer);
1051 
1052   c_pdoi_line_blanket_update_vs CONSTANT po_tbl_varchar2000
1053     := po_tbl_varchar2000(c_negotiated_by_prep_update);
1054 
1055 
1056   c_pdoi_line_loc_blanket_vs CONSTANT po_tbl_varchar2000
1057     := po_tbl_varchar2000(c_shipment_effective_dates,
1058                           c_shipment_type_blanket,
1059                           c_at_least_one_required_field,
1060                           c_need_by_date_null,
1061                           c_firm_flag_null,
1062                           c_freight_carrier_null,
1063                           c_fob_lookup_code_null,
1064                           c_freight_terms_lookup_null,
1065                           c_qty_rcv_tolerance_null,
1066                           c_receipt_required_flag_null,
1067                           c_inspection_reqd_flag_null,
1068                           c_receipt_days_exception_null,
1069                           c_invoice_close_toler_null,
1070                           c_receive_close_toler_null,
1071                           c_days_early_rcpt_allowed_null,
1072                           c_days_late_rcpt_allowed_null,
1073                           c_enfrce_ship_to_loc_code_null,
1074                           c_allow_sub_receipts_flag_null,
1075                           c_promised_date_null,
1076                           c_receiving_routing_null,
1077                           c_line_loc_secondary_uom,
1078                           c_line_loc_preferred_grade,
1079                           c_line_loc_style_related_info,
1080 						  c_price_break);
1081 
1082 
1083 
1084 ----------------------------------------------------------------------------
1085 -- PDOI Set Definitions for Standard PO
1086 ----------------------------------------------------------------------------
1087   c_pdoi_header_standard_vs CONSTANT po_tbl_varchar2000
1088     := po_tbl_varchar2000(c_confirming_order_flag,
1089                           c_acceptance_due_date,
1090                           c_firm_status_lookup_header,
1091                           c_cancel_flag,
1092                           c_closed_code,
1093                           c_print_count,
1094                           c_frozen_flag,
1095                           c_style_id);
1096 
1097   c_pdoi_line_standard_vs CONSTANT po_tbl_varchar2000
1098     := po_tbl_varchar2000(c_over_tolerance_error_flag,
1099                           c_capital_expense_flag,
1100                           c_not_to_exceed_price,
1101                           c_start_date_standard,
1102                           c_item_id_standard,
1103                           c_quantity_standard,
1104                           c_amount_standard,
1105                           c_ip_category_id_null,
1106                           c_line_secondary_uom,
1107                           c_line_preferred_grade,
1108                           c_line_style_related_info,
1109                           c_negotiated_by_preparer,
1110                           -- <PDOI for Complex PO Project: Start>
1111                           c_pdoi_qty_ge_qty_mstone_exec,
1112                           c_pdoi_prc_ge_prc_mstone_exec,
1113                           c_pdoi_recoupment_range_check,
1114                           c_pdoi_retainage_range_check,
1115                           c_pdoi_prog_pay_range_check,
1116                           c_pdoi_max_retain_amt_ge_zero,
1117                           c_pdoi_max_retain_amt_ge_retnd,
1118                           c_pdoi_amt_ge_line_advance_amt,
1119                           c_pdoi_complex_po_att_check
1120                           -- <PDOI for Complex PO Project: End>
1121 			  );
1122 
1123   c_pdoi_line_loc_standard_vs CONSTANT po_tbl_varchar2000
1124     := po_tbl_varchar2000(c_enforce_ship_to_loc_code,
1125                           c_shipment_type_standard,
1126                           c_allow_sub_receipts_flag,
1127                           c_days_early_receipt_allowed,
1128                           c_receipt_days_exception_code,
1129                           c_invoice_close_tolerance,
1130                           c_receive_close_tolerance,
1131                           c_receiving_routing_id,
1132                           c_accrue_on_receipt_flag,
1133                           c_shipment_promised_date,
1134                           c_line_loc_secondary_uom,
1135                           c_line_loc_preferred_grade,
1136                           -- <PDOI for Complex PO Project: Start>
1137                           c_pdoi_amt_ge_ship_advance_amt,
1138                           c_pdoi_shipment_amount,
1139                           c_pdoi_payment_type
1140                           -- <PDOI for Complex PO Project: End>
1141 			  );
1142 
1143 
1144 ----------------------------------------------------------------------------
1145 -- PDOI Set Definitions for Quotation
1146 ----------------------------------------------------------------------------
1147   c_pdoi_header_quotation_vs CONSTANT po_tbl_varchar2000
1148     := po_tbl_varchar2000(c_quote_warning_delay,
1149                           c_approval_required_flag);
1150 
1151   c_pdoi_line_quotation_vs CONSTANT po_tbl_varchar2000
1152     := po_tbl_varchar2000(c_over_tolerance_error_flag,
1153                           c_allow_price_override_null ,
1154                           c_negotiated_by_preparer_null,
1155                           c_capital_expense_flag_null,
1156                           c_min_release_amount_null,
1157                           c_market_price_null,
1158                           c_committed_amount_null,
1159                           c_ip_category_id,
1160                           c_negotiated_by_preparer_null);
1161 
1162   c_pdoi_line_loc_quotation_vs CONSTANT po_tbl_varchar2000
1163     := po_tbl_varchar2000(c_qty_rcv_exception_code,
1164                           c_shipment_type_quotation,
1165                           c_fob_lookup_code_line_loc,
1166                           c_freight_terms_line_loc,
1167                           c_freight_carrier_line_loc,
1168                           c_firm_flag_null,
1169                           c_promised_date_null,
1170                           c_receipt_days_exception_null,
1171                           c_invoice_close_toler_null,
1172                           c_receive_close_toler_null,
1173                           c_days_early_rcpt_allowed_null,
1174                           c_days_late_rcpt_allowed_null,
1175                           c_enfrce_ship_to_loc_code_null,
1176                           c_allow_sub_receipts_flag_null,
1177                           c_receiving_routing_null,
1178                           c_need_by_date_null);
1179 
1180 
1181 ----------------------------------------------------------------------------
1182 -- CLM PDOI Common Set Definitions
1183 ----------------------------------------------------------------------------
1184 
1185   c_clm_pdoi_header_common_vs CONSTANT po_tbl_varchar2000
1186     :=  po_tbl_varchar2000(c_print_form_format_valid,
1187                            c_validate_source_idv,
1188                            c_validate_award_admin,
1189                            c_validate_contract_officer,
1190                            c_validate_umbrella_program_id,
1191                            c_validate_clm_award_type,
1192                            c_validate_style_id,
1193                            c_validate_idv_style_id,
1194                            c_validate_po_idv_vendor_id,
1195                            c_val_po_idv_vendor_site_id);
1196 
1197   c_clm_pdoi_line_common_vs CONSTANT po_tbl_varchar2000
1198     :=  po_tbl_varchar2000(c_pdoi_clin_slin_structure,
1199                            c_validate_contract_type,
1200                            c_validate_cost_constraint,
1201                            --c_check_contract_num_and_ver,
1202                            c_validate_option_indicator,
1203                            c_validate_clm_base_line_num,
1204                            c_validate_clm_option_num,
1205                            c_validate_clm_idc_type,
1206                            --c_validate_clin_line_num_disp,
1207                            c_option_from_date_not_null,
1208                            c_option_to_date_not_null,
1209                            c_option_to_date_le_from_date,
1210                            c_option_from_date_le_sysdate,
1211                            c_option_fm_date_le_ex_date,
1212                            c_idv_reference_equal_check,
1213                            c_validate_clm_line_type_id);
1214 
1215   c_clm_pdoi_dist_common_vs CONSTANT po_tbl_varchar2000
1216     :=  po_tbl_varchar2000(c_pdoi_check_clin_slin_funding,
1217                            c_validate_clm_defence_funding,
1218                            c_validate_option_distribution);
1219 
1220 
1221 ----------------------------------------------------------------------------
1222 -- Validation Set Definitions for Modification Merge
1223 ----------------------------------------------------------------------------
1224 
1225 c_mod_sync_shipment_vs CONSTANT PO_TBL_VARCHAR2000 :=
1226   PO_TBL_VARCHAR2000(
1227     c_ship_qty_ge_qty_exec
1228   , c_ship_amt_ge_amt_exec);
1229 
1230 c_mod_sync_distribution_vs CONSTANT PO_TBL_VARCHAR2000 :=
1231   PO_TBL_VARCHAR2000(
1232     c_dist_qty_ge_qty_exec
1233   , c_dist_amt_ge_amt_exec);
1234 
1235 
1236 --UCA Project - CLMR4 Changes Begin
1237 ------------------------------------------------------------------------------
1238 --PO LINE UCAs Validation Set Defintion
1239 ------------------------------------------------------------------------------
1240  c_html_order_line_ucas_vs CONSTANT PO_TBL_VARCHAR2000 :=
1241  PO_TBL_VARCHAR2000(
1242   c_lgl_le_nte,
1243   c_undef_amt_le_nte,
1244   c_undef_amt_le_line_amt,
1245   c_undef_amt_gt_zero,
1246   c_lgl_gt_zero,
1247   c_nte_gt_zero--,
1248   --c_pdd_ge_sysdate
1249   );
1250 
1251 --UCA Project - CLMR4 Changes End
1252 
1253 -------------------------------------------------------------------------------
1254 --Start of Comments
1255 --Pre-reqs: None.
1256 --Modifies: PO_VALIDATION_RESULT_SET_ID_S
1257 --Locks: None.
1258 --Function:
1259 --  Retrieves the next value from the sequence PO_VALIDATION_RESULT_SET_ID_S.
1260 --Returns:
1261 --  The next sequence value.
1262 --End of Comments
1263 -------------------------------------------------------------------------------
1264 FUNCTION next_result_set_id
1265 RETURN NUMBER
1266 IS
1267 d_mod CONSTANT VARCHAR2(100) := D_next_result_set_id;
1268 l_nextval NUMBER;
1269 BEGIN
1270 
1271 IF PO_LOG.d_proc THEN
1272   PO_LOG.proc_begin(d_mod);
1273 END IF;
1274 
1275 SELECT PO_VALIDATION_RESULT_SET_ID_S.NEXTVAL
1276 INTO l_nextval
1277 FROM DUAL
1278 ;
1279 
1280 IF PO_LOG.d_proc THEN
1281   PO_LOG.proc_return(d_mod,l_nextval);
1282 END IF;
1283 
1284 RETURN l_nextval;
1285 
1286 EXCEPTION
1287 WHEN OTHERS THEN
1288   IF PO_LOG.d_exc THEN
1289     PO_LOG.exc(d_mod,0,NULL);
1290   END IF;
1291   RAISE;
1292 
1293 END next_result_set_id;
1294 
1295 
1296 -------------------------------------------------------------------------------
1297 --Start of Comments
1298 --Pre-reqs: None.
1299 --Modifies: PO_VALIDATION_RESULTS
1300 --Locks: None.
1301 --Function:
1302 --  Deletes the specified result set from the
1303 --  PO_VALIDATION_RESULTS table.
1304 --Parameters:
1305 --IN:
1306 --p_result_set_id
1307 --  The result_set_id identifier into PO_VALIDATION_RESULTS.
1308 --End of Comments
1309 -------------------------------------------------------------------------------
1310 PROCEDURE delete_result_set(
1311   p_result_set_id IN NUMBER
1312 )
1313 IS
1314 d_mod CONSTANT VARCHAR2(100) := D_delete_result_set;
1315 BEGIN
1316 
1317 IF PO_LOG.d_proc THEN
1318   PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1319 END IF;
1320 
1321 DELETE FROM PO_VALIDATION_RESULTS_GT
1322 WHERE result_set_id = p_result_set_id
1323 ;
1324 
1325 IF PO_LOG.d_proc THEN
1326   PO_LOG.stmt(d_mod,100,'Deleted result set.  SQL%ROWCOUNT',SQL%ROWCOUNT);
1327   PO_LOG.proc_end(d_mod);
1328 END IF;
1329 
1330 EXCEPTION
1331 WHEN OTHERS THEN
1332   IF PO_LOG.d_exc THEN
1333     PO_LOG.exc(d_mod,0,NULL);
1334   END IF;
1335   RAISE;
1336 
1337 END delete_result_set;
1338 
1339 
1340 -------------------------------------------------------------------------------
1341 --Start of Comments
1342 --Pre-reqs: None.
1343 --Modifies: PO_VALIDATION_RESULTS
1344 --Locks: None.
1345 --Function:
1346 --  Autonomously deletes the specified result set from the
1347 --  PO_VALIDATION_RESULTS table.
1348 --Parameters:
1349 --IN:
1350 --p_result_set_id
1351 --  The result_set_id identifier into PO_VALIDATION_RESULTS.
1352 --End of Comments
1353 -------------------------------------------------------------------------------
1354 PROCEDURE delete_result_set_auto(
1355   p_result_set_id IN NUMBER
1356 )
1357 IS
1358 PRAGMA AUTONOMOUS_TRANSACTION;
1359 d_mod CONSTANT VARCHAR2(100) := D_delete_result_set_auto;
1360 d_position NUMBER := 0;
1361 BEGIN
1362 
1363 IF PO_LOG.d_proc THEN
1364   PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1365 END IF;
1366 
1367 d_position := 1;
1368 
1369 delete_result_set(p_result_set_id => p_result_set_id);
1370 
1371 d_position := 100;
1372 
1373 COMMIT;
1374 
1375 d_position := 200;
1376 
1377 IF PO_LOG.d_proc THEN
1378   PO_LOG.proc_end(d_mod);
1379 END IF;
1380 
1381 EXCEPTION
1382 WHEN OTHERS THEN
1383   IF PO_LOG.d_exc THEN
1384     PO_LOG.exc(d_mod,d_position,NULL);
1385   END IF;
1386   RAISE;
1387 
1388 END delete_result_set_auto;
1389 
1390 
1391 -------------------------------------------------------------------------------
1392 --Start of Comments
1393 --Pre-reqs: None.
1394 --Modifies: PO_VALIDATION_RESULTS
1395 --Locks: None.
1396 --Function:
1397 --  Autonomously inserts and commits the input data into the
1398 --  PO_VALIDATION_RESULTS table.
1399 --Parameters:
1400 --IN:
1401 --  The data to insert into the table.
1402 --End of Comments
1403 -------------------------------------------------------------------------------
1404 PROCEDURE commit_validation_results_auto(
1405   p_result_id_tbl                 IN PO_TBL_NUMBER
1406 , p_result_set_id_tbl             IN PO_TBL_NUMBER
1407 , p_result_type_tbl               IN PO_TBL_VARCHAR30
1408 , p_table_name_tbl                IN PO_TBL_VARCHAR30
1409 , p_table_id_tbl                 IN PO_TBL_NUMBER
1410 , p_message_application_tbl       IN PO_TBL_VARCHAR30
1411 , p_message_name_tbl              IN PO_TBL_VARCHAR30
1412 , p_column_name_tbl               IN PO_TBL_VARCHAR30
1413 , p_token1_name_tbl               IN PO_TBL_VARCHAR30
1414 , p_token1_value_tbl              IN PO_TBL_VARCHAR2000
1415 , p_token2_name_tbl               IN PO_TBL_VARCHAR30
1416 , p_token2_value_tbl              IN PO_TBL_VARCHAR2000
1417 , p_token3_name_tbl               IN PO_TBL_VARCHAR30
1418 , p_token3_value_tbl              IN PO_TBL_VARCHAR2000
1419 , p_token4_name_tbl               IN PO_TBL_VARCHAR30
1420 , p_token4_value_tbl              IN PO_TBL_VARCHAR2000
1421 , p_token5_name_tbl               IN PO_TBL_VARCHAR30
1422 , p_token5_value_tbl              IN PO_TBL_VARCHAR2000
1423 , p_token6_name_tbl               IN PO_TBL_VARCHAR30
1424 , p_token6_value_tbl              IN PO_TBL_VARCHAR2000
1425 )
1426 IS
1427 PRAGMA AUTONOMOUS_TRANSACTION;
1428 d_mod CONSTANT VARCHAR2(100) := D_commit_validation_results_au;
1429 d_position NUMBER := 0;
1430 BEGIN
1431 
1432 IF PO_LOG.d_proc THEN
1433   PO_LOG.proc_begin(d_mod,'p_result_id_tbl',p_result_id_tbl);
1434   PO_LOG.proc_begin(d_mod,'p_result_set_id_tbl',p_result_set_id_tbl);
1435   PO_LOG.proc_begin(d_mod,'p_result_type_tbl',p_result_type_tbl);
1436   PO_LOG.proc_begin(d_mod,'p_table_name_tbl',p_table_name_tbl);
1437   PO_LOG.proc_begin(d_mod,'p_table_id_tbl',p_table_id_tbl);
1438   PO_LOG.proc_begin(d_mod,'p_message_application_tbl',p_message_application_tbl);
1439   PO_LOG.proc_begin(d_mod,'p_message_name_tbl',p_message_name_tbl);
1440   PO_LOG.proc_begin(d_mod,'p_column_name_tbl',p_column_name_tbl);
1441   PO_LOG.proc_begin(d_mod,'p_token1_name_tbl',p_token1_name_tbl);
1442   PO_LOG.proc_begin(d_mod,'p_token1_value_tbl',p_token1_value_tbl);
1443   PO_LOG.proc_begin(d_mod,'p_token2_name_tbl',p_token2_name_tbl);
1444   PO_LOG.proc_begin(d_mod,'p_token2_value_tbl',p_token2_value_tbl);
1445   PO_LOG.proc_begin(d_mod,'p_token3_name_tbl',p_token3_name_tbl);
1446   PO_LOG.proc_begin(d_mod,'p_token3_value_tbl',p_token3_value_tbl);
1447   PO_LOG.proc_begin(d_mod,'p_token4_name_tbl',p_token4_name_tbl);
1448   PO_LOG.proc_begin(d_mod,'p_token4_value_tbl',p_token4_value_tbl);
1449   PO_LOG.proc_begin(d_mod,'p_token5_name_tbl',p_token5_name_tbl);
1450   PO_LOG.proc_begin(d_mod,'p_token5_value_tbl',p_token5_value_tbl);
1451   PO_LOG.proc_begin(d_mod,'p_token6_name_tbl',p_token6_name_tbl);
1452   PO_LOG.proc_begin(d_mod,'p_token6_value_tbl',p_token6_value_tbl);
1453 END IF;
1454 
1455 d_position := 1;
1456 
1457 FORALL i IN 1 .. p_result_set_id_tbl.COUNT
1458 INSERT INTO PO_VALIDATION_RESULTS_GT
1459 ( result_set_id
1460 , result_type
1461 , entity_type
1462 , entity_id
1463 , message_application
1464 , message_name
1465 , column_name
1466 , token1_name
1467 , token1_value
1468 , token2_name
1469 , token2_value
1470 , token3_name
1471 , token3_value
1472 , token4_name
1473 , token4_value
1474 , token5_name
1475 , token5_value
1476 , token6_name
1477 , token6_value
1478 )
1479 VALUES
1480 ( p_result_set_id_tbl(i)
1481 , p_result_type_tbl(i)
1482 , p_table_name_tbl(i)
1483 , p_table_id_tbl(i)
1484 , p_message_application_tbl(i)
1485 , p_message_name_tbl(i)
1486 , p_column_name_tbl(i)
1487 , p_token1_name_tbl(i)
1488 , p_token1_value_tbl(i)
1489 , p_token2_name_tbl(i)
1490 , p_token2_value_tbl(i)
1491 , p_token3_name_tbl(i)
1492 , p_token3_value_tbl(i)
1493 , p_token4_name_tbl(i)
1494 , p_token4_value_tbl(i)
1495 , p_token5_name_tbl(i)
1496 , p_token5_value_tbl(i)
1497 , p_token6_name_tbl(i)
1498 , p_token6_value_tbl(i)
1499 );
1500 
1501 d_position := 100;
1502 
1503 IF PO_LOG.d_stmt THEN
1504   PO_LOG.stmt(d_mod,d_position,'Inserted data. SQL%ROWCOUNT',SQL%ROWCOUNT);
1505 END IF;
1506 
1507 COMMIT WORK;
1508 
1509 IF PO_LOG.d_proc THEN
1510   PO_LOG.proc_end(d_mod);
1511 END IF;
1512 
1513 EXCEPTION
1514 WHEN OTHERS THEN
1515   IF PO_LOG.d_exc THEN
1516     PO_LOG.exc(d_mod,d_position,NULL);
1517   END IF;
1518   RAISE;
1519 
1520 END commit_validation_results_auto;
1521 
1522 
1523 -------------------------------------------------------------------------------
1524 --Start of Comments
1525 --Pre-reqs: None.
1526 --Modifies: PO_VALIDATION_RESULTS
1527 --Locks: PO_VALIDATION_RESULTS
1528 --Function:
1529 --  Replaces the old result_set_id with the new one.
1530 --Parameters:
1531 --IN:
1532 --p_old_result_set_id
1533 --  The result_set_id of the rows that should be updated.
1534 --p_new_result_set_id
1535 --  The id with which to replace the rows' result_set_id.
1536 --End of Comments
1537 -------------------------------------------------------------------------------
1538 PROCEDURE replace_result_set_id(
1539   p_old_result_set_id   IN NUMBER
1540 , p_new_result_set_id   IN NUMBER
1541 )
1542 IS
1543 d_mod CONSTANT VARCHAR2(100) := D_replace_result_set_id;
1544 BEGIN
1545 
1546 IF PO_LOG.d_proc THEN
1547   PO_LOG.proc_begin(d_mod,'p_old_result_set_id',p_old_result_set_id);
1548   PO_LOG.proc_begin(d_mod,'p_new_result_set_id',p_new_result_set_id);
1549 END IF;
1550 
1551 -- Fix the result_set_id, message_application, and message_name.
1552 
1553 UPDATE PO_VALIDATION_RESULTS_GT
1554 SET
1555   result_set_id = p_new_result_set_id
1556 WHERE
1557     result_set_id = p_old_result_set_id
1558 ;
1559 
1560 IF PO_LOG.d_proc THEN
1561   PO_LOG.proc_end(d_mod);
1562 END IF;
1563 
1564 EXCEPTION
1565 WHEN OTHERS THEN
1566   IF PO_LOG.d_exc THEN
1567     PO_LOG.exc(d_mod,0,NULL);
1568   END IF;
1569   RAISE;
1570 
1571 END replace_result_set_id;
1572 
1573 
1574 -------------------------------------------------------------------------------
1575 --Start of Comments
1576 --Pre-reqs: None.
1577 --Modifies: PO_VALIDATION_RESULTS
1578 --Locks: PO_VALIDATION_RESULTS
1579 --Function:
1580 --  Extracts records from PO_VALIDATION_RESULTS, deletes them, and then
1581 --  inserts them again in an autonomous transaction.
1582 --  Also provides default values to some columns.
1583 --Parameters:
1584 --IN:
1585 --p_result_set_id
1586 --  Identifies the rows to operate on.
1587 --End of Comments
1588 -------------------------------------------------------------------------------
1589 PROCEDURE commit_result_set(
1590   p_result_set_id   IN NUMBER
1591 )
1592 IS
1593 d_mod CONSTANT VARCHAR2(100) := D_commit_result_set;
1594 d_position NUMBER := 0;
1595 
1596 l_result_id_tbl PO_TBL_NUMBER;
1597 l_result_set_id_tbl PO_TBL_NUMBER;
1598 l_result_type_tbl PO_TBL_VARCHAR30;
1599 l_table_name_tbl PO_TBL_VARCHAR30;
1600 l_table_id_tbl PO_TBL_NUMBER;
1601 l_message_application_tbl PO_TBL_VARCHAR30;
1602 l_message_name_tbl PO_TBL_VARCHAR30;
1603 l_column_name_tbl PO_TBL_VARCHAR30;
1604 l_token1_name_tbl PO_TBL_VARCHAR30;
1605 l_token1_value_tbl PO_TBL_VARCHAR2000;
1606 l_token2_name_tbl PO_TBL_VARCHAR30;
1607 l_token2_value_tbl PO_TBL_VARCHAR2000;
1608 l_token3_name_tbl PO_TBL_VARCHAR30;
1609 l_token3_value_tbl PO_TBL_VARCHAR2000;
1610 l_token4_name_tbl PO_TBL_VARCHAR30;
1611 l_token4_value_tbl PO_TBL_VARCHAR2000;
1612 l_token5_name_tbl PO_TBL_VARCHAR30;
1613 l_token5_value_tbl PO_TBL_VARCHAR2000;
1614 l_token6_name_tbl PO_TBL_VARCHAR30;
1615 l_token6_value_tbl PO_TBL_VARCHAR2000;
1616 
1617 BEGIN
1618 
1619 IF PO_LOG.d_proc THEN
1620   PO_LOG.proc_begin(d_mod,'p_result_set_id',p_result_set_id);
1621 END IF;
1622 
1623 d_position := 1;
1624 
1625 -- Retrieve the data from the validation results table
1626 -- and commit it back, autonomously.
1627 
1628 SELECT
1629   result_set_id
1630 , NVL(result_type,c_result_type_FAILURE)
1631 , entity_type
1632 , entity_id
1633 , NVL(message_application,c_PO)
1634 , message_name
1635 , column_name
1636 , token1_name
1637 , token1_value
1638 , token2_name
1639 , token2_value
1640 , token3_name
1641 , token3_value
1642 , token4_name
1643 , token4_value
1644 , token5_name
1645 , token5_value
1646 , token6_name
1647 , token6_value
1648 BULK COLLECT INTO
1649   l_result_set_id_tbl
1650 , l_result_type_tbl
1651 , l_table_name_tbl
1652 , l_table_id_tbl
1653 , l_message_application_tbl
1654 , l_message_name_tbl
1655 , l_column_name_tbl
1656 , l_token1_name_tbl
1657 , l_token1_value_tbl
1658 , l_token2_name_tbl
1659 , l_token2_value_tbl
1660 , l_token3_name_tbl
1661 , l_token3_value_tbl
1662 , l_token4_name_tbl
1663 , l_token4_value_tbl
1664 , l_token5_name_tbl
1665 , l_token5_value_tbl
1666 , l_token6_name_tbl
1667 , l_token6_value_tbl
1668 FROM
1669   PO_VALIDATION_RESULTS_GT
1670 WHERE
1671     result_set_id = p_result_set_id
1672 ;
1673 
1674 d_position := 100;
1675 IF PO_LOG.d_stmt THEN
1676   PO_LOG.stmt(d_mod,d_position,'Retrieved data.');
1677 END IF;
1678 
1679 delete_result_set(p_result_set_id => p_result_set_id);
1680 
1681 d_position := 200;
1682 
1683 commit_validation_results_auto(
1684   p_result_id_tbl => l_result_id_tbl
1685 , p_result_set_id_tbl => l_result_set_id_tbl
1686 , p_result_type_tbl => l_result_type_tbl
1687 , p_table_name_tbl => l_table_name_tbl
1688 , p_table_id_tbl => l_table_id_tbl
1689 , p_message_application_tbl => l_message_application_tbl
1690 , p_message_name_tbl => l_message_name_tbl
1691 , p_column_name_tbl => l_column_name_tbl
1692 , p_token1_name_tbl => l_token1_name_tbl
1693 , p_token1_value_tbl => l_token1_value_tbl
1694 , p_token2_name_tbl => l_token2_name_tbl
1695 , p_token2_value_tbl => l_token2_value_tbl
1696 , p_token3_name_tbl => l_token3_name_tbl
1697 , p_token3_value_tbl => l_token3_value_tbl
1698 , p_token4_name_tbl => l_token4_name_tbl
1699 , p_token4_value_tbl => l_token4_value_tbl
1700 , p_token5_name_tbl => l_token5_name_tbl
1701 , p_token5_value_tbl => l_token5_value_tbl
1702 , p_token6_name_tbl => l_token6_name_tbl
1703 , p_token6_value_tbl => l_token6_value_tbl
1704 );
1705 
1706 IF PO_LOG.d_proc THEN
1707   PO_LOG.proc_end(d_mod);
1708 END IF;
1709 
1710 EXCEPTION
1711 WHEN OTHERS THEN
1712   IF PO_LOG.d_exc THEN
1713     PO_LOG.exc(d_mod,d_position,NULL);
1714   END IF;
1715   RAISE;
1716 
1717 END commit_result_set;
1718 
1719 
1720 
1721 /**
1722 
1723 -------------------------------------------
1724 General contract for validation subroutines
1725 -------------------------------------------
1726 
1727 Each validation subroutine must have a signature
1728 containing the following output parameters:
1729 
1730 x_result_set_id IN OUT NOCOPY NUMBER
1731 x_result_type   OUT NOCOPY    VARCHAR2
1732 
1733 The validation subroutine may take in any parameters
1734 from the available input to validate_set.
1735 Most subroutines will only require a small set of parameters,
1736 and can be coded as such.
1737 
1738 Example subroutine call:
1739 
1740 CASE l_val
1741   ...
1742 
1743   WHEN c_unit_price_ge_zero THEN
1744     PO_PRICE_HELPER.unit_price_ge_zero(
1745       p_line_id_tbl => p_lines.po_line_id
1746     , p_draft_id_tbl => p_lines.draft_id
1747     , p_unit_price_tbl => p_lines.unit_price
1748     , x_result_set_id => l_result_set_id
1749     , x_result_type => l_result_type
1750     );
1751 
1752   WHEN ...
1753 
1754 END CASE;
1755 
1756 
1757 The validation subroutine will perform the required validation
1758 on the data and insert results into the PO_VALIDATION_RESULTS table.
1759 
1760 Parameter descriptions:
1761 
1762 x_result_set_id
1763   This parameter identifies rows in PO_VALIDATION_RESULTS
1764   that have been generated by the validation procedure.
1765   The following columns must be populated
1766   by the validation procedure:
1767 
1768     result_id
1769       PO_VALIDATION_RESULT_ID_S.nextval
1770 
1771     result_set_id
1772       x_result_set_id
1773 
1774     table_name
1775     table_id
1776       The name of the table on which the validation is acting,
1777       and the primary key of the table row.
1778 
1779     column_name
1780       The name of the column of the pending table to which
1781       this validation result corresponds.
1782 
1783     result_type
1784       This should be populated with the default interpretation
1785       of this result (WARNING, ERROR, FATAL, etc.).
1786       If this column is not populated, ERROR should be assumed.
1787 
1788     message_application
1789     message_name
1790       The dictionary message for this result.
1791       If message_application is not populated, PO should be assumed.
1792 
1793   Additionally, the validation procedure must populate the columns
1794   token1_name, token1_value, token2_name, token2_value, ...
1795   if any tokens are used in the dictionary message.
1796 
1797 x_result_type
1798   This parameter contains a summary of the results.
1799   If all validations are successful and no results have been
1800   generated, it will be SUCCESS.  Otherwise, it will be
1801   equal to the most serious result_type of the validation
1802   results.
1803 
1804 
1805 */
1806 
1807 
1808 
1809 ----------------------------------------------------------------------------
1810 --Pre-reqs: None.
1811 --Modifies:
1812 --  PO_VALIDATION_RESULTS
1813 --Locks: None.
1814 --Function:
1815 --  Executes a set of validations in the order determined
1816 --  by the validation set list.
1817 --  Validation results will be stored in PO_VALIDATION_RESULTS.
1818 --
1819 --  Calls to validate_set may be chained together,
1820 --  as the x_result_set_id and x_result_type parameters
1821 --  are IN OUT.
1822 --
1823 --  Example:
1824 --
1825 --  <<DISTRIBUTION_VALIDATIONS>>
1826 --  BEGIN
1827 --
1828 --    -- Common validations
1829 --
1830 --    validate_set(
1831 --      p_validation_set => c_dist_common_val_set
1832 --    , p_distributions => l_dist_id_tbl
1833 --    , x_result_set_id => l_result_set_id
1834 --    , x_result_type => l_result_type
1835 --    );
1836 --
1837 --    IF (    l_result_type <> c_RESULT_TYPE_SUCCESS
1838 --        AND l_projects_enabled_flag )
1839 --    THEN
1840 --
1841 --      -- Projects-specific validations
1842 --
1843 --      validate_set(
1844 --        p_validation_set => c_dist_projects_val_set
1845 --      , p_distributions => l_dist_id_tbl
1846 --      , x_result_set_id => l_result_set_id
1847 --      , x_result_type => l_result_type
1848 --      );
1849 --
1850 --    END IF;
1851 --
1852 --  END DISTRIBUTION_VALIDATIONS;
1853 --
1854 --Parameters:
1855 --IN:
1856 --p_validation_set
1857 --  Specifies the validations to perform.
1858 --p_headers
1859 --p_lines
1860 --p_line_locations
1861 --p_distributions
1862 --p_price_differentials
1863 --p_ga_org_assignments
1864 --p_notification_controls
1865 --  The data that needs to be validated.
1866 --  Only the data that is required for the incoming validation set
1867 --  is necessary.
1868 --p_autocommit_results_flag
1869 --  Indicates whether or not the results need to be autonomously committed.
1870 --    g_parameter_NO  - There is no need to commit the results.
1871 --    g_parameter_YES - The results need to be committed.
1872 --p_calling_program
1873 --  Identifier of the program that is invoking the validation set.
1874 --  This can be used by validation subroutines to perform differently
1875 --  for different flows.  For example, this can be used to substitute
1876 --  different messages or tokens for OA vs. PDOI, or to interpret
1877 --  warnings as errors in different cases, etc.
1878 --  Use one of the c_program_XXX constants.
1879 --p_stopping_result_type
1880 --  Indicates that if this result type is encountered,
1881 --  processing should stop and return.
1882 --  Use one of the c_result_type_XXX variables.
1883 --  For no stopping, use NULL.
1884 --p_parameter_name_tbl
1885 --p_parameter_value_tbl
1886 --  Contain additional parameters that may be passed to individual
1887 --  validation subroutines.
1888 --  The parameter names and associated value should be located
1889 --  at identical indexes in the input tables.
1890 --IN OUT:
1891 --x_result_set_id
1892 --  Identifier for the output results in PO_VALIDATION_RESULTS.
1893 --  If a value is passed in, it will be used and unchanged.
1894 --  If NULL, a distinct value will be retrieved.
1895 --x_result_type
1896 --  Provides a summary of the validation results.
1897 --  An input code will never be turned into a better result,
1898 --  but may be turned into a worse result
1899 --  (ERROR will not become SUCCESS, but WARNING may become ERROR).
1900 ----------------------------------------------------------------------------
1901 PROCEDURE validate_set(
1902   p_validation_set        IN PO_TBL_VARCHAR2000
1903 , p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL
1904 , p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL
1905 , p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
1906 , p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
1907 , p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
1908 , p_ga_org_assignments    IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
1909 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
1910 , p_price_adjustments     IN PO_PRICE_ADJS_VAL_TYPE DEFAULT NULL --Enhanced Pricing
1911 , p_po_line_ucas          IN PO_LINE_UCAS_VAL_TYPE DEFAULT NULL --UCA Project
1912 , p_autocommit_results_flag IN VARCHAR2 DEFAULT NULL
1913 , p_calling_program       IN VARCHAR2 DEFAULT NULL
1914 , p_stopping_result_type  IN VARCHAR2 DEFAULT NULL
1915 , p_parameter_name_tbl    IN PO_TBL_VARCHAR2000 DEFAULT NULL
1916 , p_parameter_value_tbl   IN PO_TBL_VARCHAR2000 DEFAULT NULL
1917 , x_result_type           IN OUT NOCOPY VARCHAR2
1918 , x_result_set_id         IN OUT NOCOPY NUMBER
1919 , x_results               IN OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
1920 )
1921 IS
1922 d_mod CONSTANT VARCHAR2(100) := D_validate_set;
1923 d_position NUMBER := 0;
1924 d_stmt CONSTANT BOOLEAN := PO_LOG.d_stmt;
1925 
1926 l_result_set_id NUMBER;
1927 l_result_type VARCHAR2(30);
1928 l_val VARCHAR2(2000);
1929 
1930 l_result_rank NUMBER;
1931 l_new_rank NUMBER;
1932 l_stop_rank NUMBER;
1933 
1934 l_create_or_update_item     VARCHAR2(1);
1935 l_chart_of_account_id       NUMBER;
1936 l_po_encumbrance_flag       VARCHAR2(1);
1937 l_operating_unit            NUMBER;
1938 l_expense_accrual_code      PO_SYSTEM_PARAMETERS.expense_accrual_code%TYPE;
1939 l_inventory_org_id          NUMBER;
1940 l_doc_type                  VARCHAR2(25);
1941 l_set_of_books_id           NUMBER;
1942 l_func_currency_code        GL_SETS_OF_BOOKS.currency_code%TYPE;
1943 l_federal_instance          VARCHAR2(1);
1944 l_allow_tax_code_override   VARCHAR2(1);
1945 l_allow_tax_rate_override   VARCHAR2(1);
1946 l_manual_po_num_type        PO_SYSTEM_PARAMETERS.manual_po_num_type%TYPE;
1947 l_manual_quote_num_type     PO_SYSTEM_PARAMETERS.manual_quote_num_type%TYPE;
1948 
1949 BEGIN
1950 
1951 IF PO_LOG.d_proc THEN
1952   PO_LOG.proc_begin(d_mod,'p_validation_set',p_validation_set);
1953   PO_LOG.proc_begin(d_mod,'p_autocommit_results_flag',p_autocommit_results_flag);
1954   PO_LOG.proc_begin(d_mod,'p_calling_program',p_calling_program);
1955   PO_LOG.proc_begin(d_mod,'p_stopping_result_type',p_stopping_result_type);
1956   PO_LOG.proc_begin(d_mod,'p_parameter_name_tbl',p_parameter_name_tbl);
1957   PO_LOG.proc_begin(d_mod,'p_parameter_value_tbl',p_parameter_value_tbl);
1958   PO_LOG.proc_begin(d_mod,'x_result_set_id',x_result_set_id);
1959   PO_LOG.proc_begin(d_mod,'x_result_type',x_result_type);
1960 END IF;
1961 d_position := 1;
1962 
1963 IF (p_parameter_name_tbl IS NOT NULL) THEN
1964 
1965   d_position := 2;
1966 
1967   FOR i IN 1 .. p_parameter_name_tbl.COUNT LOOP
1968 
1969     CASE p_parameter_name_tbl(i)
1970     WHEN 'CREATE_OR_UPDATE_ITEM' THEN
1971        l_create_or_update_item := p_parameter_value_tbl(i);
1972     WHEN 'CHART_OF_ACCOUNT_ID' THEN
1973        l_chart_of_account_id := TO_NUMBER(p_parameter_value_tbl(i));
1974     WHEN 'PO_ENCUMBRANCE_FLAG' THEN
1975        l_po_encumbrance_flag := p_parameter_value_tbl(i);
1976     WHEN 'OPERATING_UNIT' THEN
1977        l_operating_unit := TO_NUMBER(p_parameter_value_tbl(i));
1978     WHEN 'EXPENSE_ACCRUAL_CODE' THEN
1979        l_expense_accrual_code := p_parameter_value_tbl(i);
1980     WHEN 'INVENTORY_ORG_ID' THEN
1981        l_inventory_org_id := p_parameter_value_tbl(i);
1982     WHEN 'DOC_TYPE' THEN
1983        l_doc_type := p_parameter_value_tbl(i);
1984     WHEN 'SET_OF_BOOKS_ID' THEN
1985        l_set_of_books_id := p_parameter_value_tbl(i);
1986     WHEN 'FUNCTIONAL_CURRENCY_CODE' THEN
1987        l_func_currency_code := p_parameter_value_tbl(i);
1988     WHEN 'FEDERAL_INSTANCE' THEN
1989        l_federal_instance := p_parameter_value_tbl(i);
1990     WHEN 'ALLOW_TAX_CODE_OVERRIDE' THEN
1991        l_allow_tax_code_override := p_parameter_value_tbl(i);
1992     WHEN 'ALLOW_TAX_RATE_OVERRIDE' THEN
1993        l_allow_tax_rate_override := p_parameter_value_tbl(i);
1994     WHEN 'MANUAL_PO_NUM_TYPE' THEN
1995        l_manual_po_num_type := p_parameter_value_tbl(i);
1996     WHEN 'MANUAL_QUOTE_NUM_TYPE' THEN
1997        l_manual_quote_num_type := p_parameter_value_tbl(i);
1998     END CASE;
1999 
2000   END LOOP;
2001 
2002 END IF;
2003 
2004 d_position := 5;
2005 
2006 -- Initialize the IN OUT parameters, to enable chaining of validations.
2007 
2008 IF x_result_set_id IS NULL THEN
2009   x_result_set_id := next_result_set_id();
2010 END IF;
2011 
2012 d_position := 10;
2013 
2014 IF (x_result_type IS NULL) THEN
2015   x_result_type := c_result_type_SUCCESS;
2016 END IF;
2017 
2018 IF (x_results IS NULL) THEN
2019   x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
2020 END IF;
2021 
2022 d_position := 20;
2023 
2024 l_result_rank := result_type_rank(x_result_type);
2025 
2026 d_position := 30;
2027 
2028 l_stop_rank := result_type_rank(p_stopping_result_type);
2029 
2030 d_position := 40;
2031 IF d_stmt THEN
2032   PO_LOG.stmt(d_mod,d_position,'x_result_set_id',x_result_set_id);
2033   PO_LOG.stmt(d_mod,d_position,'x_result_type',x_result_type);
2034   PO_LOG.stmt(d_mod,d_position,'l_result_rank',l_result_rank);
2035   PO_LOG.stmt(d_mod,d_position,'l_stop_rank',l_stop_rank);
2036 END IF;
2037 
2038 -- Loop through the validation set, executing each validation in turn.
2039 FOR i IN 1 .. p_validation_set.COUNT LOOP
2040   d_position := 100;
2041 
2042   l_val := p_validation_set(i);
2043   IF d_stmt THEN
2044     PO_LOG.stmt(d_mod,d_position,'p_validation_set('||i||')',l_val);
2045   END IF;
2046 
2047   d_position := 110;
2048 
2049   BEGIN
2050 
2051     CASE l_val
2052 
2053     ---------------------------------------------------------------
2054     -- Header Validations
2055     ---------------------------------------------------------------
2056 
2057     WHEN c_warn_supplier_on_hold THEN
2058       PO_VAL_HEADERS.warn_supplier_on_hold(
2059         p_header_id_tbl => p_headers.po_header_id
2060       , p_vendor_id_tbl => p_headers.vendor_id
2061       , x_result_set_id => l_result_set_id
2062       , x_result_type => l_result_type
2063       );
2064 
2065     WHEN c_rate_gt_zero THEN
2066       PO_VAL_HEADERS.rate_gt_zero(
2067         p_header_id_tbl => p_headers.po_header_id
2068       , p_rate_tbl => p_headers.rate
2069       , x_results => x_results
2070       , x_result_type => l_result_type
2071       );
2072 
2073     WHEN c_fax_email_address_valid THEN
2074       PO_VAL_HEADERS.fax_email_address_valid(
2075         p_header_id_tbl => p_headers.po_header_id
2076       , p_supplier_notif_method_tbl => p_headers.supplier_notif_method
2077       , p_fax_tbl => p_headers.fax
2078       , p_email_address_tbl => p_headers.email_address
2079       , x_results => x_results
2080       , x_result_type => l_result_type
2081       );
2082 
2083     WHEN c_rate_combination_valid THEN
2084       PO_VAL_HEADERS.rate_combination_valid(
2085         p_header_id_tbl => p_headers.po_header_id
2086       , p_org_id_tbl => p_headers.org_id
2087       , p_currency_code_tbl => p_headers.currency_code
2088       , p_rate_type_tbl => p_headers.rate_type
2089       , p_rate_date_tbl => p_headers.rate_date
2090       , p_rate_tbl => p_headers.rate
2091       , x_results => x_results
2092       , x_result_type => l_result_type
2093       );
2094 
2095     WHEN c_doc_num_chars_valid THEN
2096       PO_VAL_HEADERS.doc_num_chars_valid(
2097         p_header_id_tbl => p_headers.po_header_id
2098       , p_org_id_tbl => p_headers.org_id
2099       , p_style_id_tbl => p_headers.style_id
2100       , p_segment1_tbl => p_headers.segment1
2101       , x_results => x_results
2102       , x_result_type => l_result_type
2103       );
2104 
2105     WHEN c_doc_num_unique THEN
2106       PO_VAL_HEADERS.doc_num_unique(
2107         p_header_id_tbl => p_headers.po_header_id
2108       , p_org_id_tbl => p_headers.org_id
2109       , p_segment1_tbl => p_headers.segment1
2110       , p_type_lookup_code_tbl => p_headers.type_lookup_code
2111       , x_results => x_results
2112       , x_result_type => l_result_type
2113       );
2114 
2115     WHEN c_price_update_tol_ge_zero THEN
2116       PO_VAL_HEADERS.price_update_tol_ge_zero(
2117         p_header_id_tbl => p_headers.po_header_id
2118       , p_price_update_tol_tbl => p_headers.price_update_tolerance
2119       , x_results => x_results
2120       , x_result_type => l_result_type
2121       );
2122 
2123     WHEN c_amount_limit_ge_zero THEN
2124       PO_VAL_HEADERS.amount_limit_ge_zero(
2125         p_header_id_tbl => p_headers.po_header_id
2126       , p_amount_limit_tbl => p_headers.amount_limit
2127       , x_results => x_results
2128       , x_result_type => l_result_type
2129       );
2130 
2131     WHEN c_amt_limit_ge_amt_agreed THEN
2132       PO_VAL_HEADERS.amt_limit_ge_amt_agreed(
2133         p_header_id_tbl => p_headers.po_header_id
2134       , p_style_id_tbl =>p_headers.style_id	--Bug 12660599
2135       , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
2136       , p_amount_limit_tbl => p_headers.amount_limit
2137       , x_results => x_results
2138       , x_result_type => l_result_type
2139       );
2140 
2141     WHEN c_amount_agreed_ge_zero THEN
2142       PO_VAL_HEADERS.amount_agreed_ge_zero(
2143         p_header_id_tbl => p_headers.po_header_id
2144       , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
2145       , x_results => x_results
2146       , x_result_type => l_result_type
2147       );
2148 
2149     WHEN c_amount_agreed_not_null THEN
2150       PO_VAL_HEADERS.amount_agreed_not_null(
2151         p_header_id_tbl => p_headers.po_header_id
2152       , p_blanket_total_amount_tbl => p_headers.blanket_total_amount
2153       , p_amount_limit_tbl => p_headers.amount_limit
2154       , x_results => x_results
2155       , x_result_type => l_result_type
2156       );
2157 
2158     WHEN c_effective_le_expiration THEN
2159       PO_VAL_HEADERS.effective_le_expiration(
2160         p_header_id_tbl => p_headers.po_header_id
2161       , p_start_date_tbl => p_headers.start_date
2162       , p_end_date_tbl => p_headers.end_date
2163       , x_results => x_results
2164       , x_result_type => l_result_type
2165       );
2166 
2167     WHEN c_effective_from_le_order_date THEN
2168       PO_VAL_HEADERS.effective_from_le_order_date(
2169         p_header_id_tbl => p_headers.po_header_id
2170       , p_type_lookup_code_tbl => p_headers.type_lookup_code
2171       , p_start_date_tbl => p_headers.start_date
2172       , x_result_set_id => l_result_set_id
2173       , x_result_type => l_result_type
2174       );
2175 
2176     WHEN c_effective_to_ge_order_date THEN
2177       PO_VAL_HEADERS.effective_to_ge_order_date(
2178         p_header_id_tbl => p_headers.po_header_id
2179       , p_type_lookup_code_tbl => p_headers.type_lookup_code
2180       , p_end_date_tbl => p_headers.end_date
2181       , x_result_set_id => l_result_set_id
2182       , x_result_type => l_result_type
2183       );
2184 
2185     WHEN c_contract_start_le_order_date THEN
2186       PO_VAL_HEADERS.contract_start_le_order_date(
2187         p_header_id_tbl => p_headers.po_header_id
2188       , p_type_lookup_code_tbl => p_headers.type_lookup_code
2189       , p_start_date_tbl => p_headers.start_date
2190       , x_result_set_id => l_result_set_id
2191       , x_result_type => l_result_type
2192       );
2193 
2194     WHEN c_contract_end_ge_order_date THEN
2195       PO_VAL_HEADERS.contract_end_ge_order_date(
2196         p_header_id_tbl => p_headers.po_header_id
2197       , p_type_lookup_code_tbl => p_headers.type_lookup_code
2198       , p_end_date_tbl => p_headers.end_date
2199       , x_result_set_id => l_result_set_id
2200       , x_result_type => l_result_type
2201       );
2202 
2203     WHEN c_agent_id_not_null THEN
2204       PO_VAL_HEADERS.agent_id_not_null(
2205         p_header_id_tbl => p_headers.po_header_id
2206       , p_agent_id_tbl => p_headers.agent_id
2207       , x_results => x_results
2208       , x_result_type => l_result_type
2209       );
2210 
2211     WHEN c_hdr_ship_to_loc_not_null THEN
2212       PO_VAL_HEADERS.ship_to_loc_not_null(
2213         p_header_id_tbl => p_headers.po_header_id
2214       , p_ship_to_loc_id_tbl => p_headers.ship_to_location_id
2215       , x_results => x_results
2216       , x_result_type => l_result_type
2217       );
2218 
2219     WHEN c_vendor_id_not_null THEN
2220       PO_VAL_HEADERS.vendor_id_not_null(
2221         p_header_id_tbl => p_headers.po_header_id
2222       , p_vendor_id_tbl => p_headers.vendor_id
2223       , x_results => x_results
2224       , x_result_type => l_result_type
2225       );
2226 
2227     WHEN c_vendor_site_id_not_null THEN
2228       PO_VAL_HEADERS.vendor_site_id_not_null(
2229         p_header_id_tbl => p_headers.po_header_id
2230       , p_vendor_site_id_tbl => p_headers.vendor_site_id
2231       , x_results => x_results
2232       , x_result_type => l_result_type
2233       );
2234 
2235     --<Begin Bug# 5372769> EXCEPTION WHEN SAVE PO WO/ NUMBER IF DOCUMENT NUMBERING IS SET TO MANUAL
2236     WHEN c_segment1_not_null THEN
2237       PO_VAL_HEADERS.segment1_not_null(
2238         p_header_id_tbl => p_headers.po_header_id
2239       , p_segment1_tbl => p_headers.segment1
2240       , p_org_id_tbl => p_headers.org_id
2241       , x_result_set_id => l_result_set_id
2242       , x_result_type => l_result_type
2243       );
2244     --<End 5372769>
2245     --<Start Bug 9213424> Error when the ship_via field has an invalid value.
2246     WHEN c_ship_via_lookup_code_valid THEN
2247      PO_VAL_HEADERS.ship_via_lookup_code_valid(
2248               p_header_id_tbl=> p_headers.po_header_id,
2249               p_ship_via_lookup_code_tbl     => p_headers.ship_via_lookup_code,
2250               --Bug 12409257 begin. Bug 13771850 Revert the Bug 12409257 back
2251 			  p_org_id_tbl => p_headers.org_id,
2252 			  --p_ship_to_location_id_tbl => p_headers.ship_to_location_id,
2253 			  --Bug 12409257 end. Bug 13771850 end
2254               x_result_set_id                => l_result_set_id,
2255               x_result_type                  => l_result_type);
2256    --<End Bug 9213424>
2257 
2258 --Mod project
2259 
2260     WHEN c_print_form_format_valid THEN
2261       PO_VAL_HEADERS.print_form_format_valid(
2262        p_header_id_tbl => p_headers.po_header_id
2263      , p_type_lookup_code_tbl => p_headers.type_lookup_code
2264      , p_style_id_tbl => p_headers.style_id
2265      , p_draft_type_tbl => p_headers.draft_type
2266      , p_clm_standard_form_tbl => p_headers.clm_standard_form
2267      , p_document_format_tbl => p_headers.clm_document_format
2268      , p_clm_src_doc_id_tbl => p_headers.clm_source_document_id
2269      , p_clm_ext_idv_tbl => p_headers.clm_external_idv
2270      , p_clm_award_type_tbl => p_headers.clm_award_type
2271      , x_result_set_id => l_result_set_id
2272      , x_result_type => l_result_type
2273        );
2274 
2275     WHEN c_hmod_no_cancel_shp_complt THEN
2276       PO_VAL_HEADERS.mod_no_cancel_shp_complt(
2277 	p_header_id_tbl => p_headers.po_header_id
2278       , p_control_action_tbl => p_headers.control_action
2279       , x_result_set_id => l_result_set_id
2280       , x_result_type => l_result_type
2281        );
2282 
2283      --<Bug 16474640>
2284      WHEN c_validate_mod_number THEN
2285        PO_VAL_HEADERS.validate_mod_number(
2286         p_header_id_tbl => p_headers.po_header_id
2287       , p_draft_type_tbl => p_headers.draft_type
2288       , p_mod_number_tbl => p_headers.modification_number
2289       , x_results => x_results
2290       , x_result_type => l_result_type
2291        );
2292 
2293 
2294 
2295         -------------------------------------------------------------------------
2296         --  PDOI Header Validation Subroutines
2297         -------------------------------------------------------------------------
2298           WHEN c_po_header_id THEN
2299             -- validate that the PO Header Id is not null and
2300             -- does not already exist in the Transaction table (for create case).
2301             PO_VAL_HEADERS2.po_header_id(p_id_tbl               => p_headers.interface_id,
2302                                          p_po_header_id_tbl     => p_headers.po_header_id,
2303                                          x_result_set_id        => l_result_set_id,
2304                                          x_result_type          => l_result_type);
2305           WHEN c_end_date THEN
2306             -- validate end date not earlier than start date.
2307             PO_VALIDATION_HELPER.start_date_le_end_date(p_calling_module          => p_calling_program,
2308                                                         p_start_date_tbl          => p_headers.start_date,
2309                                                         p_end_date_tbl            => p_headers.end_date,
2310                                                         p_entity_id_tbl           => p_headers.interface_id,
2311                                                         p_entity_type             => c_entity_type_header,
2312                                                         p_column_name             => 'END DATE',
2313                                                         p_column_val_selector     => 'END_DATE',
2314                                                         p_message_name            => 'PO_PDOI_INVALID_END_DATE',
2315                                                         p_validation_id           => PO_VAL_CONSTANTS.c_end_date,
2316                                                         x_results                 => x_results,
2317                                                         x_result_type             => l_result_type);
2318 
2319           WHEN c_type_lookup_code THEN
2320             -- validate type_lookup_code not null and equal to BLANKET, STANDARD or QUOTATION.
2321             PO_VAL_HEADERS2.type_lookup_code(p_id_tbl                   => p_headers.interface_id,
2322                                              p_type_lookup_code_tbl     => p_headers.type_lookup_code,
2323                                              x_results                  => x_results,
2324                                              x_result_type              => l_result_type);
2325           WHEN c_document_num THEN
2326             -- document_num must not be null, must be unique, greater than or equal to zero and be of the correct type.
2327             PO_VAL_HEADERS2.document_num(p_id_tbl                   => p_headers.interface_id,
2328                                          p_po_header_id_tbl         => p_headers.po_header_id,
2329                                          p_document_num_tbl         => p_headers.document_num,
2330                                          p_type_lookup_code_tbl     => p_headers.type_lookup_code,
2331                                          p_manual_po_num_type       => l_manual_po_num_type,
2332                                          p_manual_quote_num_type    => l_manual_quote_num_type,
2333                                          x_results                  => x_results,
2334                                          x_result_set_id            => l_result_set_id,
2335                                          x_result_type              => l_result_type);
2336 
2337           WHEN c_acceptance_required_flag THEN
2338             -- bug4911383
2339             PO_VAL_HEADERS2.acceptance_required_flag
2340             ( p_id_tbl                       => p_headers.interface_id,
2341               p_type_lookup_code_tbl         => p_headers.type_lookup_code,
2342               p_acceptance_required_flag_tbl => p_headers.acceptance_required_flag,
2343               x_results                      => x_results,
2344               x_result_type                  => l_result_type
2345             );
2346 
2347 
2348           WHEN c_revision_num THEN
2349             -- validate revision_num is zero.
2350             PO_VALIDATION_HELPER.zero(p_calling_module     => p_calling_program,
2351                                       p_value_tbl          => p_headers.revision_num,
2352                                       p_entity_id_tbl      => p_headers.interface_id,
2353                                       p_entity_type        => c_entity_type_header,
2354                                       p_column_name        => 'REVISION_NUM',
2355                                       p_message_name       => 'PO_PDOI_COLUMN_ZERO',
2356                                       p_validation_id      => PO_VAL_CONSTANTS.c_revision_num,
2357                                       x_results            => x_results,
2358                                       x_result_type        => l_result_type);
2359           WHEN c_currency_code THEN
2360             -- validate currency_code is not null and valid in FND_CURRENCIES.
2361             PO_VAL_HEADERS2.currency_code(p_id_tbl                => p_headers.interface_id,
2362                                           p_currency_code_tbl     => p_headers.currency_code,
2363                                           x_result_set_id         => l_result_set_id,
2364                                           x_result_type           => l_result_type);
2365           WHEN c_rate_info THEN
2366             -- validate rate information
2367             PO_VAL_HEADERS2.rate_info(p_id_tbl                => p_headers.interface_id,
2368                                       p_currency_code_tbl     => p_headers.currency_code,
2369                                       p_rate_type_tbl         => p_headers.rate_type,
2370                                       p_rate_tbl              => p_headers.rate,
2371                                       p_rate_date_tbl         => p_headers.rate_date,
2372                                       p_func_currency_code    => l_func_currency_code,
2373                                       p_set_of_books_id       => l_set_of_books_id,
2374                                       x_result_set_id         => l_result_set_id,
2375                                       x_results               => x_results,
2376                                       x_result_type           => l_result_type);
2377           WHEN c_agent_id THEN
2378             -- validate agent_id is not null and valid in PO_AGENTS.
2379             PO_VAL_HEADERS2.agent_id(p_id_tbl            => p_headers.interface_id,
2380                                      p_agent_id_tbl      => p_headers.agent_id,
2381                                      x_result_set_id     => l_result_set_id,
2382                                      x_result_type       => l_result_type);
2383           WHEN c_vendor_info THEN
2384             -- validate vendor information
2385             PO_VAL_HEADERS2.vendor_info(p_id_tbl                    => p_headers.interface_id,
2386                                         p_vendor_id_tbl             => p_headers.vendor_id,
2387                                         p_vendor_site_id_tbl        => p_headers.vendor_site_id,
2388                                         p_vendor_contact_id_tbl     => p_headers.vendor_contact_id,
2389 					p_type_lookup_code_tbl      => p_headers.type_lookup_code, -- 8913559 bug
2390                                         p_federal_instance          => l_federal_instance,
2391                                         x_result_set_id             => l_result_set_id,
2392                                         x_results                   => x_results,
2393                                         x_result_type               => l_result_type);
2394           WHEN c_ship_to_location_id THEN
2395             PO_VAL_HEADERS2.ship_to_location_id(p_id_tbl                      => p_headers.interface_id,
2396                                                 p_ship_to_location_id_tbl     => p_headers.ship_to_location_id,
2397                                                 -- Bug 7007502: Added new param p_type_lookup_code_tbl
2398                                                 p_type_lookup_code_tbl        => p_headers.type_lookup_code,
2399                                                 x_result_set_id               => l_result_set_id,
2400                                                 x_result_type                 => l_result_type);
2401           WHEN c_bill_to_location_id THEN
2402             PO_VAL_HEADERS2.bill_to_location_id(p_id_tbl                      => p_headers.interface_id,
2403                                                 p_bill_to_location_id_tbl     => p_headers.bill_to_location_id,
2404                                                 -- Bug 7007502: Added new param p_type_lookup_code_tbl
2405                                                 p_type_lookup_code_tbl        => p_headers.type_lookup_code,
2406                                                 x_result_set_id               => l_result_set_id,
2407                                                 x_result_type                 => l_result_type);
2408           WHEN c_style_id THEN
2409             PO_VAL_HEADERS2.style_id(p_id_tbl                      => p_headers.interface_id,
2410                                      p_style_id_tbl                => p_headers.style_id,
2411                                      x_result_set_id               => l_result_set_id,
2412                                      x_result_type                 => l_result_type);
2413           WHEN c_last_update_date THEN
2414             PO_VALIDATION_HELPER.not_null(p_calling_module     => p_calling_program,
2415                                           p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.last_update_date),
2416                                           p_entity_id_tbl      => p_headers.interface_id,
2417                                           p_entity_type        => c_entity_type_header,
2418                                           p_column_name        => 'LAST_UPDATE_DATE',
2419                                           p_message_name       => 'PO_PDOI_COLUMN_NOT_NULL',
2420                                           p_validation_id      => PO_VAL_CONSTANTS.c_last_update_date,
2421                                           x_results            => x_results,
2422                                           x_result_type        => l_result_type);
2423           WHEN c_last_updated_by THEN
2424             PO_VALIDATION_HELPER.not_null(p_calling_module     => p_calling_program,
2425                                           p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.last_updated_by),
2426                                           p_entity_id_tbl      => p_headers.interface_id,
2427                                           p_entity_type        => c_entity_type_header,
2428                                           p_column_name        => 'LAST_UPDATED_BY',
2429                                           p_message_name       => 'PO_PDOI_COLUMN_NOT_NULL',
2430                                           p_validation_id      => PO_VAL_CONSTANTS.c_last_updated_by,
2431                                           x_results            => x_results,
2432                                           x_result_type        => l_result_type);
2433           WHEN c_po_release_id THEN
2434             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2435                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.po_release_id),
2436                                              p_entity_id_tbl      => p_headers.interface_id,
2437                                              p_entity_type        => c_entity_type_header,
2438                                              p_column_name        => 'PO_RELEASE_ID',
2439                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2440                                              p_token1_name        => 'COLUMN_NAME',
2441                                              p_token1_value       => 'PO_RELEASE_ID',
2442                                              p_token2_name        => 'VALUE',
2443                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.po_release_id),
2444                                              p_validation_id      => PO_VAL_CONSTANTS.c_po_release_id,
2445 											 x_results            => x_results,
2446                                              x_result_type        => l_result_type);
2447           WHEN c_release_num THEN
2448             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2449                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_num),
2450                                              p_entity_id_tbl      => p_headers.interface_id,
2451                                              p_entity_type        => c_entity_type_header,
2452                                              p_column_name        => 'RELEASE_NUM',
2453                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2454                                              p_token1_name        => 'COLUMN_NAME',
2455                                              p_token1_value       => 'RELEASE_NUM',
2456                                              p_token2_name        => 'VALUE',
2457                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_num),
2458                                              p_validation_id      => PO_VAL_CONSTANTS.c_release_num,
2459 											 x_results            => x_results,
2460                                              x_result_type        => l_result_type);
2461           WHEN c_release_date THEN
2462             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2463                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_date),
2464                                              p_entity_id_tbl      => p_headers.interface_id,
2465                                              p_entity_type        => c_entity_type_header,
2466                                              p_column_name        => 'RELEASE_DATE',
2467                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2468                                              p_token1_name        => 'COLUMN_NAME',
2469                                              p_token1_value       => 'RELEASE_DATE',
2470                                              p_token2_name        => 'VALUE',
2471                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.release_date),
2472                                              p_validation_id      => PO_VAL_CONSTANTS.c_release_date,
2473 											 x_results            => x_results,
2474                                              x_result_type        => l_result_type);
2475           WHEN c_revised_date THEN
2476             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2477                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.revised_date),
2478                                              p_entity_id_tbl      => p_headers.interface_id,
2479                                              p_entity_type        => c_entity_type_header,
2480                                              p_column_name        => 'REVISED_DATE',
2481                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2482                                              p_token1_name        => 'COLUMN_NAME',
2483                                              p_token1_value       => 'REVISED_DATE',
2484                                              p_token2_name        => 'VALUE',
2485                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.revised_date),
2486                                              p_validation_id      => PO_VAL_CONSTANTS.c_revised_date,
2487 											 x_results            => x_results,
2488                                              x_result_type        => l_result_type);
2489           WHEN c_printed_date THEN
2490             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2491                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.printed_date),
2492                                              p_entity_id_tbl      => p_headers.interface_id,
2493                                              p_entity_type        => c_entity_type_header,
2494                                              p_column_name        => 'PRINTED_DATE',
2495                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2496                                              p_token1_name        => 'COLUMN_NAME',
2497                                              p_token1_value       => 'PRINTED_DATE',
2498                                              p_token2_name        => 'VALUE',
2499                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.printed_date),
2500                                              p_validation_id      => PO_VAL_CONSTANTS.c_printed_date,
2501 											 x_results            => x_results,
2502                                              x_result_type        => l_result_type);
2503           WHEN c_closed_date THEN
2504             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
2505                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.closed_date),
2506                                              p_entity_id_tbl      => p_headers.interface_id,
2507                                              p_entity_type        => c_entity_type_header,
2508                                              p_column_name        => 'CLOSED_DATE',
2509                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
2510                                              p_token1_name        => 'COLUMN_NAME',
2511                                              p_token1_value       => 'CLOSED_DATE',
2512                                              p_token2_name        => 'VALUE',
2513                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.closed_date),
2514                                              p_validation_id      => PO_VAL_CONSTANTS.c_closed_date,
2515 											 x_results            => x_results,
2516                                              x_result_type        => l_result_type);
2517           WHEN c_terms_id_header THEN
2518             PO_VALIDATION_HELPER.terms_id(p_calling_module     => p_calling_program,
2519                                           p_terms_id_tbl       => p_headers.terms_id,
2520                                           p_entity_id_tbl      => p_headers.interface_id,
2521                                           p_entity_type        => c_entity_type_header,
2522                                           p_validation_id      => PO_VAL_CONSTANTS.c_terms_id_header,
2523                                           x_result_set_id      => l_result_set_id,
2524                                           x_result_type        => l_result_type);
2525           WHEN c_ship_via_lookup_code THEN
2526             PO_VAL_HEADERS2.ship_via_lookup_code(p_id_tbl                       => p_headers.interface_id,
2527                                                  p_ship_via_lookup_code_tbl     => p_headers.ship_via_lookup_code,
2528                                                  p_inventory_org_id             => l_inventory_org_id,
2529                                                  x_result_set_id                => l_result_set_id,
2530                                                  x_result_type                  => l_result_type);
2531           WHEN c_fob_lookup_code THEN
2532             PO_VAL_HEADERS2.fob_lookup_code(p_id_tbl                  => p_headers.interface_id,
2533                                             p_fob_lookup_code_tbl     => p_headers.fob_lookup_code,
2534                                             x_result_set_id           => l_result_set_id,
2535                                             x_result_type             => l_result_type);
2536           WHEN c_freight_terms_lookup_code THEN
2537             PO_VAL_HEADERS2.freight_terms_lookup_code(p_id_tbl                       => p_headers.interface_id,
2538                                                       p_freight_terms_lookup_tbl     => p_headers.freight_terms_lookup_code,
2539                                                       x_result_set_id                => l_result_set_id,
2540                                                       x_result_type                  => l_result_type);
2541           WHEN c_shipping_control THEN
2542             PO_VAL_HEADERS2.shipping_control(p_id_tbl                   => p_headers.interface_id,
2543                                              p_shipping_control_tbl     => p_headers.shipping_control,
2544                                              x_result_set_id            => l_result_set_id,
2545                                              x_result_type              => l_result_type);
2546           WHEN c_confirming_order_flag THEN
2547             PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module     => p_calling_program,
2548                                                 p_flag_value_tbl     => p_headers.confirming_order_flag,
2549                                                 p_entity_id_tbl      => p_headers.interface_id,
2550                                                 p_entity_type        => c_entity_type_header,
2551                                                 p_column_name        => 'CONFIRMING_ORDER_FLAG',
2552                                                 p_message_name       => 'PO_PDOI_INVALID_FLAG_VALUE',
2553                                                 p_token1_name        => 'COLUMN_NAME',
2554                                                 p_token1_value       => 'CONFIRMING_ORDER_FLAG',
2555                                                 p_token2_name        => 'VALUE',
2556                                                 p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.confirming_order_flag),
2557                                                 p_validation_id      => PO_VAL_CONSTANTS.c_confirming_order_flag,
2558 												x_results            => x_results,
2559                                                 x_result_type        => l_result_type);
2560           WHEN c_acceptance_due_date THEN
2561             PO_VAL_HEADERS2.acceptance_due_date(p_id_tbl                       => p_headers.interface_id,
2562                                                 p_acceptance_reqd_flag_tbl     => p_headers.acceptance_required_flag,
2563                                                 p_acceptance_due_date_tbl      => p_headers.acceptance_due_date,
2564                                                 x_results                      => x_results,
2565                                                 x_result_type                  => l_result_type);
2566           WHEN c_amount_agreed THEN
2567             PO_VALIDATION_HELPER.greater_or_equal_zero(p_calling_module     => p_calling_program,
2568                                                        p_null_allowed_flag  => PO_CORE_S.g_parameter_YES, -- bug5008206
2569                                                        p_value_tbl          => p_headers.amount_agreed,
2570                                                        p_entity_id_tbl      => p_headers.interface_id,
2571                                                        p_entity_type        => c_entity_type_header,
2572                                                        p_column_name        => c_amount_agreed,
2573                                                        p_message_name       => 'PO_PDOI_LT_ZERO',
2574                                                        p_token1_name        => 'COLUMN_NAME',
2575                                                        p_token1_value       => 'AMOUNT_AGREED',
2576                                                        p_token2_name        => 'VALUE',
2577                                                        p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.amount_agreed),
2578                                                        p_validation_id      => PO_VAL_CONSTANTS.c_amount_agreed,
2579                                                        x_results            => x_results,
2580                                                        x_result_type        => l_result_type);
2581           WHEN c_amount_limit THEN
2582             -- bug 5352625
2583             PO_VAL_HEADERS2.amount_limit
2584             ( p_id_tbl => p_headers.interface_id,
2585               p_amount_limit_tbl => p_headers.amount_limit,
2586               p_amount_agreed_tbl => p_headers.amount_agreed,
2587               x_results => x_results,
2588               x_result_type => l_result_type
2589             );
2590 
2591           WHEN c_firm_status_lookup_header THEN
2592             PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module     => p_calling_program,
2593                                                 p_flag_value_tbl     => PO_TYPE_CONVERTER.to_po_tbl_varchar1(p_headers.firm_status_lookup_code),
2594                                                 p_entity_id_tbl      => p_headers.interface_id,
2595                                                 p_entity_type        => c_entity_type_header,
2596                                                 p_column_name        => 'FIRM_STATUS_LOOKUP_CODE',
2597                                                 p_message_name       => 'PO_PDOI_INVALID_FLAG_VALUE',
2598                                                 p_token1_name        => 'COLUMN_NAME',
2599                                                 p_token1_value       => 'FIRM_STATUS_LOOKUP_CODE',
2600                                                 p_token2_name        => 'VALUE',
2601                                                 p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.firm_status_lookup_code),
2602                                                 p_validation_id      => PO_VAL_CONSTANTS.c_firm_status_lookup_header,
2603                         x_results            => x_results,
2604                                                 x_result_type        => l_result_type);
2605           WHEN c_cancel_flag THEN
2606             PO_VAL_HEADERS2.cancel_flag(p_id_tbl              => p_headers.interface_id,
2607                                         p_cancel_flag_tbl     => p_headers.cancel_flag,
2608                                         x_results             => x_results,
2609                                         x_result_type         => l_result_type);
2610           WHEN c_closed_code THEN
2611             PO_VAL_HEADERS2.closed_code(p_id_tbl                       => p_headers.interface_id,
2612                                         p_closed_code_tbl              => p_headers.closed_code,
2613                                         p_acceptance_reqd_flag_tbl     => p_headers.acceptance_required_flag,
2614                                         x_results                      => x_results,
2615                                         x_result_type                  => l_result_type);
2616           WHEN c_print_count THEN
2617             PO_VAL_HEADERS2.print_count(p_id_tbl                  => p_headers.interface_id,
2618                                         p_print_count_tbl         => p_headers.print_count,
2619                                         p_approval_status_tbl     => p_headers.approval_status,
2620                                         x_results                 => x_results,
2621                                         x_result_type             => l_result_type);
2622           WHEN c_frozen_flag THEN
2623             PO_VALIDATION_HELPER.flag_value_y_n(p_calling_module     => p_calling_program,
2624                                                 p_flag_value_tbl     => p_headers.frozen_flag,
2625                                                 p_entity_id_tbl      => p_headers.interface_id,
2626                                                 p_entity_type        => c_entity_type_header,
2627                                                 p_column_name        => 'FROZEN_FLAG',
2628                                                 p_message_name       => 'PO_PDOI_INVALID_FLAG_VALUE',
2629                                                 p_token1_name        => 'COLUMN_NAME',
2630                                                 p_token1_value       => 'FROZEN_FLAG',
2631                                                 p_token2_name        => 'VALUE',
2632                                                 p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.frozen_flag),
2633                                                 p_validation_id      => PO_VAL_CONSTANTS.c_frozen_flag,
2634                                                 x_results            => x_results,
2635                                                 x_result_type        => l_result_type);
2636           WHEN c_approval_status THEN
2637             PO_VAL_HEADERS2.approval_status(p_id_tbl                  => p_headers.interface_id,
2638                                             p_approval_status_tbl     => p_headers.approval_status,
2639                                             x_results                 => x_results,
2640                                             x_result_type             => l_result_type);
2641           WHEN c_amount_to_encumber THEN
2642             PO_VAL_HEADERS2.amount_to_encumber(p_id_tbl                     => p_headers.interface_id,
2643                                                p_amount_to_encumber_tbl     => p_headers.amount_to_encumber,
2644                                                x_results                    => x_results,
2645                                                x_result_type                => l_result_type);
2646           WHEN c_quote_warning_delay THEN
2647             PO_VALIDATION_HELPER.not_null(p_calling_module     => p_calling_program,
2648                                           p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.quote_warning_delay),
2649                                           p_entity_id_tbl      => p_headers.interface_id,
2650                                           p_entity_type        => c_entity_type_header,
2651                                           p_column_name        => 'QUOTE_WARNING_DELAY',
2652                                           p_message_name       => 'PO_PDOI_COLUMN_NOT_NULL',
2653                                           p_token1_name        => 'COLUMN_NAME',
2654                                           p_token1_value       => 'QUOTE_WARNING_DELAY',
2655                                           p_token2_name        => 'VALUE',
2656                                           p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.quote_warning_delay),
2657                                           p_validation_id      => PO_VAL_CONSTANTS.c_quote_warning_delay,
2658                       x_results            => x_results,
2659                                           x_result_type        => l_result_type);
2660           WHEN c_approval_required_flag THEN
2661             PO_VALIDATION_HELPER.not_null(p_calling_module     => p_calling_program,
2662                                           p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.approval_required_flag),
2663                                           p_entity_id_tbl      => p_headers.interface_id,
2664                                           p_entity_type        => c_entity_type_header,
2665                                           p_column_name        => 'APPROVAL_REQUIRED_FLAG',
2666                                           p_message_name       => 'PO_PDOI_COLUMN_NOT_NULL',
2667                                           p_token1_name        => 'COLUMN_NAME',
2668                                           p_token1_value       => 'APPROVAL_REQUIRED_FLAG',
2669                                           p_token2_name        => 'VALUE',
2670                                           p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_headers.approval_required_flag),
2671                                           p_validation_id      => PO_VAL_CONSTANTS.c_approval_required_flag,
2672                       x_results            => x_results,
2673                                           x_result_type        => l_result_type);
2674 
2675         WHEN c_ord_st_dt_gt_effec_dt THEN
2676         -- validate order start date not earlier than effective date.
2677             PO_VAL_HEADERS.clm_eff_from_le_order_date
2678             (
2679                 p_header_id_tbl            => p_headers.po_header_id
2680               , p_type_lookup_code_tbl     => p_headers.type_lookup_code
2681               , p_start_date_tbl           => p_headers.start_date
2682               , p_clm_effective_date_tbl   => p_headers.clm_effective_date
2683               , x_result_set_id            => l_result_set_id
2684               , x_result_type              => l_result_type
2685             );
2686 
2687         WHEN c_max_ceil_awd_amt_gt_min THEN
2688         -- validate order start date not earlier than effective date.
2689             PO_VAL_HEADERS.max_ceil_awd_amt_gt_min
2690             (
2691                 p_header_id_tbl            => p_headers.po_header_id
2692               , p_type_lookup_code_tbl     => p_headers.type_lookup_code
2693               , p_amount_limit_tbl         => p_headers.amount_limit
2694               , p_min_grnt_awd_amt_tbl     => p_headers.clm_min_guarantee_award_amt
2695               , x_result_set_id            => l_result_set_id
2696               , x_result_type              => l_result_type
2697             );
2698 
2699         WHEN c_max_ceil_amt_gt_min_ord THEN
2700             PO_VAL_HEADERS.max_ceil_amt_gt_min_ord
2701             (
2702                 p_header_id_tbl            => p_headers.po_header_id
2703               , p_type_lookup_code_tbl     => p_headers.type_lookup_code
2704               , p_amount_limit_tbl         => p_headers.amount_limit
2705               , p_min_order_amt_tbl        => p_headers.clm_min_order_amount
2706               , x_result_set_id            => l_result_set_id
2707               , x_result_type              => l_result_type
2708             );
2709 
2710         WHEN c_max_ceil_amt_gt_max_ord THEN
2711             PO_VAL_HEADERS.max_ceil_amt_gt_max_ord
2712             (
2713                 p_header_id_tbl            => p_headers.po_header_id
2714               , p_type_lookup_code_tbl     => p_headers.type_lookup_code
2715               , p_amount_limit_tbl         => p_headers.amount_limit
2716               , p_max_order_amt_tbl        => p_headers.clm_max_order_amount
2717               , x_result_set_id            => l_result_set_id
2718               , x_result_type              => l_result_type
2719             );
2720 
2721         WHEN c_min_guar_perc_range_check THEN
2722             PO_VAL_HEADERS.min_guar_perc_range_check(
2723               p_header_id_tbl           => p_headers.po_header_id
2724             , p_min_guar_perc_tbl       => p_headers.clm_min_guarantee_award_perc
2725             , x_results                 => x_results
2726             , x_result_type             => l_result_type
2727             );
2728 
2729         WHEN c_max_ord_amt_gt_min THEN
2730         -- validate order start date not earlier than effective date.
2731             PO_VAL_HEADERS.max_ord_amt_gt_min
2732             (
2733                 p_header_id_tbl            => p_headers.po_header_id
2734               , p_type_lookup_code_tbl     => p_headers.type_lookup_code
2735               , p_min_order_amt_tbl        => p_headers.clm_min_order_amount
2736               , p_max_order_amt_tbl        => p_headers.clm_max_order_amount
2737               , x_result_set_id            => l_result_set_id
2738               , x_result_type              => l_result_type
2739             );
2740 
2741         --PDOI CLM Integration Start
2742 
2743 
2744         WHEN c_validate_clm_standard_form THEN
2745             PO_VAL_HEADERS.validate_clm_standard_form
2746             (
2747               p_intf_header_id        =>  p_headers.interface_id,
2748               p_clm_standard_form_tbl =>  p_headers.clm_standard_form,
2749               p_style_id_tbl          => p_headers.style_id,
2750               x_results               => x_results,
2751               x_result_type           => l_result_type
2752             );
2753         WHEN c_validate_clm_document_format THEN
2754             PO_VAL_HEADERS.validate_clm_document_format
2755             (
2756               p_intf_header_id        =>  p_headers.interface_id,
2757               p_clm_standard_form_tbl =>  p_headers.clm_standard_form,
2758               p_clm_document_format_tbl =>  p_headers.clm_document_format,
2759               p_style_id_tbl          => p_headers.style_id,
2760               x_results               => x_results,
2761               x_result_type           => l_result_type
2762             );
2763         WHEN c_validate_source_idv THEN
2764             PO_VAL_HEADERS.validate_source_idv
2765             (
2766               p_intf_header_id        =>  p_headers.interface_id,
2767               p_src_doc_id_tbl        =>  p_headers.clm_source_document_id,
2768               p_currency_code_tbl         =>  p_headers.currency_code,
2769               p_org_id_tbl                =>  p_headers.org_id,
2770               x_results               =>  x_results,
2771               x_result_type           =>  l_result_type
2772             );
2773         WHEN c_validate_award_admin THEN
2774             PO_VAL_HEADERS.validate_award_admin
2775             (
2776               p_intf_header_id        =>  p_headers.interface_id,
2777               p_award_admin_tbl       =>  p_headers.clm_award_administrator,
2778               x_results               =>  x_results,
2779               x_result_type           =>  l_result_type
2780             );
2781         WHEN c_validate_contract_officer THEN
2782             PO_VAL_HEADERS.validate_contract_officer
2783             (
2784               p_intf_header_id        =>  p_headers.interface_id,
2785               p_contract_officer_tbl  =>  p_headers.clm_contract_officer,
2786               x_results               =>  x_results,
2787               x_result_type           =>  l_result_type
2788             );
2789         WHEN c_validate_umbrella_program_id THEN
2790             PO_VAL_HEADERS.validate_umbrella_program_id
2791             (
2792               p_intf_header_id        =>  p_headers.interface_id,
2793               p_umbrella_program_id_tbl =>  p_headers.umbrella_program_id,
2794               p_src_doc_id_tbl        =>  p_headers.clm_source_document_id,
2795               x_results               =>  x_results,
2796               x_result_type           =>  l_result_type
2797             );
2798         WHEN c_validate_clm_award_type THEN
2799             PO_VAL_HEADERS.validate_clm_award_type
2800             (
2801               p_intf_header_id        =>  p_headers.interface_id,
2802               p_clm_award_type_tbl    =>  p_headers.clm_award_type,
2803               p_type_lookup_code_tbl  =>  p_headers.type_lookup_code,
2804               x_results               =>  x_results,
2805               x_result_type           =>  l_result_type
2806             );
2807         WHEN c_validate_style_id THEN
2808             PO_VAL_HEADERS.validate_style_id
2809             (
2810               p_intf_header_id        =>  p_headers.interface_id,
2811               p_style_id_tbl          =>  p_headers.style_id,
2812               x_results               =>  x_results,
2813               x_result_type           =>  l_result_type
2814             );
2815         WHEN c_validate_idv_style_id THEN
2816             PO_VAL_HEADERS.validate_idv_style_id
2817             (
2818               p_intf_header_id             =>  p_headers.interface_id,
2819               p_style_id_tbl               =>  p_headers.style_id,
2820               p_clm_source_document_id_tbl =>  p_headers.clm_source_document_id,
2821               x_results                    =>  x_results,
2822               x_result_type                =>  l_result_type
2823             );
2824         WHEN c_val_po_idv_vendor_site_id THEN
2825             PO_VAL_HEADERS.validate_po_idv_vendor_site_id
2826             (
2827               p_intf_header_id             =>  p_headers.interface_id,
2828               p_vendor_site_id_tbl         =>  p_headers.vendor_site_id,
2829               p_clm_source_document_id_tbl =>  p_headers.clm_source_document_id,
2830               x_results                    =>  x_results,
2831               x_result_type                =>  l_result_type
2832             );
2833         WHEN c_validate_po_idv_vendor_id THEN
2834             PO_VAL_HEADERS.validate_po_idv_vendor_id
2835             (
2836               p_intf_header_id             =>  p_headers.interface_id,
2837               p_vendor_id_tbl              =>  p_headers.vendor_id,
2838               p_clm_source_document_id_tbl =>  p_headers.clm_source_document_id,
2839               x_results                    =>  x_results,
2840               x_result_type                =>  l_result_type
2841             );
2842         --CLM PDOi Integration Ends
2843     ---------------------------------------------------------------
2844     -- Line Validations
2845     ---------------------------------------------------------------
2846 
2847     WHEN c_amt_agreed_ge_zero THEN
2848       PO_VAL_LINES.amt_agreed_ge_zero(
2849         p_line_id_tbl => p_lines.po_line_id
2850       , p_committed_amount_tbl => p_lines.committed_amount
2851       , x_results => x_results
2852       , x_result_type => l_result_type
2853       );
2854 
2855     WHEN c_min_rel_amt_ge_zero THEN
2856       PO_VAL_LINES.min_rel_amt_ge_zero(
2857         p_line_id_tbl => p_lines.po_line_id
2858       , p_min_release_amount_tbl => p_lines.min_release_amount
2859       , x_results => x_results
2860       , x_result_type => l_result_type
2861       );
2862 
2863     WHEN c_line_qty_gt_zero THEN
2864       PO_VAL_LINES.quantity_gt_zero(
2865         p_line_id_tbl => p_lines.po_line_id
2866       , p_quantity_tbl => p_lines.quantity
2867       , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2868       , p_clm_info_flag_tbl => p_lines.clm_info_flag --CLM Changes
2869       , p_cost_constraint_tbl => p_lines.cost_constraint --CLM Changes
2870       , x_results =>  x_results
2871       , x_result_type => l_result_type
2872 	  , p_header_id_tbl => p_lines.po_header_id  --<Bug 15871378>
2873       );
2874 
2875 -- bug 8633959 start
2876  	     WHEN c_validate_category THEN
2877  	        PO_VAL_LINES2.category_combination_valid(
2878  	           p_po_line_id_tbl => p_lines.po_line_id
2879  	         , p_category_id_tbl => p_lines.category_id
2880 		 , p_clm_info_flag_tbl => p_lines.clm_info_flag --Bug 12768893
2881  	         , x_results => x_results
2882  	         , x_result_type => l_result_type
2883  	         );
2884  	     -- bug 8633959 end
2885 
2886     -- <Complex Work R12 Start>: Consolidate qty rcvd/billed check
2887     WHEN c_line_qty_ge_qty_exec THEN
2888       PO_VAL_LINES.quantity_ge_quantity_exec(
2889         p_line_id_tbl => p_lines.po_line_id
2890       , p_quantity_tbl => p_lines.quantity
2891       , x_result_set_id => l_result_set_id
2892       , x_result_type => l_result_type
2893       );
2894     -- <Complex Work R12 End>
2895 
2896     WHEN c_line_qty_ge_qty_enc THEN
2897       PO_VAL_LINES.quantity_ge_quantity_enc(
2898         p_line_id_tbl => p_lines.po_line_id
2899       , p_quantity_tbl => p_lines.quantity
2900       , x_result_set_id => l_result_set_id
2901       , x_result_type => l_result_type
2902       );
2903 
2904     WHEN c_quantity_notif_change THEN
2905       PO_VAL_LINES.quantity_notif_change(
2906         p_line_id_tbl => p_lines.po_line_id
2907       , p_quantity_tbl => p_lines.quantity
2908       , x_result_set_id => l_result_set_id
2909       , x_result_type => l_result_type
2910       );
2911 
2912     WHEN c_line_amt_gt_zero THEN
2913       PO_VAL_LINES.amount_gt_zero(
2914         p_line_id_tbl => p_lines.po_line_id
2915       , p_amount_tbl => p_lines.amount
2916       , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
2917       , p_clm_info_flag_tbl => p_lines.clm_info_flag
2918       , p_cost_constraint_tbl => p_lines.cost_constraint --CLM Changes
2919       , x_results => x_results
2920       , x_result_type => l_result_type
2921 	  , p_header_id_tbl => p_lines.po_header_id  --<bug 15871378 >
2922       );
2923 
2924     -- <Complex Work R12 Start>: Consolidate amt rcvd/billed check
2925     WHEN c_line_amt_ge_amt_exec THEN
2926       PO_VAL_LINES.amount_ge_amount_exec(
2927         p_line_id_tbl => p_lines.po_line_id
2928       , p_amount_tbl => p_lines.amount
2929       , p_currency_code_tbl => p_lines.hdr_currency_code
2930       , x_result_set_id => l_result_set_id
2931       , x_result_type => l_result_type
2932       );
2933     -- <Complex Work R12 End>
2934 
2935     WHEN c_line_amt_ge_timecard THEN
2936       PO_VAL_LINES.amount_ge_timecard(
2937         p_line_id_tbl => p_lines.po_line_id
2938       , p_amount_tbl => p_lines.amount
2939       , x_results => x_results
2940       , x_result_type => l_result_type
2941       );
2942 
2943     WHEN c_line_num_unique THEN
2944       PO_VAL_LINES.line_num_unique(
2945         p_line_id_tbl => p_lines.po_line_id
2946       , p_header_id_tbl => p_lines.po_header_id
2947       , p_line_num_tbl => p_lines.line_num
2948       , p_par_draft_id_tbl => p_lines.PAR_DRAFT_ID -- <PAR Project>
2949       , p_draft_id_tbl => p_lines.DRAFT_ID -- <PAR Project>
2950       , x_result_set_id => l_result_set_id
2951       , x_result_type => l_result_type
2952       );
2953 
2954     WHEN c_line_num_gt_zero THEN
2955       PO_VAL_LINES.line_num_gt_zero(
2956         p_line_id_tbl => p_lines.po_line_id
2957       , p_line_num_tbl => p_lines.line_num
2958       , x_results => x_results
2959       , x_result_type => l_result_type
2960       );
2961 
2962     WHEN c_vmi_asl_exists THEN
2963       PO_VAL_LINES.vmi_asl_exists(
2964         p_line_id_tbl => p_lines.po_line_id
2965       , p_type_lookup_code_tbl => p_lines.hdr_type_lookup_code
2966       , p_item_id_tbl => p_lines.item_id
2967       -- Bug# 4634769: Pass in the inventory org id
2968       , p_org_id_tbl => p_lines.inventory_org_id
2969       , p_vendor_id_tbl => p_lines.hdr_vendor_id
2970       , p_vendor_site_id_tbl => p_lines.hdr_vendor_site_id
2971       , x_result_set_id => l_result_set_id
2972       , x_result_type => l_result_type
2973       );
2974 
2975     WHEN c_start_date_le_end_date THEN
2976       PO_VAL_LINES.start_date_le_end_date(
2977         p_line_id_tbl => p_lines.po_line_id
2978       , p_start_date_tbl => p_lines.start_date
2979       , p_expiration_date_tbl => p_lines.expiration_date
2980       , x_results => x_results
2981       , x_result_type => l_result_type
2982       );
2983 
2984     WHEN c_otl_inv_start_date_change THEN
2985       PO_VAL_LINES.otl_invalid_start_date_change(
2986         p_line_id_tbl => p_lines.po_line_id
2987       , p_start_date_tbl => p_lines.start_date
2988       , x_results => x_results
2989       , x_result_type => l_result_type
2990       );
2991 
2992     WHEN c_otl_inv_end_date_change THEN
2993       PO_VAL_LINES.otl_invalid_end_date_change(
2994         p_line_id_tbl => p_lines.po_line_id
2995       , p_expiration_date_tbl => p_lines.expiration_date
2996       , x_results => x_results
2997       , x_result_type => l_result_type
2998       );
2999 
3000     WHEN c_unit_price_ge_zero THEN
3001       PO_VAL_LINES.unit_price_ge_zero(
3002         p_line_id_tbl => p_lines.po_line_id
3003       , p_unit_price_tbl => p_lines.unit_price
3004       , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
3005       , p_clm_info_flag_tbl => p_lines.clm_info_flag
3006       , x_results => x_results
3007       , x_result_type => l_result_type
3008       );
3009 
3010     WHEN c_list_price_ge_zero THEN
3011       PO_VAL_LINES.list_price_ge_zero(
3012         p_line_id_tbl => p_lines.po_line_id
3013       , p_list_price_per_unit_tbl => p_lines.list_price_per_unit
3014       , x_results => x_results
3015       , x_result_type => l_result_type
3016       );
3017 
3018     WHEN c_market_price_ge_zero THEN
3019       PO_VAL_LINES.market_price_ge_zero(
3020         p_line_id_tbl => p_lines.po_line_id
3021       , p_market_price_tbl => p_lines.market_price
3022       , x_results => x_results
3023       , x_result_type => l_result_type
3024       );
3025 
3026     WHEN c_validate_unit_price_change THEN
3027       PO_VAL_LINES.validate_unit_price_change(
3028         p_line_id_tbl => p_lines.po_line_id
3029       , p_unit_price_tbl => p_lines.unit_price
3030       , p_price_break_lookup_code_tbl => p_lines.price_break_lookup_code
3031       , p_amt_changed_flag_tbl => p_lines.amount_changed_flag -- <Bug 13503748: Encumbrance ER >--
3032       , x_result_set_id => l_result_set_id
3033       , x_results => x_results
3034       , x_result_type => l_result_type
3035       );
3036 
3037     WHEN c_expiration_ge_blanket_start THEN
3038       PO_VAL_LINES.expiration_ge_blanket_start(
3039         p_line_id_tbl => p_lines.po_line_id
3040       , p_blanket_start_date_tbl => p_lines.hdr_start_date
3041       , p_expiration_date_tbl => p_lines.expiration_date
3042       , x_results => x_results
3043       , x_result_type => l_result_type
3044       );
3045 
3046     WHEN c_expiration_le_blanket_end THEN
3047       PO_VAL_LINES.expiration_le_blanket_end(
3048         p_line_id_tbl => p_lines.po_line_id
3049       , p_blanket_end_date_tbl => p_lines.hdr_end_date
3050       , p_expiration_date_tbl => p_lines.expiration_date
3051       , x_results => x_results
3052       , x_result_type => l_result_type
3053       );
3054 
3055     -- <Complex Work R12 Start>
3056     WHEN c_qty_ge_qty_milestone_exec THEN
3057       PO_VAL_LINES.qty_ge_qty_milestone_exec(
3058         p_line_id_tbl => p_lines.po_line_id
3059       , p_quantity_tbl => p_lines.quantity
3060       , x_result_set_id => l_result_set_id
3061       , x_result_type => l_result_type
3062       );
3063 
3064     WHEN c_price_ge_price_mstone_exec THEN
3065       PO_VAL_LINES.price_ge_price_milestone_exec(
3066         p_line_id_tbl => p_lines.po_line_id
3067       , p_price_tbl => p_lines.unit_price
3068       , x_result_set_id => l_result_set_id
3069       , x_result_type => l_result_type
3070       );
3071 
3072     -- Bug 5072189 START
3073     WHEN c_recoupment_rate_range_check THEN
3074       PO_VAL_LINES.recoupment_rate_range_check(
3075         p_line_id_tbl  => p_lines.po_line_id
3076       , p_recoupment_rate_tbl => p_lines.recoupment_rate
3077       , x_results     => x_results
3078       , x_result_type => l_result_type
3079     );
3080 
3081     WHEN c_retainage_rate_range_check THEN
3082       PO_VAL_LINES.retainage_rate_range_check(
3083         p_line_id_tbl  => p_lines.po_line_id
3084       , p_retainage_rate_tbl => p_lines.retainage_rate
3085       , x_results     => x_results
3086       , x_result_type => l_result_type
3087     );
3088 
3089     WHEN c_prog_pay_rate_range_check THEN
3090       PO_VAL_LINES.prog_pay_rate_range_check(
3091         p_line_id_tbl  => p_lines.po_line_id
3092       , p_prog_pay_rate_tbl => p_lines.progress_payment_rate
3093       , x_results     => x_results
3094       , x_result_type => l_result_type
3095     );
3096     -- Bug 5072189 END
3097 
3098    -- Bug 5221843 START
3099     WHEN c_max_retain_amt_ge_zero THEN
3100       PO_VAL_LINES.max_retain_amt_ge_zero (
3101         p_line_id_tbl  => p_lines.po_line_id
3102       , p_max_retain_amt_tbl => p_lines.max_retainage_amount
3103       , x_results     => x_results
3104       , x_result_type => l_result_type
3105     );
3106     -- Bug 5221843 END
3107 
3108    -- Bug 5453079 START
3109     WHEN c_max_retain_amt_ge_retained THEN
3110       PO_VAL_LINES.max_retain_amt_ge_retained (
3111         p_line_id_tbl  => p_lines.po_line_id
3112       , p_max_retain_amt_tbl => p_lines.max_retainage_amount
3113       , x_result_set_id => l_result_set_id
3114       , x_result_type => l_result_type
3115     );
3116     -- Bug 5453079 END
3117 
3118     -- <Complex Work R12 End>
3119 
3120     WHEN c_unit_meas_not_null THEN
3121       PO_VAL_LINES.unit_meas_not_null(
3122         p_line_id_tbl => p_lines.po_line_id
3123       , p_unit_meas_lookup_code_tbl => p_lines.unit_meas_lookup_code
3124       , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
3125       , p_clm_info_flag_tbl => p_lines.clm_info_flag
3126       , x_results => x_results
3127       , x_result_type => l_result_type
3128       );
3129 
3130     WHEN c_item_description_not_null THEN
3131       PO_VAL_LINES.item_description_not_null(
3132         p_line_id_tbl => p_lines.po_line_id
3133       , p_item_description_tbl => p_lines.item_description
3134       , x_results => x_results
3135       , x_result_type => l_result_type
3136       );
3137 
3138     WHEN c_category_id_not_null THEN
3139       PO_VAL_LINES.category_id_not_null(
3140         p_line_id_tbl => p_lines.po_line_id
3141       , p_category_id_tbl => p_lines.category_id
3142       , p_clm_info_flag_tbl => p_lines.clm_info_flag
3143       , x_results => x_results
3144       , x_result_type => l_result_type
3145       );
3146 
3147     WHEN c_item_id_not_null THEN
3148       IF (p_calling_program = c_program_PDOI) THEN
3149         PO_VAL_LINES.item_id_not_null(
3150           p_id_tbl => p_lines.interface_id
3151         , p_item_id_tbl => p_lines.item_id
3152         , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
3153         , p_line_type_id_tbl => p_lines.line_type_id
3154         , p_clm_info_flag_tbl => p_lines.clm_info_flag
3155         , p_message_name => PO_MESSAGE_S.PO_PDOI_ITEM_NOT_NULL
3156         , x_result_set_id => l_result_set_id
3157         , x_result_type => l_result_type
3158         );
3159       ELSE
3160         PO_VAL_LINES.item_id_not_null(
3161           p_id_tbl => p_lines.po_line_id
3162         , p_item_id_tbl => p_lines.item_id
3163         , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
3164         , p_line_type_id_tbl => p_lines.line_type_id
3165         , p_clm_info_flag_tbl => p_lines.clm_info_flag
3166         , p_message_name => PO_MESSAGE_S.PO_ALL_NOT_NULL
3167         , x_result_set_id => l_result_set_id
3168         , x_result_type => l_result_type
3169         );
3170       END IF;
3171 
3172     WHEN c_temp_labor_job_id_not_null THEN
3173       PO_VAL_LINES.temp_labor_job_id_not_null(
3174         p_line_id_tbl => p_lines.po_line_id
3175       , p_job_id_tbl => p_lines.job_id
3176       , p_purchase_basis_tbl => p_lines.purchase_basis
3177       , x_results => x_results
3178       , x_result_type => l_result_type
3179       );
3180 
3181     WHEN c_line_type_id_not_null THEN
3182       PO_VAL_LINES.line_type_id_not_null(
3183         p_line_id_tbl => p_lines.po_line_id
3184       , p_line_type_id_tbl => p_lines.line_type_id
3185       , p_clm_info_flag_tbl => p_lines.clm_info_flag
3186       , x_results => x_results
3187       , x_result_type => l_result_type
3188       );
3189 
3190     WHEN c_temp_lbr_start_date_not_null THEN
3191       PO_VAL_LINES.temp_lbr_start_date_not_null(
3192         p_line_id_tbl => p_lines.po_line_id
3193       , p_start_date_tbl => p_lines.start_date
3194       , p_purchase_basis_tbl => p_lines.purchase_basis
3195       , x_results => x_results
3196       , x_result_type => l_result_type
3197       );
3198 
3199     WHEN c_src_doc_line_not_null THEN
3200       PO_VAL_LINES.src_doc_line_not_null(
3201         p_line_id_tbl => p_lines.po_line_id
3202       , p_from_header_id_tbl => p_lines.from_header_id
3203       , p_from_line_id_tbl => p_lines.from_line_id
3204       , x_results => x_results
3205       , x_result_type => l_result_type
3206       );
3207 
3208     -- Opm related validation : OPM Integration R12 Start
3209     WHEN c_line_sec_qty_gt_zero THEN
3210       PO_VAL_LINES.line_sec_quantity_gt_zero(
3211         p_line_id_tbl => p_lines.po_line_id
3212       , p_item_id_tbl  => p_lines.item_id
3213       , p_sec_quantity_tbl => p_lines.secondary_quantity
3214       , x_results => x_results
3215       , x_result_type => l_result_type
3216       );
3217 
3218     WHEN c_line_qtys_within_deviation THEN
3219       PO_VAL_LINES.line_qtys_within_deviation(
3220         p_line_id_tbl => p_lines.po_line_id
3221       , p_item_id_tbl  => p_lines.item_id
3222       , p_quantity_tbl    => p_lines.quantity
3223       , p_primary_uom_tbl  => p_lines.unit_meas_lookup_code
3224       , p_sec_quantity_tbl => p_lines.secondary_quantity
3225       , p_secondary_uom_tbl => p_lines.secondary_unit_of_measure
3226       , x_results => x_results
3227       , x_result_type => l_result_type
3228       );
3229      -- Opm related validation : OPM Integration R12 End
3230 
3231      WHEN c_from_line_id_not_null THEN
3232        PO_VAL_LINES.from_line_id_not_null(
3233          p_line_id_tbl => p_lines.po_line_id
3234        , p_from_header_id_tbl => p_lines.from_header_id
3235        , p_from_line_id_tbl => p_lines.from_line_id
3236        , x_results => x_results
3237        , x_result_type => l_result_type
3238        );
3239 
3240     -- Bug 5070210 Start
3241     WHEN c_amt_ge_advance_amt THEN
3242       PO_VAL_LINES.advance_amt_le_amt(
3243         p_line_id_tbl  => p_lines.po_line_id,
3244         p_advance_tbl  => p_lines.advance_amount,
3245         p_amount_tbl   => p_lines.amount,
3246         p_quantity_tbl => p_lines.quantity,
3247         p_price_tbl    => p_lines.unit_price,
3248         x_results      => x_results,
3249         x_result_type  => l_result_type
3250       );
3251     -- Bug 5070210 End
3252 
3253 -- Mod Project
3254     WHEN c_lmod_no_cancel_shp_complt THEN
3255       PO_VAL_LINES.mod_no_cancel_shp_complt(
3256 	p_line_id_tbl => p_lines.po_line_id
3257       , p_control_action_tbl => p_lines.control_action
3258       , x_result_set_id => l_result_set_id
3259       , x_result_type => l_result_type
3260        );
3261 
3262 -- CLM Changes Start
3263     WHEN c_option_from_date_not_null THEN
3264       PO_VAL_LINES.option_from_date_not_null(
3265 	p_line_id_tbl => p_lines.po_line_id
3266       , p_option_ind_tbl => p_lines.clm_option_indicator
3267       , p_option_from_date_tbl => p_lines.clm_option_from_date
3268       , x_results => x_results
3269       , x_result_type => l_result_type
3270        );
3271 
3272     WHEN c_option_to_date_not_null THEN
3273       PO_VAL_LINES.option_to_date_not_null(
3274 	p_line_id_tbl => p_lines.po_line_id
3275       , p_option_ind_tbl => p_lines.clm_option_indicator
3276       , p_option_to_date_tbl => p_lines.clm_option_to_date
3277       , x_results => x_results
3278       , x_result_type => l_result_type
3279        );
3280      WHEN c_line_num_disp_check THEN
3281       PO_VAL_LINES.line_num_disp_check(
3282 	p_line_id_tbl => p_lines.po_line_id
3283       , p_line_num_disp_tbl => p_lines.line_num_display
3284       , p_group_line_id_tbl => p_lines.group_line_id
3285       , p_clm_exhibit_name_tbl => p_lines.clm_exhibit_name
3286       , x_results => x_results
3287       , x_result_type => l_result_type
3288        );
3289      WHEN c_option_to_date_le_from_date THEN
3290       PO_VAL_LINES.option_to_date_le_from_date(
3291 	p_line_id_tbl => p_lines.po_line_id
3292       , p_option_ind_tbl => p_lines.clm_option_indicator
3293       , p_option_from_date_tbl => p_lines.clm_option_from_date
3294       , p_option_to_Date_tbl => p_lines.clm_option_to_date
3295       , x_results => x_results
3296       , x_result_type => l_result_type
3297        );
3298 
3299     WHEN c_option_from_date_le_sysdate THEN
3300       PO_VAL_LINES.option_from_date_le_sysdate(
3301 	p_line_id_tbl => p_lines.po_line_id
3302       , p_option_ind_tbl => p_lines.clm_option_indicator
3303       , p_option_from_date_tbl => p_lines.clm_option_from_date
3304       , p_draft_id_tbl => p_lines.draft_id --bug 9785519
3305       , x_results => x_results
3306       , x_result_type => l_result_type
3307        );
3308      WHEN c_option_fm_date_le_ex_date THEN
3309       PO_VAL_LINES.option_fm_date_le_ex_date(
3310 	p_line_id_tbl => p_lines.po_line_id
3311       , p_exer_flag_tbl => p_lines.clm_exercised_flag
3312       , p_option_from_date_tbl => p_lines.clm_option_from_date
3313       , p_option_exer_date_tbl => p_lines.clm_exercised_date
3314       , x_results => x_results
3315       , x_result_type => l_result_type
3316        );
3317 -- CLM Changes End
3318 -- For PO Fed Fileds CLM
3319     WHEN c_order_start_date_le_end_date THEN
3320       PO_VAL_LINES.order_start_date_le_end_date
3321       (
3322           p_line_id_tbl         => p_lines.po_line_id
3323         , p_start_date_tbl      => p_lines.clm_order_start_date
3324         , p_expiration_date_tbl => p_lines.clm_order_end_date
3325         , x_results             => x_results
3326         , x_result_type         => l_result_type
3327       );
3328     WHEN c_order_start_date_gt_sysdate THEN
3329       PO_VAL_LINES.order_start_date_gt_sysdate
3330       (
3331           p_line_id_tbl         => p_lines.po_line_id
3332         , p_order_from_date_tbl => p_lines.clm_order_start_date
3333         , p_draft_id_tbl => p_lines.draft_id --bug 9785519
3334         , x_results             => x_results
3335         , x_result_type         => l_result_type
3336       );
3337     WHEN c_max_tot_amt_le_line_tot_amt THEN
3338       PO_VAL_LINES.max_tot_amt_le_line_tot_amt
3339       (
3340           p_line_id_tbl         => p_lines.po_line_id
3341         , p_max_total_amt_tbl   => p_lines.CLM_MAX_TOTAL_AMOUNT
3342         , p_line_amount_tbl     => p_lines.AMOUNT
3343         , x_results             => x_results
3344         , x_result_type         => l_result_type
3345       );
3346     WHEN c_max_tot_amt_ge_min_tot_amt THEN
3347       PO_VAL_LINES.max_tot_amt_ge_min_tot_amt
3348       (
3349           p_line_id_tbl         => p_lines.po_line_id
3350         , p_max_total_amt_tbl   => p_lines.CLM_MAX_TOTAL_AMOUNT
3351         , p_min_total_amt_tbl   => p_lines.CLM_MIN_TOTAL_AMOUNT
3352         , x_results             => x_results
3353         , x_result_type         => l_result_type
3354       );
3355     WHEN c_max_tot_qty_le_line_tot_qty THEN
3356       PO_VAL_LINES.max_tot_qty_le_line_tot_qty
3357       (
3358           p_line_id_tbl         => p_lines.po_line_id
3359         , p_max_total_qty_tbl   => p_lines.CLM_MAX_TOTAL_QUANTITY
3360         , p_line_qty_tbl        => p_lines.QUANTITY_COMMITTED
3361         , x_results             => x_results
3362         , x_result_type         => l_result_type
3363       );
3364     WHEN c_max_tot_qty_ge_min_tot_qty THEN
3365       PO_VAL_LINES.max_tot_qty_ge_min_tot_qty
3366       (
3367           p_line_id_tbl         => p_lines.po_line_id
3368         , p_max_total_qty_tbl   => p_lines.CLM_MAX_TOTAL_QUANTITY
3369         , p_min_total_qty_tbl   => p_lines.CLM_MIN_TOTAL_QUANTITY
3370         , x_results             => x_results
3371         , x_result_type         => l_result_type
3372       );
3373     WHEN c_max_ord_amt_le_max_tot_amt THEN
3374       PO_VAL_LINES.max_ord_amt_le_max_tot_amt
3375       (
3376           p_line_id_tbl         => p_lines.po_line_id
3377         , p_max_order_amt_tbl   => p_lines.CLM_MAX_ORDER_AMOUNT
3378         , p_max_tot_amount_tbl  => p_lines.CLM_MAX_TOTAL_AMOUNT
3379         , x_results             => x_results
3380         , x_result_type         => l_result_type
3381       );
3382     WHEN c_max_ord_amt_ge_min_ord_amt THEN
3383       PO_VAL_LINES.max_ord_amt_ge_min_ord_amt
3384       (
3385           p_line_id_tbl         => p_lines.po_line_id
3386         , p_max_ord_amt_tbl     => p_lines.CLM_MAX_ORDER_AMOUNT
3387         , p_min_ord_amt_tbl     => p_lines.CLM_MIN_ORDER_AMOUNT
3388         , x_results             => x_results
3389         , x_result_type         => l_result_type
3390       );
3391     WHEN c_max_ord_qty_le_max_tot_qty THEN
3392       PO_VAL_LINES.max_ord_qty_le_max_tot_qty
3393       (
3394           p_line_id_tbl         => p_lines.po_line_id
3395         , p_max_order_qty_tbl   => p_lines.CLM_MAX_ORDER_QUANTITY
3396         , p_max_tot_qty_tbl     => p_lines.CLM_MAX_TOTAL_QUANTITY
3397         , x_results             => x_results
3398         , x_result_type         => l_result_type
3399       );
3400     WHEN c_max_ord_qty_ge_min_ord_qty THEN
3401       PO_VAL_LINES.max_ord_qty_ge_min_ord_qty
3402       (
3403           p_line_id_tbl         => p_lines.po_line_id
3404         , p_max_ord_qty_tbl     => p_lines.CLM_MAX_ORDER_QUANTITY
3405         , p_min_ord_qty_tbl     => p_lines.CLM_MIN_ORDER_QUANTITY
3406         , x_results             => x_results
3407         , x_result_type         => l_result_type
3408       );
3409     WHEN c_clin_slin_num_check THEN -- <Bug 9851804>
3410       PO_VAL_LINES.clin_slin_num_check(
3411         p_header_id_tbl => p_lines.po_header_id,
3412         p_draft_id_tbl => p_lines.draft_id,
3413         p_line_id_tbl => p_lines.po_line_id,
3414         p_group_line_id_tbl => p_lines.group_line_id,
3415         p_line_num_display_tbl => p_lines.line_num_display,
3416 	p_par_draft_id_tbl  => p_lines.par_draft_id, --<PAR Project>
3417         x_result_set_id => l_result_set_id,
3418         x_result_type => l_result_type
3419       );
3420 
3421     WHEN c_par_line_comments_not_null THEN  -- <PAR PROJECT>
3422       PO_VAL_LINES.validate_comments_not_null(
3423       p_line_id_tbl => p_lines.po_line_id
3424     , p_draft_id_tbl => p_lines.draft_id
3425     , p_draft_type_tbl => p_lines.draft_type
3426     , p_comments_tbl => p_lines.comments
3427     , x_results => x_results
3428     , x_result_type => l_result_type
3429     );
3430     --PDOI CLM Integration  : Validation for proper clin structure
3431     --Priced slin not allowed under a priced clin
3432     WHEN c_pdoi_clin_slin_structure THEN
3433       PO_VAL_LINES.clin_slin_structure(
3434         p_line_id_tbl => p_lines.po_line_id,
3435         --p_draft_id_tbl => p_lines.draft_id,
3436         p_intf_line_id_tbl => p_lines.interface_id,
3437         p_group_line_id_tbl => p_lines.group_line_id,
3438         x_results    => x_results,
3439         x_result_type  => l_result_type
3440       );
3441     WHEN c_validate_contract_type THEN
3442       PO_VAL_LINES.validate_contract_type(
3443         p_intf_line_id_tbl         => p_lines.interface_id
3444       , p_order_type_lookup_code_tbl => p_lines.order_type_lookup_code
3445       , p_contract_type_tbl   => p_lines.contract_type
3446       , x_results             => x_results
3447       , x_result_type         => l_result_type
3448     );
3449 
3450     WHEN c_validate_cost_constraint THEN
3451       PO_VAL_LINES.validate_cost_constraint(
3452         p_intf_line_id_tbl         => p_lines.interface_id
3453       , p_cost_constraint_tbl     => p_lines.cost_constraint
3454       , x_results             => x_results
3455       , x_result_type         => l_result_type
3456     );
3457     WHEN c_check_contract_num_and_ver THEN
3458       PO_VAL_LINES.check_contract_num_and_ver(
3459         p_intf_line_id_tbl         => p_lines.interface_id
3460       , p_oke_contract_header_id_tbl     => p_lines.oke_contract_header_id
3461       , p_oke_contract_header_num_tbl  => p_lines.oke_contract_header_num
3462       , p_oke_contract_version_id_tbl => p_lines.oke_contract_version_id
3463       , x_results             => x_results
3464       , x_result_type         => l_result_type
3465     );
3466     WHEN c_validate_option_indicator THEN
3467       PO_VAL_LINES.validate_option_indicator(
3468         p_intf_line_id_tbl         => p_lines.interface_id
3469       , p_clm_option_indicator_tbl => p_lines.clm_option_indicator
3470       , x_results             => x_results
3471       , x_result_type         => l_result_type
3472     );
3473     WHEN c_validate_clm_base_line_num THEN
3474       PO_VAL_LINES.validate_clm_base_line_num(
3475         p_intf_line_id_tbl         => p_lines.interface_id
3476       , p_clm_option_indicator_tbl => p_lines.clm_option_indicator
3477       , p_clm_base_line_num_tbl    => p_lines.clm_base_line_num
3478       , x_results             => x_results
3479       , x_result_type         => l_result_type
3480     );
3481     WHEN c_validate_clm_option_num THEN
3482       PO_VAL_LINES.validate_clm_option_num(
3483         p_intf_line_id_tbl         => p_lines.interface_id
3484       , p_clm_option_indicator_tbl => p_lines.clm_option_indicator
3485       , p_clm_base_line_num_tbl    => p_lines.clm_base_line_num
3486       , p_clm_option_num_tbl       => p_lines.clm_option_num
3487       , x_results             => x_results
3488       , x_result_type         => l_result_type
3489     );
3490     WHEN c_validate_clm_idc_type THEN
3491       PO_VAL_LINES.validate_clm_idc_type(
3492         p_intf_line_id_tbl         => p_lines.interface_id
3493       , p_clm_idc_type_tbl => p_lines.clm_idc_type
3494       , x_results             => x_results
3495       , x_result_type         => l_result_type
3496     );
3497     WHEN c_validate_clin_line_num_disp THEN
3498       PO_VAL_LINES.validate_clin_line_num_disp(
3499         p_intf_line_id_tbl         => p_lines.interface_id
3500       , p_line_num_disp_tbl => p_lines.line_num_display
3501       , p_group_line_id_tbl   => p_lines.group_line_id
3502       , p_intf_header_id_tbl  => p_lines.interface_header_id
3503       , x_results             => x_results
3504       , x_result_type         => l_result_type
3505     );
3506     WHEN c_idv_reference_equal_check THEN
3507       PO_VAL_LINES.idv_reference_equal_check(
3508         p_intf_line_id_tbl         => p_lines.interface_id
3509       , p_from_header_id_tbl       => p_lines.from_header_id
3510       , x_results             => x_results
3511       , x_result_type         => l_result_type
3512     );
3513     WHEN c_validate_clm_line_type_id THEN
3514       PO_VAL_LINES.validate_clm_line_type_id(
3515         p_intf_line_id_tbl         => p_lines.interface_id
3516       , p_line_type_id_tbl         => p_lines.line_type_id
3517       , x_results                  => x_results
3518       , x_result_type              => l_result_type
3519     );
3520 
3521 
3522 
3523 
3524 
3525         -------------------------------------------------------------------------
3526         -- Line Validation Subroutines
3527         -------------------------------------------------------------------------
3528         WHEN c_over_tolerance_error_flag THEN
3529             -- The lookup code specified in over_tolerance_error_flag with the lookup type
3530             -- 'RECEIVING CONTROL LEVEL' has to exist in po_lookup_codes and still active.
3531             -- This method is called only for Standard PO and quotation documents
3532             PO_VAL_LINES2.over_tolerance_err_flag(p_id_tbl                          => p_lines.interface_id,
3533                                                   p_over_tolerance_err_flag_tbl     => p_lines.over_tolerance_error_flag,
3534                                                   x_result_set_id                   => l_result_set_id,
3535                                                   x_result_type                     => l_result_type);
3536           WHEN c_expiration_date_blanket THEN
3537             -- Expiration date on the line cannot be earlier than the header effective start date and cannot be later than header effective end date
3538             PO_VAL_LINES2.expiration_date_blanket(p_id_tbl                    => p_lines.interface_id,
3539                                                   p_expiration_date_tbl       => p_lines.expiration_date,
3540                                                   p_header_start_date_tbl     => p_lines.hdr_start_date,
3541                                                   p_header_end_date_tbl       => p_lines.hdr_end_date,
3542                                                   x_results                   => x_results,
3543                                                   x_result_type               => l_result_type);
3544           WHEN c_global_agreement_flag THEN
3545             -- For blanket document with purchase type 'TEMP LABOR', the global agreement
3546             -- flag has to be 'Y'.  Global_agreement_flag and outside operation flag cannot both be 'Y'
3547             PO_VAL_LINES2.global_agreement_flag(p_id_tbl                        => p_lines.interface_id,
3548                                                 p_global_agreement_flag_tbl     => p_lines.global_agreement_flag,
3549                                                 p_purchase_basis_tbl            => p_lines.purchase_basis,
3550                                                 p_line_type_id_tbl              => p_lines.line_type_id,
3551                                                 x_result_set_id                 => l_result_set_id,
3552                                                 x_results                       => x_results,
3553                                                 x_result_type                   => l_result_type);
3554           WHEN c_amount_blanket THEN
3555             -- If order_type_lookup_code is 'RATE', amount has to be null
3556             PO_VAL_LINES2.amount_blanket(p_id_tbl                         => p_lines.interface_id,
3557                                          p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3558                                          p_amount_tbl                     => p_lines.amount,
3559                                          x_results                        => x_results,
3560                                          x_result_type                    => l_result_type);
3561           WHEN c_order_type_lookup_code THEN
3562             -- If services procurement is not enabled, the order_type_lookup_code cannot
3563             -- be  'FIXED PRICE' or 'RATE'.
3564             PO_VAL_LINES2.order_type_lookup_code(p_id_tbl                         => p_lines.interface_id,
3565                                                  p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3566                                                  x_results                        => x_results,
3567                                                  x_result_type                    => l_result_type);
3568           WHEN c_contractor_name THEN
3569             -- If purchase basis is not 'TEMP LABOR' or document type is not STANDARD,
3570             -- contractor first name and last name fields should be empty
3571             PO_VAL_LINES2.contractor_name(p_id_tbl                        => p_lines.interface_id,
3572                                           p_doc_type                      => l_doc_type,
3573                                           p_purchase_basis_tbl            => p_lines.purchase_basis,
3574                                           p_contractor_last_name_tbl      => p_lines.contractor_last_name,
3575                                           p_contractor_first_name_tbl     => p_lines.contractor_first_name,
3576                                           x_results                       => x_results,
3577                                           x_result_type                   => l_result_type);
3578           WHEN c_job_id THEN
3579             -- If purchase basis is TEMP LABOR, then job id must be null
3580             PO_VAL_LINES2.job_id(p_id_tbl                        => p_lines.interface_id,
3581                                  p_job_id_tbl                    => p_lines.job_id,
3582                                  p_job_business_group_id_tbl     => p_lines.job_business_group_id,
3583                                  p_purchase_basis_tbl            => p_lines.purchase_basis,
3584                                  p_category_id_tbl               => p_lines.category_id,
3585                                  x_result_set_id                 => l_result_set_id,
3586                                  x_results                       => x_results,
3587                                  x_result_type                   => l_result_type);
3588           WHEN c_job_business_group_id THEN
3589             -- If services procurement not enabled, order_type_lookup_code cannot be
3590             -- 'FIXED PRICE' or 'RATE'
3591             PO_VAL_LINES2.job_business_group_id(p_id_tbl                        => p_lines.interface_id,
3592                                                 p_job_id_tbl                    => p_lines.job_id,
3593                                                 p_job_business_group_id_tbl     => p_lines.job_business_group_id,
3594                                                 p_purchase_basis_tbl            => p_lines.purchase_basis,
3595                                                 x_result_set_id                 => l_result_set_id,
3596                                                 x_result_type                   => l_result_type);
3597           WHEN c_capital_expense_flag THEN
3598             -- If purchase_basis = 'TEMP LABOR', then capital_expense_flag cannot = 'Y'
3599             PO_VAL_LINES2.capital_expense_flag(p_id_tbl                       => p_lines.interface_id,
3600                                                p_purchase_basis_tbl           => p_lines.purchase_basis,
3601                                                p_capital_expense_flag_tbl     => p_lines.capital_expense_flag,
3602                                                x_results                      => x_results,
3603                                                x_result_type                  => l_result_type);
3604           WHEN c_un_number_id THEN
3605             -- If purchase_basis = 'TEMP LABOR', then un_number must be null
3606             PO_VAL_LINES2.un_number_id(p_id_tbl                 => p_lines.interface_id,
3607                                        p_purchase_basis_tbl     => p_lines.purchase_basis,
3608                                        p_un_number_id_tbl       => p_lines.un_number_id,
3609                                        x_result_set_id          => l_result_set_id,
3610                                        x_results                => x_results,
3611                                        x_result_type            => l_result_type);
3612           WHEN c_hazard_class_id THEN
3613             -- If purchase_basis = 'TEMP LABOR', then un_number must be null
3614             PO_VAL_LINES2.hazard_class_id(p_id_tbl                  => p_lines.interface_id,
3615                                           p_purchase_basis_tbl      => p_lines.purchase_basis,
3616                                           p_hazard_class_id_tbl     => p_lines.hazard_class_id,
3617                                           x_result_set_id           => l_result_set_id,
3618                                           x_results                 => x_results,
3619                                           x_result_type             => l_result_type);
3620           WHEN c_item_id THEN
3621             -- If order_type_lookup_code is 'FIXED PRICE', 'RATE', or 'AMOUNT', item_id has to be null
3622             PO_VAL_LINES2.item_id(p_id_tbl                         => p_lines.interface_id,
3623                                   p_item_id_tbl                    => p_lines.item_id,
3624                                   p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3625                                   p_line_type_id_tbl               => p_lines.line_type_id,
3626                                   p_inventory_org_id               => l_inventory_org_id,
3627                                   x_result_set_id                  => l_result_set_id,
3628                                   x_results                        => x_results,
3629                                   x_result_type                    => l_result_type);
3630           WHEN c_item_description THEN
3631             -- Make sure that the item_description is populated, and also need to find out if it is different from
3632             -- what is setup for the item. Would not allow item_description update if item attribute
3633             -- allow_item_desc_update_flag is N.
3634             PO_VAL_LINES2.item_description(p_id_tbl                         => p_lines.interface_id,
3635                                            p_item_description_tbl           => p_lines.item_description,
3636                                            p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3637                                            p_item_id_tbl                    => p_lines.item_id,
3638                                            p_create_or_update_item          => l_create_or_update_item,
3639                                            p_inventory_org_id               => l_inventory_org_id,
3640                                            x_result_set_id                  => l_result_set_id,
3641                                            x_result_type                    => l_result_type);
3642           WHEN c_unit_meas_lookup_code THEN
3643             -- check to see if x_item_unit_of_measure is valid
3644             PO_VAL_LINES2.unit_meas_lookup_code(p_id_tbl                         => p_lines.interface_id,
3645                                                 p_unit_meas_lookup_code_tbl      => p_lines.unit_meas_lookup_code,
3646                                                 p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3647                                                 p_item_id_tbl                    => p_lines.item_id,
3648                                                 p_line_type_id_tbl               => p_lines.line_type_id,
3649                                                 p_inventory_org_id               => l_inventory_org_id,
3650                                                 x_result_set_id                  => l_result_set_id,
3651                                                 x_results                        => x_results,
3652                                                 x_result_type                    => l_result_type);
3653           WHEN c_item_revision THEN
3654             --  if order_type_lookup_code is FIXED PRICE or RATE, or item id is null, then item revision has to
3655             --  be NULL. Check to see if there are x_item_revision exists in mtl_item_revisions table
3656             PO_VAL_LINES2.item_revision(p_id_tbl                         => p_lines.interface_id,
3657                                         p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3658                                         p_item_revision_tbl              => p_lines.item_revision,
3659                                         p_item_id_tbl                    => p_lines.item_id,
3660                                         x_result_set_id                  => l_result_set_id,
3661                                         x_results                        => x_results,
3662                                         x_result_type                    => l_result_type);
3663           WHEN c_category_id THEN
3664             -- Validate and make sure category_id is a valid category within the default category set for Purchasing.
3665             -- Validate if X_category_id belong to the X_item.  Check if the Purchasing Category set has
3666             -- 'Validate flag' ON. If Yes, we will validate the Category to exist in the 'Valid Category List'.
3667             -- If No, we will just validate if the category is Enable and Active.
3668             PO_VAL_LINES2.category_id(p_id_tbl                         => p_lines.interface_id,
3669                                       p_category_id_tbl                => p_lines.category_id,
3670                                       p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3671                                       p_item_id_tbl                    => p_lines.item_id,
3672                                       p_inventory_org_id               => l_inventory_org_id,
3673                                       x_result_set_id                  => l_result_set_id,
3674                                       x_results                        => x_results,
3675                                       x_result_type                    => l_result_type);
3676           WHEN c_ip_category_id THEN
3677             -- Validate ip_category_id is not empty
3678             -- Validate ip_category_id is valid if not empty.
3679             PO_VAL_LINES2.ip_category_id(p_id_tbl                      => p_lines.interface_id,
3680                                          p_ip_category_id_tbl          => p_lines.ip_category_id,
3681                                          x_result_set_id               => l_result_set_id,
3682                                          x_results                     => x_results,
3683                                          x_result_type                 => l_result_type);
3684           WHEN c_unit_price THEN
3685             --If order_type_lookup_code is not  'FIXED PRICE', unit_price cannot be null and cannot be less than zero.
3686             --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.
3687             --If order_type_lookup_code is 'FIXED PRICE', unit_price has to be null.
3688             PO_VAL_LINES2.unit_price(p_id_tbl                         => p_lines.interface_id,
3689                                      p_unit_price_tbl                 => p_lines.unit_price,
3690                                      p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3691                                      p_line_type_id_tbl               => p_lines.line_type_id,
3692                                      x_result_set_id                  => l_result_set_id,
3693                                      x_results                        => x_results,
3694                                      x_result_type                    => l_result_type);
3695           WHEN c_quantity THEN
3696             -- If order_type_lookup_code is not 'FIXED PRICE' or 'RATE', quantity cannot be less than zero
3697             -- If order_type_lookup_code is 'FIXED PRICE' or 'RATE', quantity has to be null.
3698             PO_VAL_LINES2.quantity(p_id_tbl                         => p_lines.interface_id,
3699                                    p_quantity_tbl                   => p_lines.quantity,
3700                                    p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3701                                    x_results                        => x_results,
3702                                    x_result_type                    => l_result_type);
3703           WHEN c_amount THEN
3704             -- If order_type_lookup_code is not 'FIXED PRICE' or 'RATE', amount has to be null
3705             PO_VAL_LINES2.amount(p_id_tbl                         => p_lines.interface_id,
3706                                  p_amount_tbl                     => p_lines.amount,
3707                                  p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3708                                  x_results                        => x_results,
3709                                  x_result_type                    => l_result_type);
3710           WHEN c_rate_type THEN
3711             -- For rate based temp labor line, the currency rate_type cannot be 'user'
3712             PO_VAL_LINES2.rate_type(p_id_tbl                         => p_lines.interface_id,
3713                                     p_rate_type_tbl                  => p_lines.hdr_rate_type,
3714                                     p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3715                                     x_results                        => x_results,
3716                                     x_result_type                    => l_result_type);
3717           WHEN c_line_num THEN
3718             -- Line num must be populated and cannot be <= 0.
3719             -- Line num has to be unique in a requisition.
3720             PO_VAL_LINES2.line_num(p_id_tbl                         => p_lines.interface_id,
3721                                    p_po_header_id_tbl               => p_lines.po_header_id,
3722                                    p_line_num_tbl                   => p_lines.line_num,
3723                                    p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3724                                    p_draft_id_tbl                   => p_lines.draft_id, -- bug5129752
3725                                    x_result_set_id                  => l_result_set_id,
3726                                    x_results                        => x_results,
3727                                    x_result_type                    => l_result_type);
3728           WHEN c_po_line_id THEN
3729             -- Po_line_id must be populated and unique.
3730             PO_VAL_LINES2.po_line_id(p_id_tbl               => p_lines.interface_id,
3731                                      p_po_line_id_tbl       => p_lines.po_line_id,
3732                                      p_po_header_id_tbl     => p_lines.po_header_id,
3733                                      x_result_set_id        => l_result_set_id,
3734                                      x_result_type          => l_result_type);
3735           WHEN c_line_type_id THEN
3736             -- Line type id must be populated and exist in po_line_types_val_v
3737             PO_VAL_LINES2.line_type_id(p_id_tbl               => p_lines.interface_id,
3738                                        p_line_type_id_tbl     => p_lines.line_type_id,
3739                                        x_result_set_id        => l_result_set_id,
3740                                        x_result_type          => l_result_type);
3741           WHEN c_line_style_related_info THEN
3742             PO_VAL_LINES2.style_related_info(p_id_tbl                      => p_lines.interface_id,
3743                                              p_style_id_tbl                => p_lines.hdr_style_id,
3744                                              p_line_type_id_tbl            => p_lines.line_type_id,
3745                                              p_purchase_basis_tbl          => p_lines.purchase_basis,
3746                                              x_result_set_id               => l_result_set_id,
3747                                              x_result_type                 => l_result_type);
3748           WHEN c_price_type_lookup_code THEN
3749             -- If price_type_lookup_code is not null, it has to be a valid price type in po_lookup_codes
3750             PO_VAL_LINES2.price_type_lookup_code(p_id_tbl                         => p_lines.interface_id,
3751                                                  p_price_type_lookup_code_tbl     => p_lines.price_type_lookup_code,
3752                                                  x_result_set_id                  => l_result_set_id,
3753                                                  x_result_type                    => l_result_type);
3754           WHEN c_start_date_standard THEN
3755             -- Start date is required for Standard PO with purchase basis 'TEMP LABOR'
3756             -- Expiration date if provided should be later than the start date
3757             -- If purchase basis is not 'TEMP LABOR', start_date and expiration_date have to be null
3758             PO_VAL_LINES2.start_date_standard(p_id_tbl                  => p_lines.interface_id,
3759                                               p_start_date_tbl          => p_lines.start_date,
3760                                               p_expiration_date_tbl     => p_lines.expiration_date,
3761                                               p_purchase_basis_tbl      => p_lines.purchase_basis,
3762                                               x_results                 => x_results,
3763                                               x_result_type             => l_result_type);
3764           WHEN c_item_id_standard THEN
3765             -- 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.
3766             PO_VAL_LINES2.item_id_standard(p_id_tbl                         => p_lines.interface_id,
3767                                            p_item_id_tbl                    => p_lines.item_id,
3768                                            p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3769                                            p_inventory_org_id               => l_inventory_org_id,
3770                                            x_result_set_id                  => l_result_set_id,
3771                                            x_result_type                    => l_result_type);
3772           WHEN c_quantity_standard THEN
3773             -- Quantity cannot be zero for SPO
3774             -- And qiantity cannot be empty for SPO if order type is QUANTITY/AMOUNT
3775             PO_VAL_LINES2.quantity_standard(p_id_tbl                         => p_lines.interface_id,
3776                                             p_quantity_tbl                   => p_lines.quantity,
3777                                             p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3778                                             x_results                        => x_results,
3779                                             x_result_type                    => l_result_type);
3780           WHEN c_amount_standard THEN
3781             -- If order_type_lookup_code is 'FIXED PRICE' or 'RATE', amount cannot be null
3782             PO_VAL_LINES2.amount_standard(p_id_tbl                         => p_lines.interface_id,
3783                                           p_amount_tbl                     => p_lines.amount,
3784                                           p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3785                                           x_results                        => x_results,
3786                                           x_result_type                    => l_result_type);
3787           WHEN c_price_break_lookup_code THEN
3788             -- bug5016163
3789             PO_VAL_LINES2.price_break_lookup_code(p_id_tbl                  => p_lines.interface_id,
3790                                            p_price_break_lookup_code_tbl     => p_lines.price_break_lookup_code,
3791                                            p_global_agreement_flag_tbl      => p_lines.global_agreement_flag,
3792                                            p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3793                                            p_purchase_basis_tbl             => p_lines.purchase_basis,
3794                                            x_result_set_id                  => l_result_set_id,
3795                                            x_results                        => x_results,
3796                                            x_result_type                    => l_result_type);
3797           WHEN c_not_to_exceed_price THEN
3798             -- If allow_price_override_flag is 'N', then not_to_exceed_price has to be null.
3799             -- If not_to_exceed_price is not null, then it cannot be less than unit_price.
3800             PO_VAL_LINES2.not_to_exceed_price(p_id_tbl                       => p_lines.interface_id,
3801                                               p_not_to_exceed_price_tbl      => p_lines.not_to_exceed_price,
3802                                               p_allow_price_override_tbl     => p_lines.allow_price_override_flag,
3803                                               p_unit_price_tbl               => p_lines.unit_price,
3804                                               x_results                      => x_results,
3805                                               x_result_type                  => l_result_type);
3806           WHEN c_uom_update THEN
3807             -- validate unit_meas_lookup_code against po_lines_all and po_units_of_measure_val_v
3808             -- for the Update case
3809             PO_VAL_LINES2.uom_update(p_id_tbl                         => p_lines.interface_id,
3810                                      p_unit_meas_lookup_code_tbl      => p_lines.unit_meas_lookup_code,
3811                                      p_order_type_lookup_code_tbl     => p_lines.order_type_lookup_code,
3812                                      p_po_header_id_tbl               => p_lines.po_header_id,
3813                                      p_po_line_id_tbl                 => p_lines.po_line_id,
3814                                      x_results                        => x_results,
3815                                      x_result_set_id                  => l_result_set_id,
3816                                      x_result_type                    => l_result_type);
3817           WHEN c_unit_price_update THEN
3818             -- In the UPDATE case, unit_price cannot be negative.  Also handle #DEL.
3819             PO_VAL_LINES2.unit_price_update
3820             ( p_id_tbl                  => p_lines.interface_id,
3821               p_po_line_id_tbl          => p_lines.po_line_id, -- bug5008206
3822               p_draft_id_tbl            => p_lines.draft_id, -- bug5258790
3823               p_unit_price_tbl          => p_lines.unit_price,
3824               x_results                 => x_results,
3825               x_result_set_id           => l_result_set_id, -- bug5008206
3826               x_result_type             => l_result_type
3827             );
3828 
3829           WHEN c_amount_update THEN
3830             -- In the UPDATE case, unit_price cannot be negative.  Also handle #DEL.
3831             PO_VAL_LINES2.amount_update
3832             ( p_id_tbl                  => p_lines.interface_id,
3833               p_po_line_id_tbl          => p_lines.po_line_id, -- bug5008206
3834               p_draft_id_tbl            => p_lines.draft_id, -- bug5258790
3835               p_amount_tbl              => p_lines.amount,
3836               x_results                 => x_results,
3837               x_result_set_id           => l_result_set_id, -- bug5008206
3838               x_result_type             => l_result_type
3839             );
3840 
3841           WHEN c_item_desc_update THEN
3842             PO_VAL_LINES2.item_desc_update(p_id_tbl                    => p_lines.interface_id,
3843                                            p_item_description_tbl      => p_lines.item_description,
3844                                            p_item_id_tbl               => p_lines.item_id,
3845                                            p_inventory_org_id          => l_inventory_org_id,
3846                                            p_po_header_id_tbl          => p_lines.po_header_id,
3847                                            p_po_line_id_tbl            => p_lines.po_line_id,
3848                                            x_results                   => x_results,
3849                                            x_result_set_id             => l_result_set_id,
3850                                            x_result_type               => l_result_type);
3851           WHEN c_ip_category_id_update THEN
3852             -- Validate ip_category_id is valid if not empty.
3853             PO_VAL_LINES2.ip_category_id_update(p_id_tbl             => p_lines.interface_id,
3854                                                 p_ip_category_id_tbl => p_lines.ip_category_id,
3855                                                 x_result_set_id      => l_result_set_id,
3856                                                 x_results            => x_results,
3857                                                 x_result_type        => l_result_type);
3858           WHEN c_negotiated_by_preparer THEN
3859             ----------------------------------------------------------------------------------------
3860             -- Called in create case for Blanket AND SPO, negotiated_by_preparer must be 'Y' or 'N'.
3861             ----------------------------------------------------------------------------------------
3862             PO_VAL_LINES2.negotiated_by_preparer(p_id_tbl                      => p_lines.interface_id,
3863                                                  p_negotiated_by_preparer_tbl  => p_lines.negotiated_by_preparer_flag,
3864                                                  x_results                     => x_results,
3865                                                  x_result_type                 => l_result_type);
3866           WHEN c_negotiated_by_prep_update THEN
3867             --------------------------------------------------------------------------------------
3868             -- Called in update case for Blanket, negotiated_by_preparer must be NULL, 'Y' or 'N'.
3869             --------------------------------------------------------------------------------------
3870             PO_VAL_LINES2.negotiated_by_prep_update(p_id_tbl                      => p_lines.interface_id,
3871                                                     p_negotiated_by_preparer_tbl  => p_lines.negotiated_by_preparer_flag,
3872                                                     x_results                     => x_results,
3873                                                     x_result_type                 => l_result_type);
3874           WHEN c_category_id_update THEN
3875             -------------------------------------------------------------------------
3876             -- If either item_id or job_id are populated, then you are not allowed to change the po_category_id
3877             -- If change is allowed, the new category_id must be valid.
3878             -------------------------------------------------------------------------
3879             PO_VAL_LINES2.category_id_update(p_id_tbl                      => p_lines.interface_id,
3880                                              p_category_id_tbl             => p_lines.category_id,
3881                                              p_po_line_id_tbl              => p_lines.po_line_id,
3882                                              p_order_type_lookup_code_tbl  => p_lines.order_type_lookup_code,
3883                                              p_item_id_tbl                 => p_lines.item_id,
3884                                              p_job_id_tbl                  => p_lines.job_id,
3885                                              p_inventory_org_id            => l_inventory_org_id,
3886                                              x_result_set_id               => l_result_set_id,
3887                                              x_results                     => x_results,
3888                                              x_result_type                 => l_result_type);
3889 
3890           WHEN c_negotiated_by_preparer_null THEN
3891             --------------------------------------------------------------------------------------
3892             -- Negotiated by preparer flag must be Null for Quotation.
3893             --------------------------------------------------------------------------------------
3894             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
3895                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3896                                              p_entity_id_tbl      => p_lines.interface_id,
3897                                              p_entity_type        => c_entity_type_line,
3898                                              p_column_name        => 'NEGOTIATED_BY_PREPARER',
3899                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
3900                                              p_token1_name        => 'COLUMN_NAME',
3901                                              p_token1_value       => 'NEGOTIATED_BY_PREPARER',
3902                                              p_token2_name        => 'VALUE',
3903                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
3904                                              x_results            => x_results,
3905                                              x_result_type        => l_result_type);
3906           WHEN c_category_id_null THEN
3907             -- Validate category_id cannot be Null
3908             PO_VALIDATION_HELPER.not_null(p_calling_module     => p_calling_program,
3909                                           p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.category_id),
3910                                           p_entity_id_tbl      => p_lines.interface_id,
3911                                           p_entity_type        => c_entity_type_line,
3912                                           p_column_name        => 'CATEGORY_ID',
3913                                           p_message_name       => 'PO_PDOI_COLUMN_NOT_NULL',
3914                                           p_token1_name        => 'COLUMN_NAME',
3915                                           p_token1_value       => 'CATEGORY_ID',
3916                                           p_token2_name        => 'VALUE',
3917                                           p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.category_id),
3918                                           p_validation_id      => PO_VAL_CONSTANTS.c_category_id_not_null,
3919                       x_results            => x_results,
3920                                           x_result_type        => l_result_type);
3921           WHEN c_ip_category_id_null THEN
3922             -- Validate ip_category_id is empty
3923             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
3924                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.ip_category_id),
3925                                              p_entity_id_tbl      => p_lines.interface_id,
3926                                              p_entity_type        => c_entity_type_line,
3927                                              p_column_name        => 'IP_CATEGORY_ID',
3928                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
3929                                              p_token1_name        => 'COLUMN_NAME',
3930                                              p_token1_value       => 'IP_CATEGORY_ID',
3931                                              p_token2_name        => 'VALUE',
3932                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.ip_category_id),
3933                                              x_results            => x_results,
3934                                              x_result_type        => l_result_type);
3935           WHEN c_line_secondary_uom THEN
3936             PO_VALIDATION_HELPER.secondary_unit_of_measure(p_id_tbl                      => p_lines.interface_id,
3937                                                            p_entity_type                 => c_entity_type_line,
3938                                                            p_secondary_unit_of_meas_tbl  => p_lines.secondary_unit_of_measure,
3939                                                            p_item_id_tbl                 => p_lines.item_id,
3940                                                            p_item_tbl                    => p_lines.item,
3941                                                            p_organization_id_tbl         => p_lines.inventory_org_id,
3942                                                            p_doc_type                    => l_doc_type,
3943                                                            p_create_or_update_item_flag  => l_create_or_update_item,
3944                                                            x_results                     => x_results,
3945                                                            x_result_type                 => l_result_type);
3946           WHEN c_line_secondary_quantity THEN
3947             PO_VALIDATION_HELPER.secondary_quantity(p_id_tbl                      => p_lines.interface_id,
3948                                                     p_entity_type                 => c_entity_type_line,
3949                                                     p_secondary_quantity_tbl      => p_lines.secondary_quantity,
3950                                                     p_order_type_lookup_code_tbl  => p_lines.order_type_lookup_code,
3951                                                     p_item_id_tbl                 => p_lines.item_id,
3952                                                     p_item_tbl                    => p_lines.item,
3953                                                     p_organization_id_tbl         => p_lines.inventory_org_id,
3954                                                     p_doc_type                    => l_doc_type,
3955                                                     p_create_or_update_item_flag  => l_create_or_update_item,
3956                                                     x_results                     => x_results,
3957                                                     x_result_type                 => l_result_type);
3958           WHEN c_line_preferred_grade THEN
3959             PO_VALIDATION_HELPER.preferred_grade(p_id_tbl                      => p_lines.interface_id,
3960                                                  p_entity_type                 => c_entity_type_line,
3961                                                  p_preferred_grade_tbl         => p_lines.preferred_grade,
3962                                                  p_item_id_tbl                 => p_lines.item_id,
3963                                                  p_item_tbl                    => p_lines.item,
3964                                                  p_organization_id_tbl         => p_lines.inventory_org_id,
3965                                                  p_create_or_update_item_flag  => l_create_or_update_item,
3966                                                p_validation_id               => PO_VAL_CONSTANTS.c_line_preferred_grade,
3967                            x_results                     => x_results,
3968                                                  x_result_set_id               => l_result_set_id,
3969                                                  x_result_type                 => l_result_type);
3970           WHEN c_release_num_null THEN
3971             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
3972                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.release_num),
3973                                              p_entity_id_tbl      => p_lines.interface_id,
3974                                              p_entity_type        => c_entity_type_line,
3975                                              p_column_name        => 'RELEASE_NUM',
3976                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
3977                                              p_token1_name        => 'COLUMN_NAME',
3978                                              p_token1_value       => 'RELEASE_NUM',
3979                                              p_token2_name        => 'VALUE',
3980                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.release_num),
3981                                              p_validation_id      => PO_VAL_CONSTANTS.c_release_num_null,
3982                        x_results            => x_results,
3983                                              x_result_type        => l_result_type);
3984           WHEN c_po_release_id_null THEN
3985             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
3986                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.po_release_id),
3987                                              p_entity_id_tbl      => p_lines.interface_id,
3988                                              p_entity_type        => c_entity_type_line,
3989                                              p_column_name        => 'PO_RELEASE_ID',
3990                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
3991                                              p_token1_name        => 'COLUMN_NAME',
3992                                              p_token1_value       => 'PO_RELEASE_ID',
3993                                              p_token2_name        => 'VALUE',
3994                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.po_release_id),
3995                                              p_validation_id      => PO_VAL_CONSTANTS.c_po_release_id_null,
3996                        x_results            => x_results,
3997                                              x_result_type        => l_result_type);
3998           WHEN c_source_shipment_id_null THEN
3999             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4000                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.source_shipment_id),
4001                                              p_entity_id_tbl      => p_lines.interface_id,
4002                                              p_entity_type        => c_entity_type_line,
4003                                              p_column_name        => 'SOURCE_SHIPMENT_ID',
4004                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4005                                              p_token1_name        => 'COLUMN_NAME',
4006                                              p_token1_value       => 'SOURCE_SHIPMENT_ID',
4007                                              p_token2_name        => 'VALUE',
4008                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.source_shipment_id),
4009                                              x_results            => x_results,
4010                                              x_result_type        => l_result_type);
4011           WHEN c_contract_num_null THEN
4012             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4013                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_num),
4014                                              p_entity_id_tbl      => p_lines.interface_id,
4015                                              p_entity_type        => c_entity_type_line,
4016                                              p_column_name        => 'CONTRACT_NUM',
4017                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4018                                              p_token1_name        => 'COLUMN_NAME',
4019                                              p_token1_value       => 'CONTRACT_NUM',
4020                                              p_token2_name        => 'VALUE',
4021                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_num),
4022                                              x_results            => x_results,
4023                                              x_result_type        => l_result_type);
4024           WHEN c_contract_id_null 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_lines.contract_id),
4027                                              p_entity_id_tbl      => p_lines.interface_id,
4028                                              p_entity_type        => c_entity_type_line,
4029                                              p_column_name        => 'CONTRACT_ID',
4030                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4031                                              p_token1_name        => 'COLUMN_NAME',
4032                                              p_token1_value       => 'CONTRACT_ID',
4033                                              p_token2_name        => 'VALUE',
4034                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.contract_id),
4035                                              x_results            => x_results,
4036                                              x_result_type        => l_result_type);
4037           WHEN c_type_1099_null THEN
4038             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4039                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.type_1099),
4040                                              p_entity_id_tbl      => p_lines.interface_id,
4041                                              p_entity_type        => c_entity_type_line,
4042                                              p_column_name        => 'TYPE_1099',
4043                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4044                                              p_token1_name        => 'COLUMN_NAME',
4045                                              p_token1_value       => 'TYPE_1099',
4046                                              p_token2_name        => 'VALUE',
4047                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.type_1099),
4048                                              x_results            => x_results,
4049                                              x_result_type        => l_result_type);
4050           WHEN c_closed_code_null THEN
4051             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4052                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_code),
4053                                              p_entity_id_tbl      => p_lines.interface_id,
4054                                              p_entity_type        => c_entity_type_line,
4055                                              p_column_name        => 'CLOSED_CODE',
4056                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4057                                              p_token1_name        => 'COLUMN_NAME',
4058                                              p_token1_value       => 'CLOSED_CODE',
4059                                              p_token2_name        => 'VALUE',
4060                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_code),
4061                                              x_results            => x_results,
4062                                              x_result_type        => l_result_type);
4063           WHEN c_closed_date_null THEN
4064             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4065                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_date),
4066                                              p_entity_id_tbl      => p_lines.interface_id,
4067                                              p_entity_type        => c_entity_type_line,
4068                                              p_column_name        => 'CLOSED_DATE',
4069                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4070                                              p_token1_name        => 'COLUMN_NAME',
4071                                              p_token1_value       => 'CLOSED_DATE',
4072                                              p_token2_name        => 'VALUE',
4073                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_date),
4074                                              p_validation_id      => PO_VAL_CONSTANTS.c_closed_date_null,
4075                        x_results            => x_results,
4076                                              x_result_type        => l_result_type);
4077           WHEN c_closed_by_null THEN
4078             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4079                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_by),
4080                                              p_entity_id_tbl      => p_lines.interface_id,
4081                                              p_entity_type        => c_entity_type_line,
4082                                              p_column_name        => 'CLOSED_BY',
4083                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4084                                              p_token1_name        => 'COLUMN_NAME',
4085                                              p_token1_value       => 'CLOSED_BY',
4086                                              p_token2_name        => 'VALUE',
4087                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.closed_by),
4088                                              x_results            => x_results,
4089                                              x_result_type        => l_result_type);
4090           WHEN c_over_tolerance_err_flag_null THEN
4091             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4092                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.over_tolerance_error_flag),
4093                                              p_entity_id_tbl      => p_lines.interface_id,
4094                                              p_entity_type        => c_entity_type_line,
4095                                              p_column_name        => 'OVER_TOLERANCE_ERROR_FLAG',
4096                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4097                                              p_token1_name        => 'COLUMN_NAME',
4098                                              p_token1_value       => 'OVER_TOLERANCE_ERROR_FLAG',
4099                                              p_token2_name        => 'VALUE',
4100                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.over_tolerance_error_flag),
4101                                              p_validation_id      => PO_VAL_CONSTANTS.c_over_tolerance_err_flag_null,
4102                        x_results            => x_results,
4103                                              x_result_type        => l_result_type);
4104           WHEN c_committed_amount_null 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_lines.committed_amount),
4107                                              p_entity_id_tbl      => p_lines.interface_id,
4108                                              p_entity_type        => c_entity_type_line,
4109                                              p_column_name        => 'COMMITTED_AMOUNT',
4110                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4111                                              p_token1_name        => 'COLUMN_NAME',
4112                                              p_token1_value       => 'COMMITTED_AMOUNT',
4113                                              p_token2_name        => 'VALUE',
4114                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.committed_amount),
4115                                              p_validation_id      => PO_VAL_CONSTANTS.c_committed_amount_null,
4116                        x_results            => x_results,
4117                                              x_result_type        => l_result_type);
4118           WHEN c_allow_price_override_null THEN
4119             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4120                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.allow_price_override_flag),
4121                                              p_entity_id_tbl      => p_lines.interface_id,
4122                                              p_entity_type        => c_entity_type_line,
4123                                              p_column_name        => 'ALLOW_PRICE_OVERRIDE_FLAG',
4124                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4125                                              p_token1_name        => 'COLUMN_NAME',
4126                                              p_token1_value       => 'ALLOW_PRICE_OVERRIDE_FLAG',
4127                                              p_token2_name        => 'VALUE',
4128                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.allow_price_override_flag),
4129                                              p_validation_id      => PO_VAL_CONSTANTS.c_allow_price_override_null,
4130                        x_results            => x_results,
4131                                              x_result_type        => l_result_type);
4132           WHEN c_negotiated_by_preparer_null THEN
4133             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4134                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
4135                                              p_entity_id_tbl      => p_lines.interface_id,
4136                                              p_entity_type        => c_entity_type_line,
4137                                              p_column_name        => 'NEGOTIATED_BY_PREPARER_FLAG',
4138                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4139                                              p_token1_name        => 'COLUMN_NAME',
4140                                              p_token1_value       => 'NEGOTIATED_BY_PREPARER_FLAG',
4141                                              p_token2_name        => 'VALUE',
4142                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.negotiated_by_preparer_flag),
4143                                              p_validation_id      => PO_VAL_CONSTANTS.c_negotiated_by_preparer_null,
4144                        x_results            => x_results,
4145                                              x_result_type        => l_result_type);
4146           WHEN c_capital_expense_flag_null THEN
4147             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4148                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.capital_expense_flag),
4149                                              p_entity_id_tbl      => p_lines.interface_id,
4150                                              p_entity_type        => c_entity_type_line,
4151                                              p_column_name        => 'CAPITAL_EXPENSE_FLAG',
4152                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4153                                              p_token1_name        => 'COLUMN_NAME',
4154                                              p_token1_value       => 'CAPITAL_EXPENSE_FLAG',
4155                                              p_token2_name        => 'VALUE',
4156                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.capital_expense_flag),
4157                                              p_validation_id      => PO_VAL_CONSTANTS.c_capital_expense_flag_null,
4158                        x_results            => x_results,
4159                                              x_result_type        => l_result_type);
4160           WHEN c_min_release_amount_null THEN
4161             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4162                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.min_release_amount),
4163                                              p_entity_id_tbl      => p_lines.interface_id,
4164                                              p_entity_type        => c_entity_type_line,
4165                                              p_column_name        => 'MIN_RELEASE_AMOUNT',
4166                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4167                                              p_token1_name        => 'COLUMN_NAME',
4168                                              p_token1_value       => 'MIN_RELEASE_AMOUNT',
4169                                              p_token2_name        => 'VALUE',
4170                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.min_release_amount),
4171                                              p_validation_id      => PO_VAL_CONSTANTS.c_min_release_amount_null,
4172                        x_results            => x_results,
4173                                              x_result_type        => l_result_type);
4174           -- <PDOI for Complex PO Project: Start>
4175           WHEN c_pdoi_qty_ge_qty_mstone_exec THEN
4176             PO_VAL_LINES.qty_ge_qty_milestone_exec(
4177               p_line_id_tbl => p_lines.interface_id
4178             , p_quantity_tbl => p_lines.quantity
4179             , x_result_set_id => l_result_set_id
4180             , x_result_type => l_result_type
4181             );
4182           WHEN c_pdoi_prc_ge_prc_mstone_exec THEN
4183             PO_VAL_LINES.price_ge_price_milestone_exec(
4184               p_line_id_tbl => p_lines.interface_id
4185             , p_price_tbl => p_lines.unit_price
4186             , x_result_set_id => l_result_set_id
4187             , x_result_type => l_result_type
4188             );
4189           WHEN c_pdoi_recoupment_range_check THEN
4190             PO_VAL_LINES.recoupment_rate_range_check(
4191               p_line_id_tbl  => p_lines.interface_id
4192             , p_recoupment_rate_tbl => p_lines.recoupment_rate
4193             , x_results     => x_results
4194             , x_result_type => l_result_type
4195             );
4196           WHEN c_pdoi_retainage_range_check THEN
4197             PO_VAL_LINES.retainage_rate_range_check(
4198               p_line_id_tbl  => p_lines.interface_id
4199             , p_retainage_rate_tbl => p_lines.retainage_rate
4200             , x_results     => x_results
4201             , x_result_type => l_result_type
4202             );
4203           WHEN c_pdoi_prog_pay_range_check THEN
4204             PO_VAL_LINES.prog_pay_rate_range_check(
4205               p_line_id_tbl  => p_lines.interface_id
4206             , p_prog_pay_rate_tbl => p_lines.progress_payment_rate
4207             , x_results     => x_results
4208             , x_result_type => l_result_type
4209             );
4210           WHEN c_pdoi_max_retain_amt_ge_zero THEN
4211             PO_VAL_LINES.max_retain_amt_ge_zero (
4212               p_line_id_tbl  => p_lines.interface_id
4213             , p_max_retain_amt_tbl => p_lines.max_retainage_amount
4214             , x_results     => x_results
4215             , x_result_type => l_result_type
4216             );
4217           WHEN c_pdoi_max_retain_amt_ge_retnd THEN
4218             PO_VAL_LINES.max_retain_amt_ge_retained (
4219               p_line_id_tbl  => p_lines.interface_id
4220             , p_max_retain_amt_tbl => p_lines.max_retainage_amount
4221             , x_result_set_id => l_result_set_id
4222             , x_result_type => l_result_type
4223             );
4224           WHEN c_pdoi_amt_ge_line_advance_amt THEN
4225             PO_VAL_LINES.advance_amt_le_amt(
4226               p_line_id_tbl  => p_lines.interface_id
4227             , p_advance_tbl  => p_lines.advance_amount
4228             , p_amount_tbl   => p_lines.amount
4229             , p_quantity_tbl => p_lines.quantity
4230             , p_price_tbl    => p_lines.unit_price
4231             , x_results      => x_results
4232             , x_result_type  => l_result_type
4233             );
4234           WHEN c_pdoi_complex_po_att_check THEN
4235             PO_VAL_LINES.complex_po_attributes_check(
4236               p_line_id_tbl         => p_lines.interface_id
4237             , p_style_id_tbl        => p_lines.hdr_style_id
4238             , p_retainage_rate_tbl  => p_lines.retainage_rate
4239             , p_max_retain_amt_tbl  => p_lines.max_retainage_amount
4240             , p_prog_pay_rate_tbl   => p_lines.progress_payment_rate
4241             , p_recoupment_rate_tbl => p_lines.recoupment_rate
4242             , p_advance_tbl         => p_lines.advance_amount
4243             , x_results             => x_results
4244             , x_result_type         => l_result_type
4245             );
4246           -- <PDOI for Complex PO Project: End>
4247           WHEN c_qty_rcv_exception_code_null THEN
4248             IF l_create_or_update_item <> 'Y' THEN
4249               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4250                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.qty_rcv_exception_code),
4251                                                p_entity_id_tbl      => p_lines.interface_id,
4252                                                p_entity_type        => c_entity_type_line,
4253                                                p_column_name        => 'QTY_RCV_EXCEPTION_CODE',
4254                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4255                                                p_token1_name        => 'COLUMN_NAME',
4256                                                p_token1_value       => 'QTY_RCV_EXCEPTION_CODE',
4257                                                p_token2_name        => 'VALUE',
4258                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.qty_rcv_exception_code),
4259                                                x_results            => x_results,
4260                                                x_result_type        => l_result_type);
4261             END IF;
4262           WHEN c_market_price_null THEN
4263             IF l_create_or_update_item <> 'Y' THEN
4264               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4265                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.market_price),
4266                                                p_entity_id_tbl      => p_lines.interface_id,
4267                                                p_entity_type        => c_entity_type_line,
4268                                                p_column_name        => 'MARKET_PRICE',
4269                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4270                                                p_token1_name        => 'COLUMN_NAME',
4271                                                p_token1_value       => 'MARKET_PRICE',
4272                                                p_token2_name        => 'VALUE',
4273                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_lines.market_price),
4274                                                p_validation_id      => PO_VAL_CONSTANTS.c_market_price_null,
4275                          x_results            => x_results,
4276                                                x_result_type        => l_result_type);
4277             END IF;
4278 
4279 
4280 
4281 
4282     ---------------------------------------------------------------
4283     -- Shipment Validations
4284     ---------------------------------------------------------------
4285     -- ECO 4503425: Removed the planned item null date check as this
4286     -- has been moved to submission checks
4287 
4288     WHEN c_days_early_gte_zero THEN
4289       PO_VAL_SHIPMENTS.days_early_gte_zero(
4290         p_line_loc_id_tbl => p_line_locations.line_location_id
4291       , p_days_early_rcpt_allowed_tbl => p_line_locations.days_early_receipt_allowed
4292       , x_results => x_results
4293       , x_result_type => l_result_type
4294       );
4295 
4296     WHEN c_days_late_gte_zero THEN
4297       PO_VAL_SHIPMENTS.days_late_gte_zero(
4298         p_line_loc_id_tbl => p_line_locations.line_location_id
4299       , p_days_late_rcpt_allowed_tbl => p_line_locations.days_late_receipt_allowed
4300       , x_results => x_results
4301       , x_result_type => l_result_type
4302       );
4303 
4304     WHEN c_rcv_close_tol_within_range THEN
4305       PO_VAL_SHIPMENTS.rcv_close_tol_within_range(
4306         p_line_loc_id_tbl => p_line_locations.line_location_id
4307       , p_receive_close_tolerance_tbl => p_line_locations.receive_close_tolerance
4308       , x_results     => x_results
4309       , x_result_type => l_result_type
4310       );
4311 
4312     WHEN c_over_rcpt_tol_within_range THEN
4313       PO_VAL_SHIPMENTS.over_rcpt_tol_within_range(
4314         p_line_loc_id_tbl => p_line_locations.line_location_id
4315       , p_qty_rcv_tolerance_tbl => p_line_locations.qty_rcv_tolerance
4316       , x_results     => x_results
4317       , x_result_type => l_result_type
4318       );
4319 
4320     WHEN c_match_4way_check THEN
4321       PO_VAL_SHIPMENTS.match_4way_check(
4322         p_line_loc_id_tbl => p_line_locations.line_location_id
4323       , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
4324       , p_receipt_required_flag_tbl => p_line_locations.receipt_required_flag
4325       , p_inspection_required_flag_tbl => p_line_locations.inspection_required_flag
4326       -- <Complex Work R12>: Pass payment_type
4327       , p_payment_type_tbl => p_line_locations.payment_type
4328       , x_results     => x_results
4329       , x_result_type => l_result_type
4330       );
4331 
4332     WHEN c_inv_close_tol_range_check THEN
4333       PO_VAL_SHIPMENTS.inv_close_tol_range_check(
4334         p_line_loc_id_tbl => p_line_locations.line_location_id
4335       , p_invoice_close_tolerance_tbl => p_line_locations.invoice_close_tolerance
4336       , x_results     => x_results
4337       , x_result_type => l_result_type
4338       );
4339 
4340     WHEN c_need_by_date_open_per_check THEN
4341       PO_VAL_SHIPMENTS.need_by_date_open_period_check(
4342         p_line_loc_id_tbl => p_line_locations.line_location_id
4343       --PBWC Message Change Impact: Adding a token
4344       , p_line_id_tbl => p_line_locations.po_line_id
4345       , p_need_by_date_tbl => p_line_locations.need_by_date
4346       , p_org_id_tbl => p_line_locations.org_id
4347       , x_result_set_id => l_result_set_id
4348       , x_result_type   => l_result_type
4349       );
4350 
4351     WHEN c_promise_date_open_per_check THEN
4352       PO_VAL_SHIPMENTS.promise_date_open_period_check(
4353         p_line_loc_id_tbl => p_line_locations.line_location_id
4354       --PBWC Message Change Impact: Adding a token
4355       , p_line_id_tbl => p_line_locations.po_line_id
4356       , p_promised_date_tbl => p_line_locations.promised_date
4357       , p_org_id_tbl => p_line_locations.org_id
4358       , x_result_set_id => l_result_set_id
4359       , x_result_type   => l_result_type
4360       );
4361 
4362     WHEN c_ship_to_org_null_check THEN
4363       PO_VAL_SHIPMENTS.ship_to_org_null_check(
4364         p_line_loc_id_tbl => p_line_locations.line_location_id
4365       , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
4366       , p_shipment_type_tbl => p_line_locations.shipment_type
4367       , x_results     => x_results
4368       , x_result_type => l_result_type
4369       );
4370 
4371     WHEN c_ship_to_loc_null_check THEN
4372       PO_VAL_SHIPMENTS.ship_to_loc_null_check(
4373         p_line_loc_id_tbl => p_line_locations.line_location_id
4374       , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
4375       , p_shipment_type_tbl => p_line_locations.shipment_type
4376       , x_results     => x_results
4377       , x_result_type => l_result_type
4378       );
4379 
4380     WHEN c_ship_num_gt_zero THEN
4381       PO_VAL_SHIPMENTS.ship_num_gt_zero(
4382         p_line_loc_id_tbl => p_line_locations.line_location_id
4383       , p_shipment_num_tbl => p_line_locations.shipment_num
4384       -- <Complex Work R12>: Pass payment_type
4385       , p_payment_type_tbl => p_line_locations.payment_type
4386       , x_results     => x_results
4387       , x_result_type => l_result_type
4388       );
4389 
4390     WHEN c_ship_num_unique_check THEN
4391       PO_VAL_SHIPMENTS.ship_num_unique_check(
4392         p_line_loc_id_tbl => p_line_locations.line_location_id
4393       , p_line_id_tbl => p_line_locations.po_line_id
4394       , p_shipment_num_tbl => p_line_locations.shipment_num
4395       -- <Complex Work R12>: Pass in shipment_type
4396       , p_shipment_type_tbl => p_line_locations.shipment_type
4397       , p_par_draft_id_tbl => p_line_locations.par_draft_id -- <PAR Project>
4398       , p_draft_id_tbl  => p_line_locations.draft_id -- <PAR Project>
4399       , x_result_set_id => l_result_set_id
4400       , x_result_type   => l_result_type
4401       );
4402 
4403     WHEN c_is_org_in_current_sob_check THEN
4404       PO_VAL_SHIPMENTS.is_org_in_current_sob_check(
4405         p_line_loc_id_tbl => p_line_locations.line_location_id
4406       --PBWC Message Change Impact: Adding a token
4407       , p_line_id_tbl => p_line_locations.po_line_id
4408       , p_org_id_tbl => p_line_locations.org_id
4409       , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
4410       , p_consigned_flag_tbl => p_line_locations.consigned_flag
4411       , x_results     => x_results
4412       , x_result_type => l_result_type
4413       );
4414 
4415     WHEN c_ship_qty_gt_zero THEN
4416       PO_VAL_SHIPMENTS.quantity_gt_zero(
4417         p_line_loc_id_tbl => p_line_locations.line_location_id
4418       , p_quantity_tbl => p_line_locations.quantity
4419       , p_shipment_type_tbl => p_line_locations.shipment_type
4420       , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
4421       , p_cost_constraint_tbl => p_line_locations.line_cost_constraint
4422       , x_results => x_results
4423       , x_result_type => l_result_type
4424 	  , p_header_id_tbl => p_line_locations.po_header_id  --<Bug 15871378 >
4425       );
4426 
4427     -- <Complex Work R12 Start>: Combine qty billed and rcvd into qty exec
4428     WHEN c_ship_qty_ge_qty_exec THEN
4429       PO_VAL_SHIPMENTS.quantity_ge_quantity_exec(
4430         p_line_loc_id_tbl => p_line_locations.line_location_id
4431       , p_quantity_tbl => p_line_locations.quantity
4432       , x_result_set_id => l_result_set_id
4433       , x_result_type => l_result_type
4434       );
4435     -- <Complex Work R12 End>
4436 
4437     WHEN c_ship_amt_gt_zero THEN
4438       PO_VAL_SHIPMENTS.amount_gt_zero(
4439         p_line_loc_id_tbl => p_line_locations.line_location_id
4440       , p_amount_tbl => p_line_locations.amount
4441       , p_shipment_type_tbl => p_line_locations.shipment_type
4442       , p_value_basis_tbl => p_line_locations.value_basis -- <Complex Work R12>
4443       , p_cost_constraint_tbl => p_line_locations.line_cost_constraint
4444       , x_results => x_results
4445       , x_result_type => l_result_type
4446 	  , p_header_id_tbl => p_line_locations.po_header_id  --<Bug 15871378 >
4447       );
4448 
4449     -- <Complex Work R12 Start>: Combine amt billed and rcvd into amt exec
4450     WHEN c_ship_amt_ge_amt_exec THEN
4451       PO_VAL_SHIPMENTS.amount_ge_amount_exec(
4452         p_line_loc_id_tbl => p_line_locations.line_location_id
4453       , p_amount_tbl => p_line_locations.amount
4454       , x_result_set_id => l_result_set_id
4455       , x_result_type => l_result_type
4456       );
4457     -- <Complex Work R12 End>
4458 
4459     -- Opm related validation : OPM Integration R12 Start
4460     WHEN c_ship_sec_qty_gt_zero THEN
4461       PO_VAL_SHIPMENTS.ship_sec_quantity_gt_zero(
4462         p_line_loc_id_tbl => p_line_locations.line_location_id
4463       , p_item_id_tbl  => p_line_locations.line_item_id
4464       , p_ship_to_org_id_tbl  => p_line_locations.ship_to_organization_id
4465       , p_sec_quantity_tbl => p_line_locations.secondary_quantity
4466       , x_results => x_results
4467       , x_result_type => l_result_type
4468       );
4469 
4470     WHEN c_ship_qtys_within_deviation THEN
4471       PO_VAL_SHIPMENTS.ship_qtys_within_deviation(
4472         p_line_loc_id_tbl => p_line_locations.line_location_id
4473       , p_item_id_tbl  => p_line_locations.line_item_id
4474       , p_ship_to_org_id_tbl  => p_line_locations.ship_to_organization_id
4475       , p_quantity_tbl    => p_line_locations.quantity
4476       , p_primary_uom_tbl  => p_line_locations.unit_meas_lookup_code
4477       , p_sec_quantity_tbl => p_line_locations.secondary_quantity
4478       , p_secondary_uom_tbl => p_line_locations.secondary_unit_of_measure
4479       , x_results => x_results
4480       , x_result_type => l_result_type
4481       );
4482      -- Opm related validation : OPM Integration R12 End
4483 
4484      -- Bug 5385686 : Enforce not null check on UOM
4485      WHEN c_unit_of_measure_not_null THEN
4486       PO_VAL_SHIPMENTS.unit_of_measure_not_null(
4487            p_line_loc_id_tbl  => p_line_locations.line_location_id
4488 	 , p_value_basis_tbl   => p_line_locations.value_basis
4489          , p_payment_type_tbl  => p_line_locations.payment_type
4490          , p_unit_meas_lookup_code_tbl => p_line_locations.unit_meas_lookup_code
4491          , x_results => x_results
4492          , x_result_type => l_result_type
4493       );
4494 
4495 -- Mod Project
4496     WHEN c_smod_no_cancel_shp_complt THEN
4497       PO_VAL_SHIPMENTS.mod_no_cancel_shp_complt(
4498 	p_line_loc_id_tbl => p_line_locations.po_line_id
4499       , p_control_action_tbl => p_line_locations.control_action
4500       , x_result_set_id => l_result_set_id
4501       , x_result_type => l_result_type
4502        );
4503 
4504 -- For Po Fed Fileds
4505    WHEN c_pop_start_date_le_end_date THEN
4506       PO_VAL_SHIPMENTS.pop_start_date_le_end_date
4507       (
4508         p_line_id_tbl         => p_line_locations.line_location_id
4509       , p_start_date_tbl      => p_line_locations.CLM_PERIOD_PERF_START_DATE
4510       , p_expiration_date_tbl => p_line_locations.CLM_PERIOD_PERF_END_DATE
4511       , x_results             => x_results
4512       , x_result_type         => l_result_type
4513       );
4514 
4515   WHEN c_pop_date_need_by_date THEN
4516       PO_VAL_SHIPMENTS.pop_date_need_by_date
4517       (
4518         p_line_id_tbl         => p_line_locations.line_location_id
4519       , p_start_date_tbl      => p_line_locations.CLM_PERIOD_PERF_START_DATE
4520       , p_end_date_tbl        => p_line_locations.CLM_PERIOD_PERF_END_DATE
4521       , p_need_by_date_tbl    => p_line_locations.need_by_date
4522       , x_results             => x_results
4523       , x_result_type         => l_result_type
4524       );
4525   WHEN c_complex_price_or_gt_zero THEN
4526       PO_VAL_SHIPMENTS.complex_price_or_gt_zero(
4527         p_line_loc_id_tbl => p_line_locations.line_location_id
4528       , p_price_override_tbl => p_line_locations.price_override
4529       , p_value_basis_tbl   => p_line_locations.value_basis
4530       , p_payment_type_tbl  => p_line_locations.payment_type
4531       , x_results => x_results
4532       , x_result_type => l_result_type
4533       );
4534 
4535 
4536 
4537           --------------------------------------------------------------------------
4538           -- PDOI Shipment Validation Subroutines
4539           --------------------------------------------------------------------------
4540           WHEN c_shipment_need_by_date THEN
4541             -- if purchase_basis is 'TEMP LABOR', the need_by_date column must be null
4542             PO_VAL_SHIPMENTS2.need_by_date(p_id_tbl                 => p_line_locations.interface_id,
4543                                            p_purchase_basis_tbl     => p_line_locations.purchase_basis,
4544                                            p_need_by_date_tbl       => p_line_locations.need_by_date,
4545                                            x_results                => x_results,
4546                                            x_result_type            => l_result_type);
4547           WHEN c_shipment_promised_date THEN
4548             -- if purchase_basis is 'TEMP LABOR', the promised_date must be null
4549             PO_VAL_SHIPMENTS2.promised_date(p_id_tbl                 => p_line_locations.interface_id,
4550                                             p_purchase_basis_tbl     => p_line_locations.purchase_basis,
4551                                             p_promised_date_tbl      => p_line_locations.promised_date,
4552                                             x_results                => x_results,
4553                                             x_result_type            => l_result_type);
4554           WHEN c_shipment_type_blanket THEN
4555             -- validate shipment type
4556             PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl                => p_line_locations.interface_id,
4557                                             p_shipment_type_tbl     => p_line_locations.shipment_type,
4558 					    p_style_id_tbl          => p_line_locations.hdr_style_id, -- PDOI for Complex PO Project
4559                                             p_doc_type              => c_doc_type_blanket,
4560                                             x_results               => x_results,
4561                                             x_result_type           => l_result_type);
4562           WHEN c_shipment_type_standard THEN
4563             -- validate shipment type
4564             PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl                => p_line_locations.interface_id,
4565                                             p_shipment_type_tbl     => p_line_locations.shipment_type,
4566 					    p_style_id_tbl          => p_line_locations.hdr_style_id, -- PDOI for Complex PO Project
4567                                             p_doc_type              => c_doc_type_standard,
4568                                             x_results               => x_results,
4569                                             x_result_type           => l_result_type);
4570           WHEN c_shipment_type_quotation THEN
4571             -- validate shipment type
4572             PO_VAL_SHIPMENTS2.shipment_type(p_id_tbl                => p_line_locations.interface_id,
4573                                             p_shipment_type_tbl     => p_line_locations.shipment_type,
4574 					    p_style_id_tbl          => p_line_locations.hdr_style_id, -- PDOI for Complex PO Project
4575                                             p_doc_type              => c_doc_type_quotation,
4576                                             x_results               => x_results,
4577                                             x_result_type           => l_result_type);
4578           WHEN c_shipment_num THEN
4579             -- validate shipment num is not null, greater than zero and unique
4580             -- bug 4642348: add two parameters - p_draft_id_tbl, p_doc_type
4581             PO_VAL_SHIPMENTS2.shipment_num(p_id_tbl                => p_line_locations.interface_id,
4582                                            p_shipment_num_tbl      => p_line_locations.shipment_num,
4583                                            p_shipment_type_tbl     => p_line_locations.shipment_type,
4584                                            p_po_header_id_tbl      => p_line_locations.po_header_id,
4585                                            p_po_line_id_tbl        => p_line_locations.po_line_id,
4586                                            p_draft_id_tbl          => p_line_locations.draft_id,
4587 					   p_style_id_tbl          => p_line_locations.hdr_style_id, -- PDOI for Complex PO Project
4588                                            p_doc_type              => l_doc_type,
4589                                            x_result_set_id         => l_result_set_id,
4590                                            x_results               => x_results,
4591                                            x_result_type           => l_result_type);
4592           WHEN c_terms_id_line_loc THEN
4593             PO_VALIDATION_HELPER.terms_id(p_calling_module     => p_calling_program,
4594                                           p_terms_id_tbl       => p_line_locations.terms_id,
4595                                           p_entity_id_tbl      => p_line_locations.interface_id,
4596                                           p_entity_type        => c_entity_type_line_location,
4597                                           p_validation_id      => PO_VAL_CONSTANTS.c_terms_id_line_loc,
4598                                           x_result_set_id      => l_result_set_id,
4599                                           x_result_type        => l_result_type);
4600           WHEN c_shipment_quantity THEN
4601             -- If order_type_lookup_code is RATE or FIXED PRICE, validate quantity is not null
4602             PO_VAL_SHIPMENTS2.quantity(p_id_tbl                         => p_line_locations.interface_id,
4603                                        p_quantity_tbl                   => p_line_locations.quantity,
4604                                        p_order_type_lookup_code_tbl     => p_line_locations.order_type_lookup_code,
4605 				       p_shipment_type_tbl              => p_line_locations.shipment_type, -- PDOI for Complex PO Project
4606                                        p_style_id_tbl                   => p_line_locations.hdr_style_id,  -- PDOI for Complex PO Project
4607                                        p_payment_type_tbl               => p_line_locations.payment_type,  -- PDOI for Complex PO Project
4608                                        p_line_quantity_tbl              => p_line_locations.line_quantity, -- PDOI for Complex PO Project
4609                                        x_results                        => x_results,
4610                                        x_result_type                    => l_result_type);
4611           WHEN c_shipment_price_override THEN
4612             -- If order_type_lookup_code is not FIXED PRICE, price_override cannot be null
4613             PO_VAL_SHIPMENTS2.price_override(p_id_tbl                         => p_line_locations.interface_id,
4614                                              p_price_override_tbl             => p_line_locations.price_override,
4615                                              p_order_type_lookup_code_tbl     => p_line_locations.order_type_lookup_code,
4616 					     p_shipment_type_tbl              => p_line_locations.shipment_type, -- PDOI for Complex PO Project
4617                                              p_style_id_tbl                   => p_line_locations.hdr_style_id,  -- PDOI for Complex PO Project
4618                                              p_payment_type_tbl               => p_line_locations.payment_type,  -- PDOI for Complex PO Project
4619                                              p_line_unit_price_tbl            => p_line_locations.line_unit_price, -- PDOI for Complex PO Project
4620                                              x_results                        => x_results,
4621                                              x_result_type                    => l_result_type);
4622           WHEN c_shipment_price_discount THEN
4623             -- If order_type_lookup_code is not FIXED PRICE, price_discount/price_override cannot both be null
4624             -- and price discount cannot be less than zero or greater than 100
4625             PO_VAL_SHIPMENTS2.price_discount(p_id_tbl                         => p_line_locations.interface_id,
4626                                              p_price_discount_tbl             => p_line_locations.price_discount,
4627                                              p_price_override_tbl             => p_line_locations.price_override,
4628                                              p_order_type_lookup_code_tbl     => p_line_locations.order_type_lookup_code,
4629                                              x_results                        => x_results,
4630                                              x_result_type                    => l_result_type);
4631           WHEN c_ship_to_organization_id THEN
4632             -- validate ship_to_organization_id
4633             PO_VAL_SHIPMENTS2.ship_to_organization_id(p_id_tbl                          => p_line_locations.interface_id,
4634                                                       p_ship_to_organization_id_tbl     => p_line_locations.ship_to_organization_id,
4635                                                       p_item_id_tbl                     => p_line_locations.item_id,
4636                                                       p_item_revision_tbl               => p_line_locations.item_revision,
4637                                                       p_ship_to_location_id_tbl         => p_line_locations.ship_to_location_id,
4638                                                       x_result_set_id                   => l_result_set_id,
4639                                                       x_result_type                     => l_result_type);
4640           WHEN c_shipment_effective_dates THEN
4641             -- validate_effective_dates
4642             -- bug5016163
4643             -- Added price break look up code as parameter
4644             PO_VAL_SHIPMENTS2.effective_dates(p_id_tbl                       => p_line_locations.interface_id,
4645                                               p_line_expiration_date_tbl     => p_line_locations.line_expiration_date,
4646                                               p_to_date_tbl                  => p_line_locations.to_date,
4647                                               p_from_date_tbl                => p_line_locations.from_date,
4648                                               p_header_start_date_tbl        => p_line_locations.hdr_start_date,
4649                                               p_header_end_date_tbl          => p_line_locations.hdr_end_date,
4650                                               p_price_break_lookup_code_tbl  => p_line_locations.line_price_break_lookup_code,
4651                                               x_results                      => x_results,
4652                                               x_result_type                  => l_result_type);
4653           WHEN c_qty_rcv_exception_code THEN
4654             -- validate qty_rcv_exception_code against PO_LOOKUP_CODES
4655             PO_VAL_SHIPMENTS2.qty_rcv_exception_code(p_id_tbl                         => p_line_locations.interface_id,
4656                                                      p_qty_rcv_exception_code_tbl     => p_line_locations.qty_rcv_exception_code,
4657                                                      x_result_set_id                  => l_result_set_id,
4658                                                      x_result_type                    => l_result_type);
4659           WHEN c_enforce_ship_to_loc_code THEN
4660             -- If shipment_type is STANDARD and enforce_ship_to_loc_code is not equal
4661             -- to NONE, REJECT or WARNING
4662             PO_VAL_SHIPMENTS2.enforce_ship_to_loc_code(p_id_tbl                           => p_line_locations.interface_id,
4663                                                        p_enforce_ship_to_loc_code_tbl     => p_line_locations.enforce_ship_to_location_code,
4664                                                        p_shipment_type_tbl                => p_line_locations.shipment_type,
4665                                                        x_results                          => x_results,
4666                                                        x_result_type                      => l_result_type);
4667           WHEN c_allow_sub_receipts_flag THEN
4668             -- If shipment_type is STANDARD and allow_sub_receipts_flag is not equal
4669             -- to NONE, REJECT or WARNING
4670             PO_VAL_SHIPMENTS2.allow_sub_receipts_flag(p_id_tbl                          => p_line_locations.interface_id,
4671                                                       p_shipment_type_tbl               => p_line_locations.shipment_type,
4672                                                       p_allow_sub_receipts_flag_tbl     => p_line_locations.allow_substitute_receipts_flag,
4673                                                       x_results                         => x_results,
4674                                                       x_result_type                     => l_result_type);
4675           WHEN c_days_early_receipt_allowed THEN
4676             -- If shipment_type is STANDARD and days_early_receipt_allowed is not null
4677             -- and less than zero.
4678             PO_VAL_SHIPMENTS2.days_early_receipt_allowed(p_id_tbl                          => p_line_locations.interface_id,
4679                                                          p_shipment_type_tbl               => p_line_locations.shipment_type,
4680                                                          p_days_early_rcpt_allowed_tbl     => p_line_locations.days_early_receipt_allowed,
4681                                                          x_results                         => x_results,
4682                                                          x_result_type                     => l_result_type);
4683           WHEN c_receipt_days_exception_code THEN
4684             -- If shipment_type is STANDARD and receipt_days_expection_code is not null
4685             -- and not 'NONE', 'REJECT' not 'WARNING'
4686             PO_VAL_SHIPMENTS2.receipt_days_exception_code(p_id_tbl                           => p_line_locations.interface_id,
4687                                                           p_shipment_type_tbl                => p_line_locations.shipment_type,
4688                                                           p_rcpt_days_exception_code_tbl     => p_line_locations.receipt_days_exception_code,
4689                                                           x_results                          => x_results,
4690                                                           x_result_type                      => l_result_type);
4691           WHEN c_invoice_close_tolerance THEN
4692             -- If shipment_type is STANDARD and invoice_close_tolerance is not null
4693             -- and less than or equal to zero or greater than or equal to 100.
4694             PO_VAL_SHIPMENTS2.invoice_close_tolerance(p_id_tbl                          => p_line_locations.interface_id,
4695                                                       p_shipment_type_tbl               => p_line_locations.shipment_type,
4696                                                       p_invoice_close_tolerance_tbl     => p_line_locations.invoice_close_tolerance,
4697                                                       x_results                         => x_results,
4698                                                       x_result_type                     => l_result_type);
4699           WHEN c_receive_close_tolerance THEN
4700             -- If shipment_type is STANDARD and receive_close_tolerance is not null
4701             -- and less than or equal to zero or greater than or equal to 100.
4702             PO_VAL_SHIPMENTS2.receive_close_tolerance(p_id_tbl                          => p_line_locations.interface_id,
4703                                                       p_shipment_type_tbl               => p_line_locations.shipment_type,
4704                                                       p_receive_close_tolerance_tbl     => p_line_locations.receive_close_tolerance,
4705                                                       x_results                         => x_results,
4706                                                       x_result_type                     => l_result_type);
4707           WHEN c_receiving_routing_id THEN
4708             -- Validate that receiving routing id exists in rcv_routing_headers
4709             PO_VAL_SHIPMENTS2.receiving_routing_id(p_id_tbl                       => p_line_locations.interface_id,
4710                                                    p_shipment_type_tbl            => p_line_locations.shipment_type,
4711                                                    p_receiving_routing_id_tbl     => p_line_locations.receiving_routing_id,
4712                                                    x_result_set_id                => l_result_set_id,
4713                                                    x_result_type                  => l_result_type);
4714           WHEN c_accrue_on_receipt_flag THEN
4715             -- Validate accrue_on_receipt_flag is Y or N, if not null.
4716             PO_VAL_SHIPMENTS2.accrue_on_receipt_flag(p_id_tbl                         => p_line_locations.interface_id,
4717                                                      p_accrue_on_receipt_flag_tbl     => p_line_locations.accrue_on_receipt_flag,
4718                                                      x_results                        => x_results,
4719                                                      x_result_type                    => l_result_type);
4720 	  -- <PDOI for Complex PO Project: Start>
4721           WHEN c_pdoi_amt_ge_ship_advance_amt THEN
4722             -- Validate advance amount at shipment.
4723             PO_VAL_SHIPMENTS2.advance_amt_le_amt(p_id_tbl           => p_line_locations.interface_id,
4724                                                  p_payment_type_tbl => p_line_locations.payment_type,
4725                                                  p_advance_tbl      => p_line_locations.amount,
4726                                                  p_amount_tbl       => p_line_locations.line_amount,
4727                                                  p_quantity_tbl     => p_line_locations.line_quantity,
4728                                                  p_price_tbl        => p_line_locations.line_unit_price,
4729                                                  x_results          => x_results,
4730                                                  x_result_type      => l_result_type);
4731           WHEN c_pdoi_shipment_amount THEN
4732             -- Validate amount at shipment.
4733             PO_VAL_SHIPMENTS2.amount(p_id_tbl                         => p_line_locations.interface_id,
4734                                      p_amount_tbl                     => p_line_locations.amount,
4735                                      p_shipment_type_tbl              => p_line_locations.shipment_type,
4736                                      p_style_id_tbl                   => p_line_locations.hdr_style_id,
4737                                      p_payment_type_tbl               => p_line_locations.payment_type,
4738                                      p_line_amount_tbl                => p_line_locations.line_amount,
4739                                      x_results                        => x_results,
4740                                      x_result_type                    => l_result_type);
4741           WHEN c_pdoi_payment_type THEN
4742             -- Validate payment type.
4743             PO_VAL_SHIPMENTS2.payment_type(p_id_tbl                   => p_line_locations.interface_id,
4744                                            po_line_id_tbl             => p_line_locations.po_line_id,
4745                                            p_style_id_tbl             => p_line_locations.hdr_style_id,
4746                                            p_payment_type_tbl         => p_line_locations.payment_type,
4747                                            p_shipment_type_tbl        => p_line_locations.shipment_type,
4748                                            x_results                  => x_results,
4749                                            x_result_type              => l_result_type);
4750 	  -- <PDOI for Complex PO Project: End>
4751           WHEN c_fob_lookup_code_line_loc THEN
4752             PO_VAL_SHIPMENTS2.fob_lookup_code(p_id_tbl                  => p_line_locations.interface_id,
4753                                               p_fob_lookup_code_tbl     => p_line_locations.fob_lookup_code,
4754                                               x_result_set_id           => l_result_set_id,
4755                                               x_result_type             => l_result_type);
4756           WHEN c_freight_terms_line_loc THEN
4757             PO_VAL_SHIPMENTS2.freight_terms(p_id_tbl                  => p_line_locations.interface_id,
4758                                             p_freight_terms_tbl       => p_line_locations.freight_terms_lookup_code,
4759                                             x_result_set_id           => l_result_set_id,
4760                                             x_result_type             => l_result_type);
4761           WHEN c_freight_carrier_line_loc THEN
4762             PO_VAL_SHIPMENTS2.freight_carrier(p_id_tbl                => p_line_locations.interface_id,
4763                                               p_freight_carrier_tbl   => p_line_locations.freight_carrier,
4764                                               p_inventory_org_id      => l_inventory_org_id,
4765                                               x_result_set_id         => l_result_set_id,
4766                                               x_result_type           => l_result_type);
4767           WHEN c_line_loc_style_related_info THEN
4768             PO_VAL_SHIPMENTS2.style_related_info(p_id_tbl                => p_line_locations.interface_id,
4769                                                  p_style_id_tbl          => p_line_locations.hdr_style_id,
4770                                                  x_result_set_id         => l_result_set_id,
4771                                                  x_result_type           => l_result_type);
4772           WHEN c_price_break THEN
4773             -- Cannot create price breaks for Amount-Based or Fixed Price lines in a Blanket
4774             -- Purchase Agreement.
4775             PO_VAL_SHIPMENTS2.price_break(p_id_tbl                         => p_line_locations.interface_id,
4776                                           p_order_type_lookup_code_tbl     => p_line_locations.order_type_lookup_code,
4777                                           x_results                        => x_results,
4778                                           x_result_type                    => l_result_type);
4779           WHEN c_tax_name THEN
4780             PO_VAL_SHIPMENTS2.tax_name(p_id_tbl                   => p_line_locations.interface_id,
4781                                        p_tax_name_tbl             => p_line_locations.tax_name,
4782                                        p_tax_code_id_tbl          => p_line_locations.tax_code_id,
4783                                        p_need_by_date_tbl         => p_line_locations.need_by_date,
4784                                        p_allow_tax_code_override  => l_allow_tax_code_override,
4785                                        p_operating_unit           => l_operating_unit,
4786                                        x_result_set_id            => l_result_set_id,
4787                                        x_result_type              => l_result_type);
4788           WHEN c_line_loc_secondary_uom THEN
4789             PO_VALIDATION_HELPER.secondary_unit_of_measure(p_id_tbl                      => p_line_locations.interface_id,
4790                                                            p_entity_type                 => c_entity_type_line_location,
4791                                                            p_secondary_unit_of_meas_tbl  => p_line_locations.secondary_unit_of_measure,
4792                                                            p_item_id_tbl                 => p_line_locations.item_id,
4793                                                            p_item_tbl                    => p_line_locations.item,
4794                                                            p_organization_id_tbl         => p_line_locations.ship_to_organization_id,
4795                                                            p_doc_type                    => l_doc_type,
4796                                                            p_create_or_update_item_flag  => l_create_or_update_item,
4797                                                            x_results                     => x_results,
4798                                                            x_result_type                 => l_result_type);
4799           WHEN c_line_loc_secondary_quantity THEN
4800             PO_VALIDATION_HELPER.secondary_quantity(p_id_tbl                      => p_line_locations.interface_id,
4801                                                     p_entity_type                 => c_entity_type_line_location,
4802                                                     p_secondary_quantity_tbl      => p_line_locations.secondary_quantity,
4803                                                     p_order_type_lookup_code_tbl  => p_line_locations.order_type_lookup_code,
4804                                                     p_item_id_tbl                 => p_line_locations.item_id,
4805                                                     p_item_tbl                    => p_line_locations.item,
4806                                                     p_organization_id_tbl         => p_line_locations.ship_to_organization_id,
4807                                                     p_doc_type                    => l_doc_type,
4808                                                     p_create_or_update_item_flag  => l_create_or_update_item,
4809                                                     x_results                     => x_results,
4810                                                     x_result_type                 => l_result_type);
4811           WHEN c_line_loc_preferred_grade THEN
4812             PO_VALIDATION_HELPER.preferred_grade(p_id_tbl                      => p_line_locations.interface_id,
4813                                                  p_entity_type                 => c_entity_type_line_location,
4814                                                  p_preferred_grade_tbl         => p_line_locations.preferred_grade,
4815                                                  p_item_id_tbl                 => p_line_locations.item_id,
4816                                                  p_item_tbl                    => p_line_locations.item,
4817                                                  p_organization_id_tbl         => p_line_locations.ship_to_organization_id,
4818                                                  p_create_or_update_item_flag  => l_create_or_update_item,
4819                                                  p_validation_id               => PO_VAL_CONSTANTS.c_loc_preferred_grade,
4820                          x_results                     => x_results,
4821                                                  x_result_set_id               => l_result_set_id,
4822                                                  x_result_type                 => l_result_type);
4823           WHEN c_firm_flag_null THEN
4824             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4825                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.firm_status_lookup_code),
4826                                              p_entity_id_tbl      => p_line_locations.interface_id,
4827                                              p_entity_type        => c_entity_type_line_location,
4828                                              p_column_name        => 'FIRM_FLAG',
4829                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4830                                              p_token1_name        => 'COLUMN_NAME',
4831                                              p_token1_value       => 'FIRM_FLAG',
4832                                              p_token2_name        => 'VALUE',
4833                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.firm_status_lookup_code),
4834                                              p_validation_id      => PO_VAL_CONSTANTS.c_firm_flag_null,
4835                        x_results            => x_results,
4836                                              x_result_type        => l_result_type);
4837           WHEN c_freight_carrier_null THEN
4838             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4839                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_carrier),
4840                                              p_entity_id_tbl      => p_line_locations.interface_id,
4841                                              p_entity_type        => c_entity_type_line_location,
4842                                              p_column_name        => 'FREIGHT_CARRIER',
4843                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4844                                              p_token1_name        => 'COLUMN_NAME',
4845                                              p_token1_value       => 'FREIGHT_CARRIER',
4846                                              p_token2_name        => 'VALUE',
4847                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_carrier),
4848                                              p_validation_id      => PO_VAL_CONSTANTS.c_freight_carrier_null,
4849                        x_results            => x_results,
4850                                              x_result_type        => l_result_type);
4851           WHEN c_fob_lookup_code_null THEN
4852             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4853                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.fob_lookup_code),
4854                                              p_entity_id_tbl      => p_line_locations.interface_id,
4855                                              p_entity_type        => c_entity_type_line_location,
4856                                              p_column_name        => 'FOB_LOOKUP_CODE',
4857                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4858                                              p_token1_name        => 'COLUMN_NAME',
4859                                              p_token1_value       => 'FOB_LOOKUP_CODE',
4860                                              p_token2_name        => 'VALUE',
4861                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.fob_lookup_code),
4862                                              p_validation_id      => PO_VAL_CONSTANTS.c_fob_lookup_code_null,
4863                        x_results            => x_results,
4864                                              x_result_type        => l_result_type);
4865           WHEN c_freight_terms_lookup_null THEN
4866             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4867                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_terms_lookup_code),
4868                                              p_entity_id_tbl      => p_line_locations.interface_id,
4869                                              p_entity_type        => c_entity_type_line_location,
4870                                              p_column_name        => 'FREIGHT_TERMS_LOOKUP_CODE',
4871                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
4872                                              p_token1_name        => 'COLUMN_NAME',
4873                                              p_token1_value       => 'FREIGHT_TERMS_LOOKUP_CODE',
4874                                              p_token2_name        => 'VALUE',
4875                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.freight_terms_lookup_code),
4876                                              p_validation_id      => PO_VAL_CONSTANTS.c_freight_terms_null,
4877                        x_results            => x_results,
4878                                              x_result_type        => l_result_type);
4879           WHEN c_qty_rcv_tolerance_null THEN
4880             IF l_create_or_update_item <> 'Y' THEN
4881               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4882                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.qty_rcv_tolerance),
4883                                                p_entity_id_tbl      => p_line_locations.interface_id,
4884                                                p_entity_type        => c_entity_type_line_location,
4885                                                p_column_name        => 'QTY_RCV_TOLERANCE',
4886                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4887                                                p_token1_name        => 'COLUMN_NAME',
4888                                                p_token1_value       => 'QTY_RCV_TOLERANCE',
4889                                                p_token2_name        => 'VALUE',
4890                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.qty_rcv_tolerance),
4891                                                p_validation_id      => PO_VAL_CONSTANTS.c_qty_rcv_tolerance_null,
4892                          x_results            => x_results,
4893                                                x_result_type        => l_result_type);
4894             END IF;
4895           WHEN c_receipt_required_flag_null THEN
4896             IF l_create_or_update_item <> 'Y' THEN
4897               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4898                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_required_flag),
4899                                                p_entity_id_tbl      => p_line_locations.interface_id,
4900                                                p_entity_type        => c_entity_type_line_location,
4901                                                p_column_name        => 'RECEIPT_REQUIRED_FLAG',
4902                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4903                                                p_token1_name        => 'COLUMN_NAME',
4904                                                p_token1_value       => 'RECEIPT_REQUIRED_FLAG',
4905                                                p_token2_name        => 'VALUE',
4906                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_required_flag),
4907                                                p_validation_id      => PO_VAL_CONSTANTS.c_receipt_reqd_flag_null,
4908                          x_results            => x_results,
4909                                                x_result_type        => l_result_type);
4910             END IF;
4911           WHEN c_inspection_reqd_flag_null THEN
4912             IF l_create_or_update_item <> 'Y' THEN
4913               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4914                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.inspection_required_flag),
4915                                                p_entity_id_tbl      => p_line_locations.interface_id,
4916                                                p_entity_type        => c_entity_type_line_location,
4917                                                p_column_name        => 'INSPECTION_REQUIRED_FLAG',
4918                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4919                                                p_validation_id      => PO_VAL_CONSTANTS.c_inspection_reqd_flag_null,
4920                          x_results            => x_results,
4921                                                x_result_type        => l_result_type);
4922             END IF;
4923           WHEN c_receipt_days_exception_null THEN
4924             IF l_create_or_update_item <> 'Y' THEN
4925               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4926                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_days_exception_code),
4927                                                p_entity_id_tbl      => p_line_locations.interface_id,
4928                                                p_entity_type        => c_entity_type_line_location,
4929                                                p_column_name        => 'RECEIPT_DAYS_EXCEPTION_CODE',
4930                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4931                                                p_token1_name        => 'COLUMN_NAME',
4932                                                p_token1_value       => 'RECEIPT_DAYS_EXCEPTION_CODE',
4933                                                p_token2_name        => 'VALUE',
4934                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receipt_days_exception_code),
4935                                                p_validation_id      => PO_VAL_CONSTANTS.c_receipt_days_except_null,
4936                          x_results            => x_results,
4937                                                x_result_type        => l_result_type);
4938             END IF;
4939           WHEN c_invoice_close_toler_null THEN
4940             IF l_create_or_update_item <> 'Y' THEN
4941               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4942                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.invoice_close_tolerance),
4943                                                p_entity_id_tbl      => p_line_locations.interface_id,
4944                                                p_entity_type        => c_entity_type_line_location,
4945                                                p_column_name        => 'INVOICE_CLOSE_TOLERANCE',
4946                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4947                                                p_token1_name        => 'COLUMN_NAME',
4948                                                p_token1_value       => 'INVOICE_CLOSE_TOLERANCE',
4949                                                p_token2_name        => 'VALUE',
4950                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.invoice_close_tolerance),
4951                                                p_validation_id      => PO_VAL_CONSTANTS.c_invoice_close_toler_null,
4952                          x_results            => x_results,
4953                                                x_result_type        => l_result_type);
4954             END IF;
4955           WHEN c_receive_close_toler_null THEN
4956             IF l_create_or_update_item <> 'Y' THEN
4957               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4958                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receive_close_tolerance),
4959                                                p_entity_id_tbl      => p_line_locations.interface_id,
4960                                                p_entity_type        => c_entity_type_line_location,
4961                                                p_column_name        => 'RECEIVE_CLOSE_TOLERANCE',
4962                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4963                                                p_token1_name        => 'COLUMN_NAME',
4964                                                p_token1_value       => 'RECEIVE_CLOSE_TOLERANCE',
4965                                                p_token2_name        => 'VALUE',
4966                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receive_close_tolerance),
4967                                                p_validation_id      => PO_VAL_CONSTANTS.c_receive_close_toler_null,
4968                          x_results            => x_results,
4969                                                x_result_type        => l_result_type);
4970             END IF;
4971           WHEN c_days_early_rcpt_allowed_null THEN
4972             IF l_create_or_update_item <> 'Y' THEN
4973               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4974                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_early_receipt_allowed),
4975                                                p_entity_id_tbl      => p_line_locations.interface_id,
4976                                                p_entity_type        => c_entity_type_line_location,
4977                                                p_column_name        => 'DAYS_EARLY_RECEIPT_ALLOWED',
4978                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4979                                                p_token1_name        => 'COLUMN_NAME',
4980                                                p_token1_value       => 'DAYS_EARLY_RECEIPT_ALLOWED',
4981                                                p_token2_name        => 'VALUE',
4982                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_early_receipt_allowed),
4983                                                p_validation_id      => PO_VAL_CONSTANTS.c_days_early_rcpt_allowed_null,
4984                          x_results            => x_results,
4985                                                x_result_type        => l_result_type);
4986             END IF;
4987           WHEN c_days_late_rcpt_allowed_null THEN
4988             IF l_create_or_update_item <> 'Y' THEN
4989               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
4990                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_late_receipt_allowed),
4991                                                p_entity_id_tbl      => p_line_locations.interface_id,
4992                                                p_entity_type        => c_entity_type_line_location,
4993                                                p_column_name        => 'DAYS_LATE_RECEIPT_ALLOWED',
4994                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
4995                                                p_token1_name        => 'COLUMN_NAME',
4996                                                p_token1_value       => 'DAYS_LATE_RECEIPT_ALLOWED',
4997                                                p_token2_name        => 'VALUE',
4998                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.days_late_receipt_allowed),
4999                                                p_validation_id      => PO_VAL_CONSTANTS.c_days_late_rcpt_allowed_null,
5000                          x_results            => x_results,
5001                                                x_result_type        => l_result_type);
5002             END IF;
5003           WHEN c_enfrce_ship_to_loc_code_null THEN
5004             IF l_create_or_update_item <> 'Y' THEN
5005               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
5006                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.enforce_ship_to_location_code),
5007                                                p_entity_id_tbl      => p_line_locations.interface_id,
5008                                                p_entity_type        => c_entity_type_line_location,
5009                                                p_column_name        => 'ENFORCE_SHIP_TO_LOCATION_CODE',
5010                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
5011                                                p_token1_name        => 'COLUMN_NAME',
5012                                                p_token1_value       => 'ENFORCE_SHIP_TO_LOCATION_CODE',
5013                                                p_token2_name        => 'VALUE',
5014                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.enforce_ship_to_location_code),
5015                                                p_validation_id      => PO_VAL_CONSTANTS.c_enforce_shipto_loc_code_null,
5016                          x_results            => x_results,
5017                                                x_result_type        => l_result_type);
5018             END IF;
5019           WHEN c_allow_sub_receipts_flag_null THEN
5020             IF l_create_or_update_item <> 'Y' THEN
5021               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
5022                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.allow_substitute_receipts_flag),
5023                                                p_entity_id_tbl      => p_line_locations.interface_id,
5024                                                p_entity_type        => c_entity_type_line_location,
5025                                                p_column_name        => 'ALLOW_SUBSTITUTE_RECEIPTS_FLAG',
5026                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
5027                                                p_token1_name        => 'COLUMN_NAME',
5028                                                p_token1_value       => 'ALLOW_SUBSTITUTE_RECEIPTS_FLAG',
5029                                                p_token2_name        => 'VALUE',
5030                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.allow_substitute_receipts_flag),
5031                                                p_validation_id      => PO_VAL_CONSTANTS.c_allow_sub_receipts_flag_null,
5032                          x_results            => x_results,
5033                                                x_result_type        => l_result_type);
5034             END IF;
5035           WHEN c_receiving_routing_null THEN
5036             IF l_create_or_update_item <> 'Y' THEN
5037               PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
5038                                                p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receiving_routing_id),
5039                                                p_entity_id_tbl      => p_line_locations.interface_id,
5040                                                p_entity_type        => c_entity_type_line_location,
5041                                                p_column_name        => 'RECEIVING_ROUTING_ID',
5042                                                p_message_name       => 'PO_PDOI_COLUMN_NULL',
5043                                                p_token1_name        => 'COLUMN_NAME',
5044                                                p_token1_value       => 'RECEIVING_ROUTING_ID',
5045                                                p_token2_name        => 'VALUE',
5046                                                p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.receiving_routing_id),
5047                                                p_validation_id      => PO_VAL_CONSTANTS.c_receiving_routing_null,
5048                          x_results            => x_results,
5049                                                x_result_type        => l_result_type);
5050             END IF;
5051           WHEN c_need_by_date_null THEN
5052             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
5053                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.need_by_date),
5054                                              p_entity_id_tbl      => p_line_locations.interface_id,
5055                                              p_entity_type        => c_entity_type_line_location,
5056                                              p_column_name        => 'NEED_BY_DATE',
5057                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
5058                                              p_token1_name        => 'COLUMN_NAME',
5059                                              p_token1_value       => 'NEED_BY_DATE',
5060                                              p_token2_name        => 'VALUE',
5061                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.need_by_date),
5062                                              p_validation_id      => PO_VAL_CONSTANTS.c_need_by_date_null,
5063                        x_results            => x_results,
5064                                              x_result_type        => l_result_type);
5065           WHEN c_promised_date_null THEN
5066             PO_VALIDATION_HELPER.ensure_null(p_calling_module     => p_calling_program,
5067                                              p_value_tbl          => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.promised_date),
5068                                              p_entity_id_tbl      => p_line_locations.interface_id,
5069                                              p_entity_type        => c_entity_type_line_location,
5070                                              p_column_name        => 'PROMISED_DATE',
5071                                              p_message_name       => 'PO_PDOI_COLUMN_NULL',
5072                                              p_token1_name        => 'COLUMN_NAME',
5073                                              p_token1_value       => 'PROMISED_DATE',
5074                                              p_token2_name        => 'VALUE',
5075                                              p_token2_value_tbl   => PO_TYPE_CONVERTER.to_po_tbl_varchar4000(p_line_locations.promised_date),
5076                                              p_validation_id      => PO_VAL_CONSTANTS.c_promised_date_null,
5077                        x_results            => x_results,
5078                                              x_result_type        => l_result_type);
5079 
5080 
5081     ---------------------------------------------------------------
5082     -- Price Break Validations
5083     ---------------------------------------------------------------
5084 
5085     WHEN c_at_least_one_required_field THEN
5086       IF (p_calling_program = c_program_PDOI) THEN
5087         PO_VAL_PRICE_BREAKS.at_least_one_required_field(
5088           p_line_loc_id_tbl => p_line_locations.interface_id
5089         , p_start_date_tbl => p_line_locations.from_date
5090         , p_end_date_tbl => p_line_locations.to_date
5091         , p_quantity_tbl => p_line_locations.quantity
5092         , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
5093         , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
5094         , x_results => x_results
5095         , x_result_type => l_result_type
5096         );
5097       ELSE
5098         PO_VAL_PRICE_BREAKS.at_least_one_required_field(
5099           p_line_loc_id_tbl => p_line_locations.line_location_id
5100         , p_start_date_tbl => p_line_locations.start_date
5101         , p_end_date_tbl => p_line_locations.end_date
5102         , p_quantity_tbl => p_line_locations.quantity
5103         , p_ship_to_org_id_tbl => p_line_locations.ship_to_organization_id
5104         , p_ship_to_loc_id_tbl => p_line_locations.ship_to_location_id
5105         , x_results => x_results
5106         , x_result_type => l_result_type
5107         );
5108       END IF;
5109 
5110     WHEN c_price_discount_in_percent THEN
5111       PO_VAL_PRICE_BREAKS.price_discount_in_percent(
5112         p_line_loc_id_tbl => p_line_locations.line_location_id
5113       , p_price_discount_tbl => p_line_locations.price_discount
5114       , x_results => x_results
5115       , x_result_type => l_result_type
5116       );
5117 
5118     WHEN c_price_override_gt_zero THEN
5119       PO_VAL_PRICE_BREAKS.price_override_gt_zero(
5120         p_line_loc_id_tbl => p_line_locations.line_location_id
5121       , p_price_override_tbl => p_line_locations.price_override
5122       , x_results => x_results
5123       , x_result_type => l_result_type
5124       );
5125 
5126     WHEN c_price_break_qty_ge_zero THEN
5127       PO_VAL_PRICE_BREAKS.quantity_ge_zero(
5128         p_line_loc_id_tbl => p_line_locations.line_location_id
5129       , p_quantity_tbl => p_line_locations.quantity
5130       , x_results => x_results
5131       , x_result_type => l_result_type
5132       );
5133 
5134     WHEN c_price_break_start_le_end THEN
5135       PO_VAL_PRICE_BREAKS.start_date_le_end_date(
5136         p_line_loc_id_tbl => p_line_locations.line_location_id
5137       , p_start_date_tbl => p_line_locations.start_date
5138       , p_end_date_tbl => p_line_locations.end_date
5139       , x_results => x_results
5140       , x_result_type => l_result_type
5141       );
5142 
5143     WHEN c_break_start_ge_blanket_start THEN
5144       PO_VAL_PRICE_BREAKS.break_start_ge_blanket_start(
5145         p_line_loc_id_tbl => p_line_locations.line_location_id
5146       , p_blanket_start_date_tbl => p_line_locations.hdr_start_date
5147       , p_price_break_start_date_tbl => p_line_locations.start_date
5148       , x_results => x_results
5149       , x_result_type => l_result_type
5150       );
5151 
5152     WHEN c_break_start_le_blanket_end THEN
5153       PO_VAL_PRICE_BREAKS.break_start_le_blanket_end(
5154         p_line_loc_id_tbl => p_line_locations.line_location_id
5155       , p_blanket_end_date_tbl => p_line_locations.hdr_end_date
5156       , p_price_break_start_date_tbl => p_line_locations.start_date
5157       , x_results => x_results
5158       , x_result_type => l_result_type
5159       );
5160 
5161     WHEN c_break_start_le_expiration THEN
5162       PO_VAL_PRICE_BREAKS.break_start_le_expiration(
5163         p_line_loc_id_tbl => p_line_locations.line_location_id
5164       , p_expiration_date_tbl => p_line_locations.line_expiration_date
5165       , p_price_break_start_date_tbl => p_line_locations.start_date
5166       , x_results => x_results
5167       , x_result_type => l_result_type
5168       );
5169 
5170     WHEN c_break_end_le_expiration THEN
5171       PO_VAL_PRICE_BREAKS.break_end_le_expiration(
5172         p_line_loc_id_tbl => p_line_locations.line_location_id
5173       , p_expiration_date_tbl => p_line_locations.line_expiration_date
5174       , p_price_break_end_date_tbl => p_line_locations.end_date
5175       , x_results => x_results
5176       , x_result_type => l_result_type
5177       );
5178 
5179     WHEN c_break_end_ge_blanket_start THEN
5180       PO_VAL_PRICE_BREAKS.break_end_ge_blanket_start(
5181         p_line_loc_id_tbl => p_line_locations.line_location_id
5182       , p_blanket_start_date_tbl => p_line_locations.hdr_start_date
5183       , p_price_break_end_date_tbl => p_line_locations.end_date
5184       , x_results => x_results
5185       , x_result_type => l_result_type
5186       );
5187 
5188     WHEN c_break_end_le_blanket_end THEN
5189       PO_VAL_PRICE_BREAKS.break_end_le_blanket_end(
5190         p_line_loc_id_tbl => p_line_locations.line_location_id
5191       , p_blanket_end_date_tbl => p_line_locations.hdr_end_date
5192       , p_price_break_end_date_tbl => p_line_locations.end_date
5193       , x_results => x_results
5194       , x_result_type => l_result_type
5195       );
5196 
5197     ---------------------------------------------------------------
5198     -- Distribution Validations
5199     ---------------------------------------------------------------
5200 
5201     WHEN c_dist_num_unique THEN
5202       PO_VAL_DISTRIBUTIONS.dist_num_unique(
5203         p_dist_id_tbl => p_distributions.po_distribution_id
5204       , p_line_loc_id_tbl => p_distributions.line_location_id
5205       , p_dist_num_tbl => p_distributions.distribution_num
5206       , p_par_draft_id_tbl => p_distributions.par_draft_id -- <PAR Project>
5207       , p_draft_id_tbl  => p_distributions.draft_id -- <PAR Project>
5208       , x_result_set_id => l_result_set_id
5209       , x_result_type => l_result_type
5210       );
5211 
5212     WHEN c_dist_num_gt_zero THEN
5213       PO_VAL_DISTRIBUTIONS.dist_num_gt_zero(
5214         p_dist_id_tbl => p_distributions.po_distribution_id
5215       , p_dist_num_tbl => p_distributions.distribution_num
5216       , x_results => x_results
5217       , x_result_type => l_result_type
5218       );
5219 
5220     WHEN c_dist_qty_gt_zero THEN
5221       PO_VAL_DISTRIBUTIONS.quantity_gt_zero(
5222         p_dist_id_tbl => p_distributions.po_distribution_id
5223       , p_qty_ordered_tbl => p_distributions.quantity_ordered
5224       -- <Complex Work R12>: Use value_basis instead of order_type_lookup_code
5225       , p_value_basis_tbl => p_distributions.ship_value_basis
5226       , p_cost_constraint_tbl => p_distributions.line_cost_constraint
5227       , x_results => x_results
5228       , x_result_type => l_result_type
5229 	  , p_header_id_tbl => p_distributions.po_header_id  --<Bug 15871378>
5230       );
5231 
5232     -- <Complex Work R12 Start>: Combined billed and del into exec
5233     WHEN c_dist_qty_ge_qty_exec THEN
5234       PO_VAL_DISTRIBUTIONS.quantity_ge_quantity_exec(
5235         p_dist_id_tbl => p_distributions.po_distribution_id
5236       , p_dist_type_tbl => p_distributions.distribution_type
5237       , p_qty_ordered_tbl => p_distributions.quantity_ordered
5238       , x_result_set_id => l_result_set_id
5239       , x_result_type => l_result_type
5240       );
5241     -- <Complex Work R12 End>
5242 
5243     WHEN c_dist_amt_gt_zero THEN
5244       PO_VAL_DISTRIBUTIONS.amount_gt_zero(
5245         p_dist_id_tbl => p_distributions.po_distribution_id
5246       , p_amt_ordered_tbl => p_distributions.amount_ordered
5247       -- <Complex Work R12>: Use value_basis instead of order_type_lookup_code
5248       , p_value_basis_tbl => p_distributions.ship_value_basis
5249       , p_cost_constraint_tbl => p_distributions.line_cost_constraint
5250       , x_results => x_results
5251       , x_result_type => l_result_type
5252 	  , p_header_id_tbl => p_distributions.po_header_id  --<Bug 15871378>
5253       );
5254 
5255     -- <Complex Work R12 Start>: Combined billed and del into exec
5256     WHEN c_dist_amt_ge_amt_exec THEN
5257       PO_VAL_DISTRIBUTIONS.amount_ge_amount_exec(
5258         p_dist_id_tbl => p_distributions.po_distribution_id
5259       , p_dist_type_tbl => p_distributions.distribution_type
5260       , p_amt_ordered_tbl => p_distributions.amount_ordered
5261       , x_result_set_id => l_result_set_id
5262       , x_result_type => l_result_type
5263       );
5264     -- <Complex Work R12 End>
5265 
5266     WHEN c_pjm_unit_number_effective THEN
5267       PO_VAL_DISTRIBUTIONS.pjm_unit_number_effective(
5268         p_dist_id_tbl => p_distributions.po_distribution_id
5269       , p_end_item_unit_number_tbl => p_distributions.end_item_unit_number
5270       , p_item_id_tbl => p_distributions.line_item_id
5271       , p_ship_to_org_id_tbl => p_distributions.ship_to_organization_id
5272       -- Bug# 4338241: Adding destination type
5273       , p_destination_type_code_tbl => p_distributions.destination_type_code
5274       , x_results => x_results
5275       , x_result_type => l_result_type
5276       );
5277 
5278     WHEN c_amount_to_encumber_ge_zero THEN
5279       PO_VAL_DISTRIBUTIONS.amount_to_encumber_ge_zero(
5280         p_dist_id_tbl => p_distributions.po_distribution_id
5281       , p_amount_to_encumber_tbl => p_distributions.amount_to_encumber
5282       , x_results => x_results
5283       , x_result_type => l_result_type
5284       );
5285 
5286     WHEN c_budget_account_id_not_null THEN
5287       PO_VAL_DISTRIBUTIONS.budget_account_id_not_null(
5288         p_dist_id_tbl => p_distributions.po_distribution_id
5289       , p_budget_account_id_tbl => p_distributions.budget_account_id
5290       , x_results => x_results
5291       , x_result_type => l_result_type
5292       );
5293 
5294     WHEN c_gl_encumbered_date_not_null THEN
5295       PO_VAL_DISTRIBUTIONS.gl_encumbered_date_not_null(
5296         p_dist_id_tbl => p_distributions.po_distribution_id
5297       , p_gl_encumbered_date_tbl => p_distributions.gl_encumbered_date
5298       , x_results => x_results
5299       , x_result_type => l_result_type
5300       );
5301 
5302     WHEN c_gl_enc_date_not_null_open THEN
5303       PO_VAL_DISTRIBUTIONS.gl_enc_date_not_null_open(
5304         p_dist_id_tbl => p_distributions.po_distribution_id
5305       , p_org_id_tbl => p_distributions.org_id
5306       , p_gl_encumbered_date_tbl => p_distributions.gl_encumbered_date
5307       , p_dist_type_tbl => p_distributions.distribution_type --Bug 14664343
5308       , x_results => x_results
5309       , x_result_type => l_result_type
5310       );
5311 
5312     WHEN c_unencum_amt_le_amt_to_encum THEN
5313       PO_VAL_DISTRIBUTIONS.unencum_amt_le_amt_to_encum(
5314         p_dist_id_tbl => p_distributions.po_distribution_id
5315       , p_amount_to_encumber_tbl => p_distributions.amount_to_encumber
5316       , p_unencumbered_amount_tbl => p_distributions.unencumbered_amount
5317       , x_results => x_results
5318       , x_result_type => l_result_type
5319       );
5320 
5321     WHEN c_oop_enter_all_fields THEN
5322       PO_VAL_DISTRIBUTIONS.oop_enter_all_fields(
5323         p_dist_id_tbl => p_distributions.po_distribution_id
5324       , p_line_line_type_id_tbl => p_distributions.line_line_type_id
5325       , p_wip_entity_id_tbl => p_distributions.wip_entity_id
5326       , p_wip_line_id_tbl => p_distributions.wip_line_id
5327       , p_wip_operation_seq_num_tbl => p_distributions.wip_operation_seq_num
5328       , p_destination_type_code_tbl => p_distributions.destination_type_code
5329       , p_wip_resource_seq_num_tbl => p_distributions.wip_resource_seq_num
5330       , x_results => x_results
5331       , x_result_type => l_result_type
5332       );
5333 
5334     WHEN c_gms_data_valid THEN
5335       PO_VAL_DISTRIBUTIONS.gms_data_valid(
5336         p_dist_id_tbl => p_distributions.po_distribution_id
5337       , p_project_id_tbl => p_distributions.project_id
5338       , p_task_id_tbl => p_distributions.task_id
5339       , p_award_number_tbl => p_distributions.award_number
5340       , p_expenditure_type_tbl => p_distributions.expenditure_type
5341       , p_expenditure_item_date_tbl => p_distributions.expenditure_item_date
5342       , x_results => x_results
5343       , x_result_type => l_result_type
5344       );
5345 
5346     -- ECO 4059111 : FV Validation
5347      WHEN c_check_fv_validations THEN
5348        PO_VAL_DISTRIBUTIONS.check_fv_validations(
5349          p_dist_id_tbl     => p_distributions.po_distribution_id
5350        , p_ccid_tbl        => p_distributions.code_combination_id
5351        , p_org_id_tbl      => p_distributions.org_id
5352        , p_attribute1_tbl  => p_distributions.attribute1
5353        , p_attribute2_tbl  => p_distributions.attribute2
5354        , p_attribute3_tbl  => p_distributions.attribute3
5355        , p_attribute4_tbl  => p_distributions.attribute4
5356        , p_attribute5_tbl  => p_distributions.attribute5
5357        , p_attribute6_tbl  => p_distributions.attribute6
5358        , p_attribute7_tbl  => p_distributions.attribute7
5359        , p_attribute8_tbl  => p_distributions.attribute8
5360        , p_attribute9_tbl  => p_distributions.attribute9
5361        , p_attribute10_tbl => p_distributions.attribute10
5362        , p_attribute11_tbl => p_distributions.attribute11
5363        , p_attribute12_tbl => p_distributions.attribute12
5364        , p_attribute13_tbl => p_distributions.attribute13
5365        , p_attribute14_tbl => p_distributions.attribute14
5366        , p_attribute15_tbl => p_distributions.attribute15
5367        , x_results         => x_results
5368        , x_result_type     => l_result_type
5369        );
5370 
5371      /* CLM Partial Funding Changes -- START */
5372      WHEN c_fund_value_ge_zero THEN
5373        PO_VAL_DISTRIBUTIONS.funded_value_ge_zero(
5374          p_dist_id_tbl              => p_distributions.po_distribution_id
5375        , p_org_id_tbl               => p_distributions.org_id
5376        , p_style_id_tbl             => p_distributions.style_id
5377        , p_partial_funded_flag_tbl  => p_distributions.partial_funded_flag
5378        , p_funded_value_tbl         => p_distributions.funded_value
5379        , x_results                  => x_results
5380        , x_result_type              => l_result_type
5381        );
5382 
5383      WHEN c_fund_value_le_tot_ord_value THEN
5384        PO_VAL_DISTRIBUTIONS.funded_val_le_tot_order_val(
5385          p_dist_id_tbl              => p_distributions.po_distribution_id
5386        , p_org_id_tbl               => p_distributions.org_id
5387        , p_style_id_tbl             => p_distributions.style_id
5388        , p_partial_funded_flag_tbl  => p_distributions.partial_funded_flag
5389        , p_funded_value_tbl         => p_distributions.funded_value
5390        , p_quantity_ordered_tbl     => p_distributions.quantity_ordered
5391        , p_amount_ordered_tbl       => p_distributions.amount_ordered
5392        , p_price_override_tbl       => p_distributions.price_override
5393        , p_nonrecoverable_tax_tbl   => p_distributions.nonrecoverable_tax
5394        , p_rate_tbl                 => p_distributions.rate
5395        , x_results                  => x_results
5396        , x_result_type              => l_result_type
5397        );
5398 
5399      WHEN c_qty_fund_ge_exc_qty THEN
5400        PO_VAL_DISTRIBUTIONS.qty_funded_ge_exc_qty(
5401          p_dist_id_tbl              => p_distributions.po_distribution_id
5402        , p_org_id_tbl               => p_distributions.org_id
5403        , p_style_id_tbl             => p_distributions.style_id
5404        , p_quantity_funded_tbl      => p_distributions.quantity_funded
5405        , p_quantity_billed_tbl      => p_distributions.quantity_billed
5406        , p_quantity_delivered_tbl   => p_distributions.quantity_delivered
5407        , x_results                  => x_results
5408        , x_result_type              => l_result_type
5409        );
5410 
5411      WHEN c_amt_fund_ge_exc_amt THEN
5412        PO_VAL_DISTRIBUTIONS.amount_funded_ge_exc_amount(
5413          p_dist_id_tbl              => p_distributions.po_distribution_id
5414        , p_org_id_tbl               => p_distributions.org_id
5415        , p_style_id_tbl             => p_distributions.style_id
5416        , p_amount_funded_tbl        => p_distributions.amount_funded
5417        , p_amount_billed_tbl        => p_distributions.amount_billed
5418        , p_amount_delivered_tbl     => p_distributions.amount_delivered
5419        , p_line_matching_basis_tbl  => p_distributions.line_matching_basis --bug 13773450
5420        , x_results                  => x_results
5421        , x_result_type              => l_result_type
5422        );
5423 
5424      WHEN c_fund_value_gt_backing_req THEN
5425        PO_VAL_DISTRIBUTIONS.funded_value_gt_backing_req(
5426          p_dist_id_tbl              => p_distributions.po_distribution_id
5427        , p_org_id_tbl               => p_distributions.org_id
5428        , p_style_id_tbl             => p_distributions.style_id
5429        , p_funded_value_tbl         => p_distributions.funded_value
5430        , p_req_distribution_id_tbl  => p_distributions.req_distribution_id
5431        , x_results                  => x_results
5432        , x_result_type              => l_result_type
5433        );
5434      /* CLM Partial Funding Changes -- END */
5435 
5436      WHEN c_funded_val_gt_req_funds_rmn THEN -- CLM LnSc: Funds Remaining Check
5437        PO_VAL_DISTRIBUTIONS.funded_val_gt_req_funds_rmn(
5438          p_dist_id_tbl      => p_distributions.po_distribution_id,
5439          p_dist_type_tbl    => p_distributions.distribution_type,
5440          p_org_id_tbl       => p_distributions.org_id,
5441          p_style_id_tbl     => p_distributions.style_id,
5442          p_draft_id_tbl     => p_distributions.draft_id,
5443          p_funded_value_tbl => p_distributions.funded_value,
5444          p_enc_amount_tbl   => p_distributions.encumbered_amount,
5445          p_req_dist_id_tbl  => p_distributions.req_distribution_id,
5446          x_result_set_id    => l_result_set_id,
5447          x_result_type      => l_result_type
5448        );
5449 
5450        --PAR Project
5451        --Check if amount/quantity is increased on a PAR
5452        WHEN c_par_dist_value_increased THEN
5453        PO_VAL_DISTRIBUTIONS.check_dist_values_inc_for_par(
5454          p_dist_id_tbl          => p_distributions.po_distribution_id,
5455          p_draft_id_tbl         => p_distributions.draft_id,
5456          p_draft_type_tbl       => p_distributions.draft_type,
5457          p_quantity_ordered_tbl => p_distributions.quantity_ordered,
5458          p_amt_ordered_tbl      => p_distributions.amount_ordered,
5459          p_old_qty_ordered_tbl  => p_distributions.old_quantity_ordered,
5460 	 p_change_status_tbl    => p_distributions.change_status,
5461          x_results              => x_results,
5462          x_result_type          => l_result_type
5463        );
5464 
5465 
5466      -- Bug 5442682 : Validate project related fields
5467      -- Bug 7558385
5468      -- Need to check for PJM Parameters before making Task as mandatory.
5469      -- For fetching the PJM paramters passing ship to org id.
5470 
5471      WHEN c_check_proj_rel_validations THEN
5472        PO_VAL_DISTRIBUTIONS.check_proj_related_validations(
5473          p_dist_id_tbl     => p_distributions.po_distribution_id
5474        , p_dest_type_code_tbl      => p_distributions.destination_type_code
5475        , p_project_id_tbl               => p_distributions.project_id
5476        , p_task_id_tbl                   => p_distributions.task_id
5477        , p_award_id_tbl                => p_distributions.award_id
5478        , p_expenditure_type_tbl    => p_distributions.expenditure_type
5479        , p_expenditure_org_id_tbl       => p_distributions.expenditure_organization_id
5480        , p_expenditure_item_date_tbl  => p_distributions.expenditure_item_date
5481        , p_ship_to_org_id_tbl     =>  p_distributions.ship_to_organization_id
5482        , x_results                               => x_results
5483        , x_result_type                        => l_result_type
5484        );
5485 
5486        --PDOI CLM Integration : Validation for proper funding at clin slin level
5487      WHEN c_pdoi_check_clin_slin_funding THEN
5488        PO_VAL_DISTRIBUTIONS.check_clin_slin_funding(
5489          p_intf_dist_id_tbl      => p_distributions.interface_id,
5490          --p_dist_id_tbl     => p_distributions.po_distribution_id,
5491          x_results                            => x_results,
5492          x_result_type                        => l_result_type
5493        );
5494      WHEN c_validate_clm_defence_funding THEN
5495        PO_VAL_DISTRIBUTIONS.validate_defence_funding(
5496          p_intf_dist_id_tbl      => p_distributions.interface_id,
5497          p_clm_defence_funding_tbl     => p_distributions.clm_defence_funding,
5498          x_results                            => x_results,
5499          x_result_type                        => l_result_type
5500        );
5501      WHEN c_validate_option_distribution THEN
5502        PO_VAL_DISTRIBUTIONS.validate_option_distribution(
5503          p_intf_dist_id_tbl      => p_distributions.interface_id,
5504          x_results               => x_results,
5505          x_result_type           => l_result_type
5506        );
5507 
5508         -------------------------------------------------------------------------
5509         -- PDOI Distributions Validation Subroutines
5510         -------------------------------------------------------------------------
5511           WHEN c_dist_amount_ordered THEN
5512             PO_VAL_DISTRIBUTIONS2.amount_ordered(p_id_tbl                  => p_distributions.interface_id,
5513                                                  p_amount_ordered_tbl      => p_distributions.amount_ordered,
5514                                                  p_order_type_code_tbl     => p_distributions.line_order_type_lookup_code,
5515 						 p_distribution_type_tbl   => p_distributions.distribution_type,  -- PDOI for Complex PO Project
5516                                                  x_results                 => x_results,
5517                                                  x_result_type             => l_result_type);
5518           WHEN c_dist_quantity_ordered THEN
5519             PO_VAL_DISTRIBUTIONS2.quantity_ordered(p_id_tbl                   => p_distributions.interface_id,
5520                                                    p_quantity_ordered_tbl     => p_distributions.quantity_ordered,
5521                                                    p_order_type_code_tbl      => p_distributions.line_order_type_lookup_code,
5522 						   p_distribution_type_tbl    => p_distributions.distribution_type,  -- PDOI for Complex PO Project
5523                                                    x_results                  => x_results,
5524                                                    x_result_type              => l_result_type);
5525           WHEN c_dist_destination_org_id THEN
5526             PO_VAL_DISTRIBUTIONS2.destination_org_id(p_id_tbl                 => p_distributions.interface_id,
5527                                                      p_dest_org_id_tbl        => p_distributions.destination_organization_id,
5528                                                      p_ship_to_org_id_tbl     => p_distributions.ship_to_organization_id,
5529                                                      x_results                => x_results,
5530                                                      x_result_type            => l_result_type);
5531           WHEN c_dist_deliver_to_location_id THEN
5532             PO_VAL_DISTRIBUTIONS2.deliver_to_location_id(p_id_tbl                         => p_distributions.interface_id,
5533                                                          p_deliver_to_location_id_tbl     => p_distributions.deliver_to_location_id,
5534                                                          p_ship_to_org_id_tbl             => p_distributions.ship_to_organization_id,
5535                                                          x_result_set_id                  => l_result_set_id,
5536                                                          x_result_type                    => l_result_type);
5537           WHEN c_dist_deliver_to_person_id THEN
5538             PO_VAL_DISTRIBUTIONS2.deliver_to_person_id(p_id_tbl                       => p_distributions.interface_id,
5539                                                        p_deliver_to_person_id_tbl     => p_distributions.deliver_to_person_id,
5540                                                        x_result_set_id                => l_result_set_id,
5541                                                        x_result_type                  => l_result_type);
5542           WHEN c_dist_destination_type_code THEN
5543             PO_VAL_DISTRIBUTIONS2.destination_type_code(p_id_tbl                         => p_distributions.interface_id,
5544                                                         p_dest_type_code_tbl             => p_distributions.destination_type_code,
5545                                                         p_ship_to_org_id_tbl             => p_distributions.ship_to_organization_id,
5546                                                         p_item_id_tbl                    => p_distributions.line_item_id,
5547                                                         p_txn_flow_header_id_tbl         => p_distributions.transaction_flow_header_id,
5548                                                         p_accrue_on_receipt_flag_tbl     => p_distributions.accrue_on_receipt_flag,
5549                                                         p_value_basis_tbl                => p_distributions.line_order_type_lookup_code,
5550                                                         p_purchase_basis_tbl             => p_distributions.line_purchase_basis,      --bug7644072
5551                                                         p_expense_accrual_code           => l_expense_accrual_code,
5552                                                         p_loc_outsourced_assembly_tbl    => p_distributions.loc_outsourced_assembly,
5553                                                         x_result_set_id                  => l_result_set_id,
5554                                                         x_results                        => x_results,
5555                                                         x_result_type                    => l_result_type);
5556           WHEN c_dist_destination_subinv THEN
5557             PO_VAL_DISTRIBUTIONS2.destination_subinv(p_id_tbl                     => p_distributions.interface_id,
5558                                                      p_destination_subinv_tbl     => p_distributions.destination_subinventory,
5559                                                      p_dest_type_code_tbl         => p_distributions.destination_type_code,
5560                                                      p_item_id_tbl                => p_distributions.line_item_id,
5561                                                      p_ship_to_org_id_tbl         => p_distributions.ship_to_organization_id,
5562                                                      p_loc_outsourced_assembly_tbl => p_distributions.loc_outsourced_assembly,
5563                                                      x_result_set_id              => l_result_set_id,
5564                                                      x_results                    => x_results,
5565                                                      x_result_type                => l_result_type);
5566           WHEN c_dist_wip_entity_id THEN
5567             PO_VAL_DISTRIBUTIONS2.wip_entity_id(p_id_tbl                      => p_distributions.interface_id,
5568                                                 p_wip_entity_id_tbl           => p_distributions.wip_entity_id,
5569                                                 p_wip_rep_schedule_id_tbl     => p_distributions.wip_repetitive_schedule_id,
5570                                                 p_dest_type_code_tbl          => p_distributions.destination_type_code,
5571                                                 p_destination_org_id_tbl      => p_distributions.destination_organization_id,
5572                                                 x_result_set_id               => l_result_set_id,
5573                                                 x_results                     => x_results,
5574                                                 x_result_type                 => l_result_type);
5575           WHEN c_prevent_encumberance_flag THEN
5576             PO_VAL_DISTRIBUTIONS2.prevent_encumbrance_flag(p_id_tbl                     => p_distributions.interface_id,
5577                                                            p_prevent_encum_flag_tbl     => p_distributions.prevent_encumbrance_flag,
5578                                                            p_dest_type_code_tbl         => p_distributions.destination_type_code,
5579 							   p_distribution_type_tbl      => p_distributions.distribution_type, -- PDOI for Complex PO Project
5580                      /* Encumbrance Project */             p_wip_entity_id_tbl          => p_distributions.wip_entity_id,
5581                                                            x_results                    => x_results,
5582                                                            x_result_type                => l_result_type);
5583           WHEN c_charge_account_id THEN
5584             PO_VAL_DISTRIBUTIONS2.charge_account_id(p_id_tbl                    => p_distributions.interface_id,
5585                                                     p_charge_account_id_tbl     => p_distributions.code_combination_id,
5586                                                     p_gl_date_tbl               => p_distributions.gl_encumbered_date,
5587                                                     p_chart_of_account_id       => l_chart_of_account_id,
5588                                                     x_result_set_id             => l_result_set_id,
5589                                                     x_result_type               => l_result_type);
5590           WHEN c_budget_account_id THEN
5591             PO_VAL_DISTRIBUTIONS2.budget_account_id(p_id_tbl                    => p_distributions.interface_id,
5592                                                     p_budget_account_id_tbl     => p_distributions.budget_account_id,
5593                                                     p_gl_date_tbl               => p_distributions.gl_encumbered_date,
5594                                                     p_dest_type_code_tbl        => p_distributions.destination_type_code,
5595 						    p_distribution_type_tbl     => p_distributions.distribution_type, -- PDOI for Complex PO Project
5596                                                     p_chart_of_account_id       => l_chart_of_account_id,
5597                                                     p_po_encumberance_flag      => l_po_encumbrance_flag,
5598                      /* Encumbrance Project */      p_wip_entity_id_tbl          => p_distributions.wip_entity_id,
5599                                                     x_result_set_id             => l_result_set_id,
5600                                                     x_result_type               => l_result_type);
5601           WHEN c_accrual_account_id THEN
5602             PO_VAL_DISTRIBUTIONS2.account_id(p_id_tbl                  => p_distributions.interface_id,
5603                                              p_account_id_tbl          => p_distributions.accrual_account_id,
5604                                              p_gl_date_tbl             => p_distributions.gl_encumbered_date,
5605                                              p_chart_of_account_id     => l_chart_of_account_id,
5606                                              p_message_name            => 'PO_PDOI_INVALID_ACCRUAL_ACCT',
5607                                              p_column_name             => 'ACCRUAL_ACCOUNT_ID',
5608                                              p_token_name              => 'ACCRUAL_ACCOUNT',
5609                                              x_result_set_id           => l_result_set_id,
5610                                              x_result_type             => l_result_type);
5611           WHEN c_variance_account_id THEN
5612             PO_VAL_DISTRIBUTIONS2.account_id(p_id_tbl                  => p_distributions.interface_id,
5613                                              p_account_id_tbl          => p_distributions.variance_account_id,
5614                                              p_gl_date_tbl             => p_distributions.gl_encumbered_date,
5615                                              p_chart_of_account_id     => l_chart_of_account_id,
5616                                              p_message_name            => 'PO_PDOI_INVALID_VAR_ACCT',
5617                                              p_column_name             => 'VARIANCE_ACCOUNT_ID',
5618                                              p_token_name              => 'VARIANCE_ACCOUNT',
5619                                              x_result_set_id           => l_result_set_id,
5620                                              x_result_type             => l_result_type);
5621           WHEN c_project_acct_context THEN
5622             PO_VAL_DISTRIBUTIONS2.project_acct_context(p_id_tbl                   => p_distributions.interface_id,
5623                                                        p_project_acct_ctx_tbl     => p_distributions.project_accounting_context,
5624                                                        p_project_id_tbl           => p_distributions.project_id,
5625                                                        p_task_id_tbl              => p_distributions.task_id,
5626                                                        p_exp_type_tbl             => p_distributions.expenditure_type,
5627                                                        p_exp_org_id_tbl           => p_distributions.expenditure_organization_id,
5628                                                        x_results                  => x_results,
5629                                                        x_result_type              => l_result_type);
5630           WHEN c_project_info THEN
5631             PO_VAL_DISTRIBUTIONS2.project_info(p_id_tbl                        => p_distributions.interface_id,
5632                                                p_project_acct_ctx_tbl          => p_distributions.project_accounting_context,
5633                                                p_dest_type_code_tbl            => p_distributions.destination_type_code,
5634                                                p_project_id_tbl                => p_distributions.project_id,
5635                                                p_task_id_tbl                   => p_distributions.task_id,
5636                                                p_expenditure_type_tbl          => p_distributions.expenditure_type,
5637                                                p_expenditure_org_id_tbl        => p_distributions.expenditure_organization_id,
5638                                                p_ship_to_org_id_tbl            => p_distributions.ship_to_organization_id,
5639                                                p_need_by_date_tbl              => p_distributions.header_need_by_date,
5640                                                p_promised_date_tbl             => p_distributions.promised_date,
5641                                                p_expenditure_item_date_tbl     => p_distributions.expenditure_item_date,
5642                                                p_ship_to_ou_id                 => l_operating_unit,
5643                                                p_deliver_to_person_id_tbl      => p_distributions.deliver_to_person_id,
5644                                                p_agent_id_tbl                  => p_distributions.hdr_agent_id,
5645                                                p_txn_flow_header_id_tbl        => p_distributions.transaction_flow_header_id,
5646                                                x_results                       => x_results,
5647                                                x_result_type                   => l_result_type);
5648           WHEN c_tax_recovery_override_flag THEN
5649             PO_VAL_DISTRIBUTIONS2.tax_recovery_override_flag(p_id_tbl                     => p_distributions.interface_id,
5650                                                              p_recovery_override_flag_tbl => p_distributions.tax_recovery_override_flag,
5651                                                              p_allow_tax_rate_override    => l_allow_tax_rate_override,
5652                                                              x_results                    => x_results,
5653                                                              x_result_type                => l_result_type);
5654          -- <<ACRN proj start>>
5655     WHEN c_ACRN_value_valid THEN
5656 
5657       PO_VAL_DISTRIBUTIONS2.ACRN_value_valid(
5658          p_dist_id_tbl              => p_distributions.interface_id
5659        , p_style_id_tbl             => p_distributions.style_id
5660        , p_ACRN_tbl                 => p_distributions.ACRN
5661        , x_results                  => x_results
5662        , x_result_type              => l_result_type
5663        );
5664      -- <<ACRN proj end>>
5665 
5666 	  -- CLM Partial Funding Changes
5667           WHEN c_partial_funded_flag THEN
5668             PO_VAL_DISTRIBUTIONS2.partial_funded_flag(p_id_tbl                   => p_distributions.interface_id,
5669                                                       p_partial_funded_flag_tbl  => p_distributions.partial_funded_flag,
5670                                                       p_funded_value_tbl         => p_distributions.funded_value,
5671                                                       p_style_id_tbl             => p_distributions.style_id,
5672 						      p_po_encumberance_flag     => l_po_encumbrance_flag,
5673                                                       x_results                  => x_results,
5674                                                       x_result_type              => l_result_type);
5675     ---------------------------------------------------------------
5676     -- GA Org Assignment Validations
5677     ---------------------------------------------------------------
5678 
5679     WHEN c_assign_purch_org_not_null THEN
5680       PO_VAL_GA_ORG_ASSIGNMENTS.purchasing_org_id_not_null(
5681         p_org_assignment_id_tbl => p_ga_org_assignments.org_assignment_id
5682       , p_purchasing_org_id_tbl => p_ga_org_assignments.purchasing_org_id
5683       , x_results => x_results
5684       , x_result_type => l_result_type
5685       );
5686 
5687     WHEN c_assign_vendor_site_not_null THEN
5688       PO_VAL_GA_ORG_ASSIGNMENTS.vendor_site_id_not_null(
5689         p_org_assignment_id_tbl => p_ga_org_assignments.org_assignment_id
5690       , p_vendor_site_id_tbl => p_ga_org_assignments.vendor_site_id
5691       , x_results => x_results
5692       , x_result_type => l_result_type
5693       );
5694 
5695 
5696     ---------------------------------------------------------------
5697     -- Notification Control Validations
5698     ---------------------------------------------------------------
5699 
5700     WHEN c_notif_start_date_le_end_date THEN
5701       PO_VAL_NOTIFICATION_CONTROLS.start_date_le_end_date(
5702         p_notification_id_tbl => p_notification_controls.notification_id
5703       , p_start_date_active_tbl => p_notification_controls.start_date_active
5704       , p_end_date_active_tbl => p_notification_controls.end_date_active
5705       , x_results => x_results
5706       , x_result_type => l_result_type
5707       );
5708 
5709     WHEN c_notif_percent_le_one_hundred THEN
5710       PO_VAL_NOTIFICATION_CONTROLS.percent_le_one_hundred(
5711         p_notification_id_tbl => p_notification_controls.notification_id
5712       , p_notif_qty_percentage_tbl => p_notification_controls.notification_qty_percentage
5713       , x_results => x_results
5714       , x_result_type => l_result_type
5715       );
5716 
5717     WHEN c_notif_amount_gt_zero THEN
5718       PO_VAL_NOTIFICATION_CONTROLS.amount_gt_zero(
5719         p_notification_id_tbl => p_notification_controls.notification_id
5720       , p_notification_amount_tbl => p_notification_controls.notification_amount
5721       , x_results => x_results
5722       , x_result_type => l_result_type
5723       );
5724 
5725     WHEN c_notif_amount_not_null THEN
5726       PO_VAL_NOTIFICATION_CONTROLS.amount_not_null(
5727         p_notif_id_tbl => p_notification_controls.notification_id
5728       , p_notif_amount_tbl => p_notification_controls.notification_amount
5729       , p_notif_condition_code_tbl => p_notification_controls.notification_condition_code
5730       , x_results => x_results
5731       , x_result_type => l_result_type
5732       );
5733 
5734     WHEN c_notif_start_date_not_null THEN
5735       PO_VAL_NOTIFICATION_CONTROLS.start_date_active_not_null(
5736         p_notif_id_tbl => p_notification_controls.notification_id
5737       , p_start_date_active_tbl => p_notification_controls.start_date_active
5738       , p_notif_condition_code_tbl => p_notification_controls.notification_condition_code
5739       , x_results => x_results
5740       , x_result_type => l_result_type
5741       );
5742 
5743 
5744     ---------------------------------------------------------------
5745     -- Price Differential Validations
5746     ---------------------------------------------------------------
5747 
5748     WHEN c_unique_price_diff_num THEN
5749       PO_VAL_PRICE_DIFFS.unique_price_diff_num(
5750         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5751       , p_entity_id_tbl => p_price_differentials.entity_id
5752       , p_entity_type_tbl => p_price_differentials.entity_type
5753       , p_price_differential_num_tbl => p_price_differentials.price_differential_num
5754       , x_result_set_id => l_result_set_id
5755       , x_result_type => l_result_type
5756       );
5757 
5758     WHEN c_price_diff_num_gt_zero THEN
5759       PO_VAL_PRICE_DIFFS.price_diff_num_gt_zero(
5760         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5761       , p_price_differential_num_tbl => p_price_differentials.price_differential_num
5762       , x_results => x_results
5763       , x_result_type => l_result_type
5764       );
5765 
5766     WHEN c_unique_price_type THEN
5767       PO_VAL_PRICE_DIFFS.unique_price_type(
5768         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5769       , p_entity_id_tbl => p_price_differentials.entity_id
5770       , p_entity_type_tbl => p_price_differentials.entity_type
5771       , p_price_type_tbl => p_price_differentials.price_type
5772       , x_result_set_id => l_result_set_id
5773       , x_result_type => l_result_type
5774       );
5775 
5776     WHEN c_max_mul_ge_zero THEN
5777       PO_VAL_PRICE_DIFFS.max_mul_ge_zero(
5778         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5779       , p_max_multiplier_tbl => p_price_differentials.max_multiplier
5780       , x_results => x_results
5781       , x_result_type => l_result_type
5782       );
5783 
5784     WHEN c_max_mul_ge_min_mul THEN
5785       PO_VAL_PRICE_DIFFS.max_mul_ge_min_mul(
5786         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5787       , p_min_multiplier_tbl => p_price_differentials.min_multiplier
5788       , p_max_multiplier_tbl => p_price_differentials.max_multiplier
5789       , x_results => x_results
5790       , x_result_type => l_result_type
5791       );
5792 
5793     WHEN c_min_mul_ge_zero THEN
5794       PO_VAL_PRICE_DIFFS.min_mul_ge_zero(
5795         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5796       , p_min_multiplier_tbl => p_price_differentials.min_multiplier
5797       , x_results => x_results
5798       , x_result_type => l_result_type
5799       );
5800 
5801     WHEN c_mul_ge_zero THEN
5802       PO_VAL_PRICE_DIFFS.mul_ge_zero(
5803         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5804       , p_multiplier_tbl => p_price_differentials.multiplier
5805       , x_results => x_results
5806       , x_result_type => l_result_type
5807       );
5808 
5809     WHEN c_spo_price_type_on_src_doc THEN
5810       PO_VAL_PRICE_DIFFS.spo_price_type_on_src_doc(
5811         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5812       , p_entity_type_tbl => p_price_differentials.entity_type
5813       , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
5814       , p_from_line_id_tbl => p_price_differentials.line_from_line_id
5815       , p_price_type_tbl => p_price_differentials.price_type
5816       , x_result_set_id => l_result_set_id
5817       , x_result_type => l_result_type
5818       );
5819 
5820     WHEN c_spo_mul_btwn_min_max THEN
5821       PO_VAL_PRICE_DIFFS.spo_mul_btwn_min_max(
5822         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5823       , p_entity_type_tbl => p_price_differentials.entity_type
5824       , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
5825       , p_from_line_id_tbl => p_price_differentials.line_from_line_id
5826       , p_multiplier_tbl => p_price_differentials.multiplier
5827       , p_price_type_tbl => p_price_differentials.price_type  --Bug 5415284
5828       , x_result_set_id => l_result_set_id
5829       , x_result_type => l_result_type
5830       );
5831 
5832     WHEN c_spo_mul_ge_min THEN
5833       PO_VAL_PRICE_DIFFS.spo_mul_ge_min(
5834         p_price_differential_id_tbl => p_price_differentials.price_differential_id
5835       , p_entity_type_tbl => p_price_differentials.entity_type
5836       , p_from_line_location_id_tbl => p_price_differentials.line_from_line_location_id
5837       , p_from_line_id_tbl => p_price_differentials.line_from_line_id
5838       , p_multiplier_tbl => p_price_differentials.multiplier
5839       , p_price_type_tbl => p_price_differentials.price_type  --Bug 5415284
5840       , x_result_set_id => l_result_set_id
5841       , x_result_type => l_result_type
5842       );
5843 
5844           --------------------------------------------------------------------------
5845           -- Price Differentials Validation Subroutines
5846           --------------------------------------------------------------------------
5847           WHEN c_price_type THEN
5848             PO_VAL_PRICE_DIFFS2.price_type(p_id_tbl             => p_price_differentials.interface_id,
5849                                            p_price_type_tbl     => p_price_differentials.price_type,
5850                                            x_result_set_id      => l_result_set_id,
5851                                            x_result_type        => l_result_type);
5852           WHEN c_multiple_price_diff THEN
5853             PO_VAL_PRICE_DIFFS2.multiple_price_diff(p_id_tbl              => p_price_differentials.interface_id,
5854                                                     p_price_type_tbl      => p_price_differentials.price_type,
5855                                                     p_entity_type_tbl     => p_price_differentials.entity_type,
5856                                                     p_entity_id_tbl       => p_price_differentials.entity_id,
5857                                                     x_result_set_id       => l_result_set_id,
5858                                                     x_result_type         => l_result_type);
5859           WHEN c_entity_type THEN
5860             PO_VAL_PRICE_DIFFS2.entity_type(p_id_tbl              => p_price_differentials.interface_id,
5861                                             p_entity_type_tbl     => p_price_differentials.entity_type,
5862                                             p_doc_type            => l_doc_type,
5863                                             x_results             => x_results,
5864                                             x_result_type         => l_result_type);
5865           WHEN c_multiplier THEN
5866             PO_VAL_PRICE_DIFFS2.multiplier(p_id_tbl              => p_price_differentials.interface_id,
5867                                            p_entity_type_tbl     => p_price_differentials.entity_type,
5868                                            p_multiplier_tbl      => p_price_differentials.multiplier,
5869                                            x_results             => x_results,
5870                                            x_result_type         => l_result_type);
5871           WHEN c_min_multiplier THEN
5872             PO_VAL_PRICE_DIFFS2.min_multiplier(p_id_tbl                 => p_price_differentials.interface_id,
5873                                                p_entity_type_tbl        => p_price_differentials.entity_type,
5874                                                p_min_multiplier_tbl     => p_price_differentials.min_multiplier,
5875                                                x_results                => x_results,
5876                                                x_result_type            => l_result_type);
5877           WHEN c_max_multiplier THEN
5878             PO_VAL_PRICE_DIFFS2.max_multiplier(p_id_tbl                 => p_price_differentials.interface_id,
5879                                                p_entity_type_tbl        => p_price_differentials.entity_type,
5880                                                p_max_multiplier_tbl     => p_price_differentials.max_multiplier,
5881                                                x_results                => x_results,
5882                                                x_result_type            => l_result_type);
5883           WHEN c_price_diff_style_info THEN
5884             PO_VAL_PRICE_DIFFS2.style_related_info(p_id_tbl          => p_price_differentials.interface_id,
5885                                                    p_style_id_tbl    => p_price_differentials.hdr_style_id,
5886                                                    x_result_set_id   => l_result_set_id,
5887                                                    x_result_type     => l_result_type);
5888 
5889 
5890 
5891     ---------------------------------------------------------------
5892     -- Price Update Allowed Validations
5893     ---------------------------------------------------------------
5894 
5895     WHEN c_no_dists_reserved THEN
5896       PO_PRICE_HELPER.no_dists_reserved(
5897         p_line_id_tbl => p_lines.po_line_id
5898       , p_amt_changed_flag_tbl => p_lines.amount_changed_flag --<Bug 13503748 :Encumbrance ER>--
5899       , x_result_set_id => l_result_set_id
5900       , x_result_type => l_result_type
5901       );
5902 
5903     WHEN c_accruals_allow_update THEN
5904       PO_PRICE_HELPER.accruals_allow_update(
5905         p_line_id_tbl => p_lines.po_line_id
5906       , x_results => x_results
5907       , x_result_type => l_result_type
5908       );
5909 
5910     WHEN c_no_timecards_exist THEN
5911       PO_PRICE_HELPER.no_timecards_exist(
5912         p_line_id_tbl => p_lines.po_line_id
5913       , x_results => x_results
5914       , x_result_type => l_result_type
5915       );
5916 
5917     WHEN c_no_pending_receipts THEN
5918       PO_PRICE_HELPER.no_pending_receipts(
5919         p_line_id_tbl => p_lines.po_line_id
5920       , x_result_set_id => l_result_set_id
5921       , x_result_type => l_result_type
5922       );
5923 
5924     WHEN c_retro_account_allows_update THEN
5925       PO_PRICE_HELPER.retro_account_allows_update(
5926         p_line_id_tbl => p_lines.po_line_id
5927       , p_price_break_lookup_code_tbl => p_lines.price_break_lookup_code
5928       , x_results => x_results
5929       , x_result_type => l_result_type
5930       );
5931 
5932     WHEN c_warn_amt_based_notif_ctrls THEN
5933       PO_PRICE_HELPER.warn_amt_based_notif_ctrls(
5934         p_line_id_tbl => p_lines.po_line_id
5935       , x_result_set_id => l_result_set_id
5936       , x_result_type => l_result_type
5937       );
5938 
5939     --Enhanced Pricing Start:
5940     ---------------------------------------------------------------
5941     -- Price Adjustments Validations
5942     ---------------------------------------------------------------
5943     --When price adjustment line is updated, change reason code should not be NULL
5944     WHEN c_change_reason_code_not_null THEN
5945       PO_VAL_PRICE_ADJS.ovr_chng_reas_code_not_null(
5946         p_price_adj_id_tbl => p_price_adjustments.price_adjustment_id
5947       , p_updated_flag_tbl => p_price_adjustments.updated_flag
5948       , p_change_reason_code_tbl => p_price_adjustments.change_reason_code
5949       , x_results => x_results
5950       , x_result_type => l_result_type
5951       );
5952 
5953     --When price adjustment line is updated, change reason text should not be NULL
5954     WHEN c_change_reason_text_not_null THEN
5955       PO_VAL_PRICE_ADJS.ovr_chng_reas_text_not_null(
5956         p_price_adj_id_tbl => p_price_adjustments.price_adjustment_id
5957       , p_updated_flag_tbl => p_price_adjustments.updated_flag
5958       , p_change_reason_text_tbl => p_price_adjustments.change_reason_text
5959       , x_results => x_results
5960       , x_result_type => l_result_type
5961       );
5962     --Enhanced Pricing End:
5963 --UCA Project - CLMR4 Changes Begin
5964    WHEN c_undef_amt_gt_zero THEN
5965       PO_VALIDATION_HELPER.greater_or_equal_zero(p_calling_module     => p_calling_program,
5966            p_null_allowed_flag  => PO_CORE_S.g_parameter_YES,
5967            p_value_tbl          => p_po_line_ucas.UNDEF_AMOUNT,
5968            p_entity_id_tbl      => p_po_line_ucas.PO_LINE_UCA_ID,
5969            p_entity_type        => c_entity_type_LINE_UCAS,
5970            p_column_name        => 'UNDEF_AMOUNT',
5971            p_message_name       => PO_MESSAGE_S.PO_ALL_ENTER_VALUE_GE_ZERO,
5972            p_validation_id      => PO_VAL_CONSTANTS.c_undef_amt_gt_zero,
5973            x_results            => x_results,
5974            x_result_type        => l_result_type);
5975 
5976    WHEN c_lgl_gt_zero THEN
5977       PO_VALIDATION_HELPER.greater_or_equal_zero(p_calling_module     => p_calling_program,
5978            p_null_allowed_flag  => PO_CORE_S.g_parameter_YES,
5979            p_value_tbl          => p_po_line_ucas.LIMIT_GOV_LIABILITY_AMT,
5980            p_entity_id_tbl      => p_po_line_ucas.PO_LINE_UCA_ID,
5981            p_entity_type        => c_entity_type_LINE_UCAS,
5982            p_column_name        => 'LIMIT_GOV_LIABILITY_AMT',
5983            p_message_name       => PO_MESSAGE_S.PO_ALL_ENTER_VALUE_GE_ZERO,
5984            p_validation_id      => PO_VAL_CONSTANTS.c_lgl_gt_zero,
5985            x_results            => x_results,
5986            x_result_type        => l_result_type);
5987 
5988    WHEN c_nte_gt_zero THEN
5989       PO_VALIDATION_HELPER.greater_or_equal_zero(p_calling_module     => p_calling_program,
5990            p_null_allowed_flag  => PO_CORE_S.g_parameter_YES,
5991            p_value_tbl          => p_po_line_ucas.NOT_TO_EXCEED_AMOUNT,
5992            p_entity_id_tbl      => p_po_line_ucas.PO_LINE_UCA_ID,
5993            p_entity_type        => c_entity_type_LINE_UCAS,
5994            p_column_name        => 'NOT_TO_EXCEED_AMOUNT',
5995            p_message_name       => PO_MESSAGE_S.PO_ALL_ENTER_VALUE_GE_ZERO,
5996            p_validation_id      => PO_VAL_CONSTANTS.c_nte_gt_zero,
5997            x_results            => x_results,
5998            x_result_type        => l_result_type);
5999   WHEN c_lgl_le_nte THEN
6000        PO_VALIDATION_HELPER.num1_less_or_equal_num2(
6001           p_calling_module => p_calling_program
6002           , p_num1_tbl => p_po_line_ucas.LIMIT_GOV_LIABILITY_AMT
6003           , p_num2_tbl => p_po_line_ucas.NOT_TO_EXCEED_AMOUNT
6004           , p_entity_id_tbl => p_po_line_ucas.PO_LINE_UCA_ID
6005           , p_entity_type => c_entity_type_LINE_UCAS
6006           , p_column_name => 'LIMIT_GOV_LIABILITY_AMT'
6007           , p_message_name => PO_MESSAGE_S.PO_UCA_LGL_LE_NTE
6008           , x_results => x_results
6009           , x_result_type => l_result_type);
6010   WHEN c_undef_amt_le_nte THEN
6011        PO_VALIDATION_HELPER.num1_less_or_equal_num2(
6012           p_calling_module => p_calling_program
6013           , p_num1_tbl => p_po_line_ucas.UNDEF_AMOUNT
6014           , p_num2_tbl => p_po_line_ucas.NOT_TO_EXCEED_AMOUNT
6015           , p_entity_id_tbl => p_po_line_ucas.PO_LINE_UCA_ID
6016           , p_entity_type => c_entity_type_LINE_UCAS
6017           , p_column_name => 'UNDEF_AMOUNT'
6018           , p_message_name => PO_MESSAGE_S.PO_UCA_UNDEF_LE_NTE
6019           , x_results => x_results
6020           , x_result_type => l_result_type);
6021   WHEN c_undef_amt_le_line_amt THEN
6022        -- bug 16461105
6023        PO_VAL_LINES.validate_undef_amt_le_line_amt(
6024          p_po_line_id             => p_lines.po_line_id ,
6025          p_order_type_lookup_code => p_lines.order_type_lookup_code,
6026          p_unit_price             => p_lines.unit_price,
6027          p_quantity               => p_lines.quantity,
6028          p_old_quantity           => p_lines.old_quantity,
6029          p_old_unit_price         => p_lines.old_unit_price,
6030          p_draft_id               => p_lines.draft_id,
6031          p_undef_amount           => p_po_line_ucas.undef_amount,
6032          p_po_line_uca_id         => p_po_line_ucas.po_line_uca_id,
6033          p_ucas_po_line_id        => p_po_line_ucas.po_line_id,
6034          x_results                => x_results,
6035          x_result_type            => l_result_type);
6036     -- bug 16461105
6037     --Bug 16385613 End
6038 
6039 
6040 --UCA Project - CLMR4 Changes End
6041     -- CLM Phase 4 - Elins project
6042     WHEN c_validate_exhibit_name THEN
6043 
6044         PO_VAL_LINES.validate_exhibit_name(
6045         p_header_id_tbl => p_lines.po_header_id,
6046         p_draft_id_tbl => p_lines.draft_id,
6047         p_line_id_tbl => p_lines.po_line_id,
6048         p_exhibit_name_tbl => p_lines.clm_exhibit_name,
6049         x_result_set_id => l_result_set_id,
6050         x_result_type => l_result_type
6051       );
6052 
6053     ELSE
6054       IF PO_LOG.d_exc THEN
6055         PO_LOG.exc(d_mod,d_position,'Invalid identifier in validation set: '||l_val);
6056       END IF;
6057       RAISE CASE_NOT_FOUND;
6058 
6059     END CASE;
6060 
6061   EXCEPTION
6062   WHEN OTHERS THEN
6063     IF PO_LOG.d_exc THEN
6064       PO_LOG.exc(d_mod,d_position,
6065         'Validation subroutine '||l_val||' threw exception');
6066     END IF;
6067 
6068     l_result_type := c_result_type_FATAL;
6069 
6070     x_results.add_result(
6071       p_result_type => c_result_type_FATAL
6072     , p_entity_type => NULL
6073     , p_entity_id => NULL
6074     , p_column_name => NULL
6075     , p_message_name => PO_MESSAGE_S.PO_ALL_SQL_ERROR
6076     , p_token1_name => PO_MESSAGE_S.c_ROUTINE_token
6077     , p_token1_value => d_mod
6078     , p_token2_name => PO_MESSAGE_S.c_ERR_NUMBER_token
6079     , p_token2_value => TO_CHAR(d_position)
6080     , p_token3_name => PO_MESSAGE_S.c_SQL_ERR_token
6081     , p_token3_value => l_val
6082     , p_token4_name => PO_MESSAGE_S.c_LSQL_ERR_token
6083     , p_token4_value => SQLERRM
6084     );
6085 
6086   END;
6087 
6088   d_position := 200;
6089   IF d_stmt THEN
6090     PO_LOG.stmt(d_mod,d_position,'l_result_type',l_result_type);
6091     PO_LOG.stmt(d_mod,d_position,'l_result_set_id',l_result_set_id);
6092   END IF;
6093 
6094   -- Fix the result set id.
6095   IF (l_result_set_id <> x_result_set_id) THEN
6096     d_position := 210;
6097     replace_result_set_id(
6098       p_old_result_set_id  => l_result_set_id
6099     , p_new_result_set_id  => x_result_set_id
6100     );
6101   END IF;
6102 
6103   d_position := 300;
6104 
6105   -- Update the result type if the new result takes priority
6106   -- over the old rank.
6107 
6108   l_new_rank := result_type_rank(l_result_type);
6109 
6110   IF (l_new_rank < l_result_rank) THEN
6111     d_position := 310;
6112 
6113     x_result_type := l_result_type;
6114     l_result_rank := l_new_rank;
6115 
6116     IF d_stmt THEN
6117       PO_LOG.stmt(d_mod,d_position,'x_result_type',x_result_type);
6118       PO_LOG.stmt(d_mod,d_position,'l_result_rank',l_result_rank);
6119     END IF;
6120 
6121     -- If the validation has encountered a serious problem
6122     -- or the stopping result, stop processing.
6123     IF (l_result_rank <= g_result_type_rank_FATAL
6124         OR l_result_rank <= l_stop_rank
6125         )
6126     THEN
6127       d_position := 400;
6128       IF d_stmt THEN
6129         PO_LOG.stmt(d_mod,d_position,'Stopping loop.  x_result_type',x_result_type);
6130       END IF;
6131 
6132       EXIT;
6133     END IF;
6134 
6135   END IF;
6136 
6137 END LOOP;
6138 
6139 d_position := 500;
6140 
6141 -- Commit the result set autonomously.
6142 
6143 IF (p_autocommit_results_flag = c_parameter_YES) THEN
6144   d_position := 600;
6145   commit_result_set(p_result_set_id => x_result_set_id);
6146 END IF;
6147 
6148 IF PO_LOG.d_proc THEN
6149   PO_LOG.proc_end(d_mod,'x_result_set_id',x_result_set_id);
6150   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6151 END IF;
6152 
6153 EXCEPTION
6154 WHEN OTHERS THEN
6155   IF PO_LOG.d_exc THEN
6156     PO_LOG.exc(d_mod,d_position,NULL);
6157     PO_LOG.proc_end(d_mod,'x_result_set_id',x_result_set_id);
6158     PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6159   END IF;
6160   RAISE;
6161 
6162 END validate_set;
6163 
6164 
6165 ----------------------------------------------------------------------------
6166 --Pre-reqs: None.
6167 --Modifies:
6168 --  PO_VALIDATION_RESULTS
6169 --Locks: None.
6170 --Function:
6171 --  See the description for validate_set above.
6172 --  This procedure performs the validations as above.
6173 --  Additionally, it removes the data from PO_VALIDATION_RESULTS
6174 --  and extracts it into the output parameter.
6175 --Parameters:
6176 --OUT:
6177 --x_results
6178 --  The results of the validation cycle.
6179 ----------------------------------------------------------------------------
6180 PROCEDURE validate_set(
6181   p_validation_set        IN PO_TBL_VARCHAR2000
6182 , p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL
6183 , p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL
6184 , p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
6185 , p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
6186 , p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
6187 , p_ga_org_assignments    IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
6188 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
6189 , p_price_adjustments     IN PO_PRICE_ADJS_VAL_TYPE DEFAULT NULL --Enhanced Pricing
6190 , p_po_line_ucas          IN PO_LINE_UCAS_VAL_TYPE DEFAULT NULL --UCA Project
6191 , p_calling_program       IN VARCHAR2 DEFAULT NULL
6192 , p_stopping_result_type  IN VARCHAR2 DEFAULT NULL
6193 , p_parameter_name_tbl    IN PO_TBL_VARCHAR2000 DEFAULT NULL
6194 , p_parameter_value_tbl   IN PO_TBL_VARCHAR2000 DEFAULT NULL
6195 , x_result_type           IN OUT NOCOPY VARCHAR2
6196 , x_results               OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6197 )
6198 IS
6199 d_mod CONSTANT VARCHAR2(100) := D_validate_set;
6200 d_position NUMBER := 0;
6201 l_result_set_id NUMBER;
6202 l_table_results PO_VALIDATION_RESULTS_TYPE;
6203 BEGIN
6204 
6205 IF PO_LOG.d_proc THEN
6206   PO_LOG.proc_begin(d_mod);
6207 END IF;
6208 
6209 d_position := 100;
6210 
6211 SAVEPOINT PO_VALIDATIONS_VALIDATE_SET_SP;
6212 
6213 validate_set(
6214   p_validation_set => p_validation_set
6215 , p_headers => p_headers
6216 , p_lines => p_lines
6217 , p_line_locations => p_line_locations
6218 , p_distributions => p_distributions
6219 , p_price_differentials => p_price_differentials
6220 , p_ga_org_assignments => p_ga_org_assignments
6221 , p_notification_controls => p_notification_controls
6222 , p_price_adjustments => p_price_adjustments --Enhanced Pricing
6223 , p_po_line_ucas => p_po_line_ucas
6224 , p_autocommit_results_flag => c_parameter_NO
6225 , p_calling_program => p_calling_program
6226 , p_stopping_result_type => p_stopping_result_type
6227 , p_parameter_name_tbl => p_parameter_name_tbl
6228 , p_parameter_value_tbl => p_parameter_value_tbl
6229 , x_result_type => x_result_type
6230 , x_result_set_id => l_result_set_id
6231 , x_results => x_results
6232 );
6233 
6234 d_position := 200;
6235 
6236 l_table_results :=
6237   PO_VALIDATION_RESULTS_TYPE.get_result_set_from_gt(
6238     p_result_set_id => l_result_set_id
6239   );
6240 
6241 d_position := 300;
6242 
6243 ROLLBACK TO SAVEPOINT PO_VALIDATIONS_VALIDATE_SET_SP;
6244 
6245 d_position := 400;
6246 
6247 x_results.append( p_results => l_table_results );
6248 
6249 d_position := 500;
6250 
6251 IF PO_LOG.d_proc THEN
6252   PO_LOG.proc_end(d_mod,'l_result_set_id',l_result_set_id);
6253   PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
6254 END IF;
6255 
6256 EXCEPTION
6257 WHEN OTHERS THEN
6258   IF PO_LOG.d_exc THEN
6259     PO_LOG.exc(d_mod,d_position,NULL);
6260     PO_LOG.proc_end(d_mod,'l_result_set_id',l_result_set_id);
6261     PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6262   END IF;
6263   RAISE;
6264 
6265 END validate_set;
6266 
6267 
6268 -------------------------------------------------------------------------------
6269 --Start of Comments
6270 --Pre-reqs: None.
6271 --Modifies: None.
6272 --Locks: None.
6273 --Function:
6274 --  Ranks the result types in ascending order from
6275 --  most severe error (FATAL) to least severe (SUCCESS).
6276 --Parameters:
6277 --IN:
6278 --p_result_type
6279 --  The result type whose value should be ranked.
6280 --Returns:
6281 --  The rank of the result type.
6282 --  If the input result type cannot be ranked (or is NULL),
6283 --  -1 is returned.
6284 --End of Comments
6285 -------------------------------------------------------------------------------
6286 FUNCTION result_type_rank(p_result_type IN VARCHAR2)
6287 RETURN NUMBER
6288 IS
6289 d_mod CONSTANT VARCHAR2(100) := D_result_type_rank;
6290 l_rank NUMBER;
6291 BEGIN
6292 
6293 IF PO_LOG.d_proc THEN
6294   PO_LOG.proc_begin(d_mod,'p_result_type',p_result_type);
6295 END IF;
6296 
6297 FOR i IN 1 .. c_result_type_rank_tbl.COUNT LOOP
6298   IF (c_result_type_rank_tbl(i) = p_result_type) THEN
6299     l_rank := i;
6300     EXIT;
6301   END IF;
6302 END LOOP;
6303 
6304 IF (l_rank IS NULL) THEN
6305   l_rank := -1;
6306 END IF;
6307 
6308 IF PO_LOG.d_proc THEN
6309   PO_LOG.proc_return(d_mod,l_rank);
6310 END IF;
6311 
6312 RETURN l_rank;
6313 
6314 END result_type_rank;
6315 
6316 
6317 -------------------------------------------------------------------------------
6318 --Start of Comments
6319 --Pre-reqs: None.
6320 --Modifies: PO_VALIDATION_RESULTS, sequences.
6321 --Locks: None.
6322 --Function:
6323 --  Determines whether or not the unit price of a line is allowed
6324 --  to be updated based on external data.
6325 --Parameters:
6326 --IN:
6327 --p_line_id_tbl
6328 --  Identifies the lines to be validated.
6329 --p_draft_id_tbl
6330 --  Further identifies the lines, used in result messages.
6331 --p_stopping_result_type
6332 --  Indicates that if this result type is encountered,
6333 --  processing should stop and return.
6334 --  Use one of the c_result_type_XXX variables.
6335 --  For no stopping, use NULL.
6336 --OUT:
6337 --x_result_set_id
6338 --  Identifier for the output results in PO_VALIDATION_RESULTS.
6339 --x_result_type
6340 --  Provides a summary of the validation results.
6341 --  VARCHAR2(30)
6342 --End of Comments
6343 -------------------------------------------------------------------------------
6344 PROCEDURE validate_unit_price_change(
6345   p_line_id_tbl   IN PO_TBL_NUMBER
6346 , p_price_break_lookup_code_tbl IN PO_TBL_VARCHAR30
6347  -- <Bug 13503748 : Encumbrance ER : Parameter p_amount_changed_flag_tbl
6348  -- identify if the amount on the distributions of the line has been changed
6349 , p_amount_changed_flag_tbl  IN PO_TBL_VARCHAR1
6350 , p_stopping_result_type IN VARCHAR2 DEFAULT NULL
6351 , x_result_type   OUT NOCOPY VARCHAR2
6352 , x_result_set_id IN OUT NOCOPY NUMBER
6353 , x_results       IN OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6354 )
6355 IS
6356 d_mod CONSTANT VARCHAR2(100) := D_validate_unit_price_change;
6357 l_lines PO_LINES_VAL_TYPE;
6358 BEGIN
6359 
6360 IF PO_LOG.d_proc THEN
6361   PO_LOG.proc_begin(d_mod,'p_line_id_tbl',p_line_id_tbl);
6362   PO_LOG.proc_begin(d_mod,'p_amount_changed_flag_tbl',p_amount_changed_flag_tbl);--<Bug 13503748 :Encumbrance ER>--
6363   PO_LOG.proc_begin(d_mod,'p_stopping_result_type',p_stopping_result_type);
6364 END IF;
6365 
6366 l_lines := PO_LINES_VAL_TYPE();
6367 l_lines.po_line_id := p_line_id_tbl;
6368 l_lines.price_break_lookup_code := p_price_break_lookup_code_tbl;
6369 l_lines.amount_changed_flag := p_amount_changed_flag_tbl;--<Bug 13503748 :Encumbrance ER>--
6370 
6371 validate_set(
6372   p_validation_set => c_allow_unit_price_change_vs
6373 , p_lines => l_lines
6374 , p_autocommit_results_flag => c_parameter_NO
6375 , p_stopping_result_type => p_stopping_result_type
6376 , x_result_type => x_result_type
6377 , x_result_set_id => x_result_set_id
6378 , x_results => x_results
6379 );
6380 
6381 IF PO_LOG.d_proc THEN
6382   PO_LOG.stmt(d_mod,0,'x_result_set_id',x_result_set_id);
6383   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6384 END IF;
6385 
6386 EXCEPTION
6387 WHEN OTHERS THEN
6388   IF PO_LOG.d_exc THEN
6389     PO_LOG.exc(d_mod,0,NULL);
6390   END IF;
6391   RAISE;
6392 
6393 END validate_unit_price_change;
6394 
6395 
6396 
6397 
6398 -------------------------------------------------------------------------------
6399 --Start of Comments
6400 --Pre-reqs: None.
6401 --Modifies: PO_VALIDATION_RESULTS sequences.
6402 --Locks: None.
6403 --Function:
6404 --  Performs the necessary validations for OA flows on the entities provided.
6405 --  The results are removed from the table, as they are collected into the
6406 --  output object.
6407 --Parameters:
6408 --IN:
6409 --p_headers
6410 --p_lines
6411 --p_line_locations
6412 --p_distributions
6413 --p_price_differentials
6414 --  The data that needs to be validated.
6415 --  Pass NULL if nothing of a particular entity type needs to be validated.
6416 --OUT:
6417 --x_result_type
6418 --  Provides a summary of the validation results.
6419 --  VARCHAR2(30)
6420 --x_results
6421 --  The results of the validations.
6422 --End of Comments
6423 -------------------------------------------------------------------------------
6424 PROCEDURE validate_html_order(
6425   p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL
6426 , p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL
6427 , p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
6428 , p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
6429 , p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
6430 , p_price_adjustments     IN PO_PRICE_ADJS_VAL_TYPE DEFAULT NULL --Enhanced Pricing
6431 , p_po_line_ucas          IN PO_LINE_UCAS_VAL_TYPE DEFAULT NULL --UCA Project
6432 , x_result_type           OUT NOCOPY VARCHAR2
6433 , x_results               OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6434 )
6435 IS
6436 d_mod CONSTANT VARCHAR2(100) := D_validate_html_order;
6437 d_position NUMBER := 0;
6438 l_validation_set PO_TBL_VARCHAR2000;
6439 BEGIN
6440 
6441 IF PO_LOG.d_proc THEN
6442   PO_LOG.proc_begin(d_mod);
6443 END IF;
6444 
6445 d_position := 1;
6446 
6447 l_validation_set := PO_TBL_VARCHAR2000();
6448 
6449 IF (p_headers IS NOT NULL) THEN
6450   d_position := 10;
6451   l_validation_set :=
6452     l_validation_set MULTISET UNION DISTINCT c_html_order_header_vs;
6453 END IF;
6454 
6455 IF (p_lines IS NOT NULL) THEN
6456   d_position := 20;
6457   l_validation_set :=
6458     l_validation_set MULTISET UNION DISTINCT c_html_order_line_vs;
6459 END IF;
6460 
6461 IF (p_line_locations IS NOT NULL) THEN
6462   d_position := 30;
6463   l_validation_set :=
6464     l_validation_set MULTISET UNION DISTINCT c_html_order_shipment_vs;
6465 END IF;
6466 
6467 IF (p_distributions IS NOT NULL) THEN
6468   d_position := 40;
6469   l_validation_set :=
6470     l_validation_set MULTISET UNION DISTINCT c_html_order_distribution_vs;
6471 END IF;
6472 
6473 IF (p_price_differentials IS NOT NULL) THEN
6474   d_position := 50;
6475   l_validation_set :=
6476     l_validation_set MULTISET UNION DISTINCT c_html_order_price_diff_vs;
6477 END IF;
6478 
6479 --Enhanced Pricing Start:
6480 IF (p_price_adjustments IS NOT NULL) THEN
6481   d_position := 60;
6482   l_validation_set :=
6483     l_validation_set MULTISET UNION DISTINCT c_html_price_adjustments_vs;
6484 END IF;
6485 --Enhanced Pricing End:
6486 --UCA Project - CLMR4 Changes Begin
6487 IF (p_po_line_ucas IS NOT NULL) THEN
6488   d_position := 70;
6489   l_validation_set :=
6490     l_validation_set MULTISET UNION DISTINCT c_html_order_line_ucas_vs;
6491 END IF;
6492 --UCA Project - CLMR4 Changes End
6493 
6494 IF PO_LOG.d_stmt THEN
6495   PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
6496 END IF;
6497 
6498 d_position := 100;
6499 
6500 validate_set(
6501   p_validation_set => l_validation_set
6502 , p_headers => p_headers
6503 , p_lines => p_lines
6504 , p_line_locations => p_line_locations
6505 , p_distributions => p_distributions
6506 , p_price_differentials => p_price_differentials
6507 , p_price_adjustments => p_price_adjustments  --Enhanced Pricing
6508 , p_po_line_ucas => p_po_line_ucas -- UCA Project
6509 , p_calling_program => c_program_OA
6510 , x_result_type => x_result_type
6511 , x_results => x_results
6512 );
6513 
6514 IF PO_LOG.d_proc THEN
6515   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6516   PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
6517 END IF;
6518 
6519 EXCEPTION
6520 WHEN OTHERS THEN
6521   IF PO_LOG.d_exc THEN
6522     PO_LOG.exc(d_mod,d_position,NULL);
6523   END IF;
6524   RAISE;
6525 
6526 END validate_html_order;
6527 
6528 
6529 PROCEDURE validate_html_agreement(
6530   p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL
6531 , p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL
6532 , p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
6533 , p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
6534 , p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
6535 , p_ga_org_assignments    IN PO_GA_ORG_ASSIGN_VAL_TYPE DEFAULT NULL
6536 , p_notification_controls IN PO_NOTIFICATION_CTRL_VAL_TYPE DEFAULT NULL
6537 , p_price_adjustments     IN PO_PRICE_ADJS_VAL_TYPE DEFAULT NULL --Enhanced Pricing
6538 , x_result_type           OUT NOCOPY VARCHAR2
6539 , x_results               OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6540 )
6541 IS
6542 d_mod CONSTANT VARCHAR2(100) := D_validate_html_agreement;
6543 d_position NUMBER := 0;
6544 l_validation_set PO_TBL_VARCHAR2000;
6545 BEGIN
6546 
6547 IF PO_LOG.d_proc THEN
6548   PO_LOG.proc_begin(d_mod);
6549 END IF;
6550 
6551 d_position := 1;
6552 
6553 l_validation_set := PO_TBL_VARCHAR2000();
6554 
6555 IF (p_headers IS NOT NULL) THEN
6556   d_position := 10;
6557   l_validation_set :=
6558     l_validation_set MULTISET UNION DISTINCT c_html_agmt_header_vs;
6559 END IF;
6560 
6561 IF (p_lines IS NOT NULL) THEN
6562   d_position := 20;
6563   l_validation_set :=
6564     l_validation_set MULTISET UNION DISTINCT c_html_agmt_line_vs;
6565 END IF;
6566 
6567 IF (p_line_locations IS NOT NULL) THEN
6568   d_position := 30;
6569   l_validation_set :=
6570     l_validation_set MULTISET UNION DISTINCT c_html_agmt_price_break_vs;
6571 END IF;
6572 
6573 IF (p_ga_org_assignments IS NOT NULL) THEN
6574   d_position := 40;
6575   l_validation_set :=
6576     l_validation_set MULTISET UNION DISTINCT c_html_agmt_ga_org_assign_vs;
6577 END IF;
6578 
6579 IF (p_price_differentials IS NOT NULL) THEN
6580   d_position := 50;
6581   l_validation_set :=
6582     l_validation_set MULTISET UNION DISTINCT c_html_agmt_price_diff_vs;
6583 END IF;
6584 
6585 IF (p_notification_controls IS NOT NULL) THEN
6586   d_position := 60;
6587   l_validation_set :=
6588     l_validation_set MULTISET UNION DISTINCT c_html_agmt_notif_ctrl_vs;
6589 END IF;
6590 
6591 IF (p_distributions IS NOT NULL) THEN
6592   d_position := 70;
6593   l_validation_set :=
6594     l_validation_set MULTISET UNION DISTINCT c_html_agmt_distribution_vs;
6595 END IF;
6596 
6597 --Enhanced Pricing Start:
6598 IF (p_price_adjustments IS NOT NULL) THEN
6599   d_position := 80;
6600   l_validation_set :=
6601     l_validation_set MULTISET UNION DISTINCT c_html_price_adjustments_vs;
6602 END IF;
6603 --Enhanced Pricing End:
6604 
6605 IF PO_LOG.d_stmt THEN
6606   PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
6607 END IF;
6608 
6609 d_position := 100;
6610 
6611 validate_set(
6612   p_validation_set => l_validation_set
6613 , p_headers => p_headers
6614 , p_lines => p_lines
6615 , p_line_locations => p_line_locations
6616 , p_distributions => p_distributions
6617 , p_price_differentials => p_price_differentials
6618 , p_ga_org_assignments => p_ga_org_assignments
6619 , p_notification_controls => p_notification_controls
6620 , p_price_adjustments => p_price_adjustments --Enhanced Pricing
6621 , p_calling_program => c_program_OA
6622 , x_result_type => x_result_type
6623 , x_results => x_results
6624 );
6625 
6626 IF PO_LOG.d_proc THEN
6627   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6628   PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
6629 END IF;
6630 
6631 EXCEPTION
6632 WHEN OTHERS THEN
6633   IF PO_LOG.d_exc THEN
6634     PO_LOG.exc(d_mod,d_position,NULL);
6635   END IF;
6636   RAISE;
6637 
6638 END validate_html_agreement;
6639 
6640 
6641 -------------------------------------------------------------------------------
6642 --Start of Comments
6643 --Pre-reqs: None.
6644 --Modifies: PO_VALIDATION_RESULTS sequences.
6645 --Locks: None.
6646 --Function:
6647 --  Performs the necessary validations for PDOI on the entities provided.
6648 --  The results are removed from the table, as they are collected into the
6649 --  output object.
6650 --Parameters:
6651 --IN:
6652 --p_headers
6653 --p_lines
6654 --p_line_locations
6655 --p_distributions
6656 --p_price_differentials
6657 --  The data that needs to be validated.
6658 --  Pass NULL if nothing of a particular entity type needs to be validated.
6659 --OUT:
6660 --x_result_type
6661 --  Provides a summary of the validation results.
6662 --  VARCHAR2(30)
6663 --x_results
6664 --  The results of the validations.
6665 --End of Comments
6666 -------------------------------------------------------------------------------
6667 PROCEDURE validate_pdoi(
6668    p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL,
6669    p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL,
6670    p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL,
6671    p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL,
6672    p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL,
6673    p_doc_type              IN VARCHAR2 DEFAULT NULL,
6674    p_action                IN VARCHAR2 DEFAULT 'CREATE',
6675    p_parameter_name_tbl    IN PO_TBL_VARCHAR2000 DEFAULT NULL,
6676    p_parameter_value_tbl   IN PO_TBL_VARCHAR2000 DEFAULT NULL,
6677    x_result_type           OUT NOCOPY VARCHAR2,
6678    x_results               OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6679 )
6680 IS
6681 
6682   d_mod CONSTANT VARCHAR2(100) := D_validate_pdoi;
6683   d_position NUMBER := 0;
6684   l_validation_set PO_TBL_VARCHAR2000;
6685 
6686 BEGIN
6687 
6688   IF PO_LOG.d_proc THEN
6689      po_log.proc_begin(d_mod, 'p_doc_type', p_doc_type);
6690      po_log.proc_begin(d_mod, 'p_action', p_action);
6691   END IF;
6692 
6693   d_position := 1;
6694 
6695   l_validation_set := PO_TBL_VARCHAR2000();
6696 
6697 IF (p_headers IS NOT NULL AND p_lines IS NULL AND p_line_locations IS NULL AND
6698     p_distributions IS NULL AND p_price_differentials IS NULL) THEN
6699   d_position := 10;
6700   l_validation_set :=
6701     l_validation_set MULTISET UNION DISTINCT c_pdoi_header_common_vs;
6702 
6703   CASE p_doc_type
6704     WHEN c_doc_type_blanket THEN
6705          l_validation_set :=
6706            l_validation_set MULTISET UNION DISTINCT c_pdoi_header_blanket_vs;
6707     WHEN c_doc_type_standard THEN
6708          l_validation_set :=
6709            l_validation_set MULTISET UNION DISTINCT c_pdoi_header_standard_vs;
6710     WHEN c_doc_type_quotation THEN
6711          l_validation_set :=
6712            l_validation_set MULTISET UNION DISTINCT c_pdoi_header_quotation_vs;
6713     ELSE
6714       IF PO_LOG.d_exc THEN
6715         PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
6716       END IF;
6717   END CASE;
6718   IF Nvl(PO_PDOI_PARAMS.g_request.clm_flag,'N') ='Y'
6719   THEN
6720     l_validation_set :=
6721       l_validation_set MULTISET UNION DISTINCT c_clm_pdoi_header_common_vs;
6722   END IF;
6723 
6724 ELSIF (p_lines IS NOT NULL AND p_action='CREATE' AND p_headers IS NULL AND p_line_locations IS NULL AND
6725        p_distributions IS NULL AND p_price_differentials IS NULL) THEN
6726   d_position := 20;
6727   l_validation_set :=
6728     l_validation_set MULTISET UNION DISTINCT c_pdoi_line_common_vs;
6729 
6730   CASE p_doc_type
6731     WHEN c_doc_type_blanket THEN
6732          l_validation_set :=
6733            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_blanket_vs;
6734     WHEN c_doc_type_standard THEN
6735          l_validation_set :=
6736            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_standard_vs;
6737     WHEN c_doc_type_quotation THEN
6738          l_validation_set :=
6739            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_quotation_vs;
6740     ELSE
6741       IF PO_LOG.d_exc THEN
6742         PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
6743       END IF;
6744   END CASE;
6745   IF Nvl(PO_PDOI_PARAMS.g_request.clm_flag,'N') ='Y'
6746   THEN
6747     l_validation_set :=
6748       l_validation_set MULTISET UNION DISTINCT c_clm_pdoi_line_common_vs;
6749   END IF;
6750 
6751 ELSIF (p_lines IS NOT NULL AND p_action='UPDATE' AND p_headers IS NULL AND p_line_locations IS NULL AND
6752        p_distributions IS NULL AND p_price_differentials IS NULL) THEN
6753 
6754   d_position := 20;
6755   l_validation_set :=
6756     l_validation_set MULTISET UNION DISTINCT c_pdoi_line_update_vs;
6757 
6758   CASE p_doc_type
6759     WHEN c_doc_type_blanket THEN
6760          l_validation_set :=
6761            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_blanket_update_vs;
6762     ELSE
6763       IF PO_LOG.d_exc THEN
6764         PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
6765       END IF;
6766   END CASE;
6767 
6768 ELSIF (p_line_locations IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
6769        p_distributions IS NULL AND p_price_differentials IS NULL) THEN
6770 
6771   d_position := 30;
6772   l_validation_set :=
6773     l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_common_vs;
6774 
6775   CASE p_doc_type
6776     WHEN c_doc_type_blanket THEN
6777          l_validation_set :=
6778            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_blanket_vs;
6779     WHEN c_doc_type_standard THEN
6780          l_validation_set :=
6781            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_standard_vs;
6782     WHEN c_doc_type_quotation THEN
6783          l_validation_set :=
6784            l_validation_set MULTISET UNION DISTINCT c_pdoi_line_loc_quotation_vs;
6785     ELSE
6786       IF PO_LOG.d_exc THEN
6787         PO_LOG.exc(d_mod,d_position,'Invalid doc_type in validation_pdoi: '||p_doc_type);
6788       END IF;
6789   END CASE;
6790 
6791 ELSIF (p_distributions IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
6792        p_line_locations IS NULL AND p_price_differentials IS NULL) THEN
6793 
6794   d_position := 40;
6795   l_validation_set :=
6796     l_validation_set MULTISET UNION DISTINCT c_pdoi_dist_common_vs;
6797   IF Nvl(PO_PDOI_PARAMS.g_request.clm_flag,'N') ='Y'
6798   THEN
6799     l_validation_set :=
6800       l_validation_set MULTISET UNION DISTINCT c_clm_pdoi_dist_common_vs;
6801   END IF;
6802 
6803 ELSIF(p_price_differentials IS NOT NULL AND p_headers IS NULL AND p_lines IS NULL AND
6804       p_line_locations IS NULL AND p_distributions IS NULL) THEN
6805 
6806   d_position := 50;
6807   l_validation_set :=
6808     l_validation_set MULTISET UNION DISTINCT c_pdoi_price_diff_common_vs;
6809 
6810 ELSE
6811 
6812   IF PO_LOG.d_exc THEN
6813     PO_LOG.exc(d_mod,d_position,'Call to validate_pdoi was incorrectly called.');
6814   END IF;
6815 
6816 END IF;
6817 
6818 IF PO_LOG.d_stmt THEN
6819   PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
6820 END IF;
6821 
6822 d_position := 100;
6823 
6824 validate_set(p_validation_set      => l_validation_set,
6825              p_headers             => p_headers,
6826              p_lines               => p_lines,
6827              p_line_locations      => p_line_locations,
6828              p_distributions       => p_distributions,
6829              p_price_differentials => p_price_differentials,
6830              p_calling_program     => c_program_pdoi,
6831              p_parameter_name_tbl  => p_parameter_name_tbl,
6832              p_parameter_value_tbl => p_parameter_value_tbl,
6833              x_result_type         => x_result_type,
6834              x_results             => x_results
6835 );
6836 
6837 IF PO_LOG.d_proc THEN
6838   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6839   PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
6840 END IF;
6841 
6842 EXCEPTION
6843 WHEN OTHERS THEN
6844   IF PO_LOG.d_exc THEN
6845     PO_LOG.exc(d_mod,d_position,NULL);
6846   END IF;
6847   RAISE;
6848 
6849 END validate_pdoi;
6850 
6851 -------------------------------------------------------------------------------
6852 --Start of Comments
6853 --Pre-reqs: None.
6854 --Modifies: PO_VALIDATION_RESULTS sequences.
6855 --Locks: None.
6856 --Function:
6857 --  Performs the necessary validations for Modification Merge
6858 --  on the entities provided.
6859 --Parameters:
6860 --IN:
6861 --p_headers
6862 --p_lines
6863 --p_line_locations
6864 --p_distributions
6865 --p_price_differentials
6866 --  The data that needs to be validated.
6867 --  Pass NULL if nothing of a particular entity type needs to be validated.
6868 --OUT:
6869 --x_result_type
6870 --  Provides a summary of the validation results.
6871 --  VARCHAR2(30)
6872 --x_results
6873 --  The results of the validations.
6874 --End of Comments
6875 -------------------------------------------------------------------------------
6876 PROCEDURE validate_modification_sync( --CLM Modifications project
6877   p_headers               IN PO_HEADERS_VAL_TYPE DEFAULT NULL
6878 , p_lines                 IN PO_LINES_VAL_TYPE DEFAULT NULL
6879 , p_line_locations        IN PO_LINE_LOCATIONS_VAL_TYPE DEFAULT NULL
6880 , p_distributions         IN PO_DISTRIBUTIONS_VAL_TYPE DEFAULT NULL
6881 , p_price_differentials   IN PO_PRICE_DIFF_VAL_TYPE DEFAULT NULL
6882 , p_price_adjustments     IN PO_PRICE_ADJS_VAL_TYPE DEFAULT NULL
6883 , p_doc_type              IN VARCHAR2 DEFAULT NULL
6884 , p_action                IN VARCHAR2 DEFAULT NULL
6885 , x_result_type           OUT NOCOPY VARCHAR2
6886 , x_results               OUT NOCOPY PO_VALIDATION_RESULTS_TYPE
6887 ) IS
6888 
6889 d_mod CONSTANT VARCHAR2(100) := D_validate_modification_sync;
6890 d_position NUMBER := 0;
6891 l_validation_set PO_TBL_VARCHAR2000;
6892 BEGIN
6893 
6894 IF PO_LOG.d_proc THEN
6895   PO_LOG.proc_begin(d_mod);
6896 END IF;
6897 
6898 d_position := 1;
6899 
6900 l_validation_set := PO_TBL_VARCHAR2000();
6901 
6902 IF (p_line_locations IS NOT NULL) THEN
6903   d_position := 30;
6904   l_validation_set :=
6905     l_validation_set MULTISET UNION DISTINCT c_mod_sync_shipment_vs;
6906 END IF;
6907 
6908 IF (p_distributions IS NOT NULL) THEN
6909   d_position := 40;
6910   l_validation_set :=
6911     l_validation_set MULTISET UNION DISTINCT c_mod_sync_distribution_vs;
6912 END IF;
6913 
6914 IF PO_LOG.d_stmt THEN
6915   PO_LOG.stmt(d_mod,d_position,'l_validation_set',l_validation_set);
6916 END IF;
6917 
6918 d_position := 100;
6919 
6920 validate_set(
6921   p_validation_set => l_validation_set
6922 , p_headers => p_headers
6923 , p_lines => p_lines
6924 , p_line_locations => p_line_locations
6925 , p_distributions => p_distributions
6926 , p_price_differentials => p_price_differentials
6927 , p_price_adjustments => p_price_adjustments  --Enhanced Pricing
6928 , p_calling_program => c_program_OA
6929 , x_result_type => x_result_type
6930 , x_results => x_results
6931 );
6932 
6933 IF PO_LOG.d_proc THEN
6934   PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
6935   PO_LOG.log(PO_LOG.c_PROC_END,d_mod,NULL,'x_results',x_results);
6936 END IF;
6937 
6938 EXCEPTION
6939 WHEN OTHERS THEN
6940   IF PO_LOG.d_exc THEN
6941     PO_LOG.exc(d_mod,d_position,NULL);
6942   END IF;
6943   RAISE;
6944 
6945 END validate_modification_sync;
6946 
6947 ----------------------------------------------------------------------
6948 -- Logs the result set in the results table at the statement level.
6949 ----------------------------------------------------------------------
6950 PROCEDURE log_validation_results_gt(
6951   p_module_base   IN VARCHAR2
6952 , p_position      IN NUMBER
6953 , p_result_set_id IN NUMBER
6954 )
6955 IS
6956 l_rowid_tbl PO_TBL_VARCHAR2000;
6957 BEGIN
6958 IF PO_LOG.d_stmt THEN
6959   SELECT VR.rowid
6960   BULK COLLECT INTO l_rowid_tbl
6961   FROM PO_VALIDATION_RESULTS_GT VR
6962   WHERE VR.result_set_id = p_result_set_id
6963   ;
6964   PO_LOG.stmt_table(p_module_base,p_position,'PO_VALIDATION_RESULTS_GT',l_rowid_tbl);
6965 END IF;
6966 END log_validation_results_gt;
6967 
6968  -- <Bug 13503748: Edit without unreserve ER>
6969 -- Added a function which checks whether the encumbered amount is correct or
6970 -- not before modifying a fully reserved standard PO.
6971 -------------------------------------------------------------------------------
6972 --Start of Comments
6973 --Name: check_encumbered_amount
6974 --Pre-reqs:
6975 --  data is populated in the base PO tables
6976 --Modifies:
6977 --  None.
6978 --Locks:
6979 --  None
6980 --Procedure:
6981 --  For a particular SPO and the level checks whether the
6982 --  encumbered amount is correct or not. It checks on ly for the
6983 --  completely reserved line.
6984 --Parameters:
6985 --IN:
6986 --p_po_header_id
6987 --  Header id of the document
6988 --OUT
6989 -- x_return_status
6990 --x_return_message
6991 --End of Comments
6992 -------------------------------------------------------------------------------
6993 
6994 PROCEDURE check_encumbered_amount
6995 (
6996  p_po_header_id   IN  NUMBER,
6997  x_return_status  OUT NOCOPY VARCHAR2,
6998  x_return_message OUT NOCOPY VARCHAR2
6999 ) IS
7000 
7001        d_position NUMBER := 0;
7002        d_mod CONSTANT VARCHAR2(100) := D_check_encumbered_amount;
7003        l_log_head  CONSTANT VARCHAR2(100) := D_PACKAGE_BASE || d_mod;
7004 
7005 BEGIN
7006 
7007   d_position := 100;
7008 
7009   IF PO_LOG.d_proc THEN
7010      po_log.proc_begin(d_mod, 'p_po_header_id', p_po_header_id);
7011   END IF;
7012 
7013   SELECT 'N','PO_INVALID_ENC_AMT' INTO x_return_status,x_return_message from dual
7014        WHERE EXISTS
7015        (SELECT po_distribution_id
7016        FROM po_lines_all pl,
7017             po_line_locations_all pll,
7018             po_distributions_all pod
7019        WHERE pod.line_location_id = pll.line_location_id
7020        AND pll.po_line_id = pl.po_line_id
7021        AND pod.encumbered_flag = 'Y'
7022        AND Decode( pl.matching_basis, 'AMOUNT', Round (Nvl(pod.amount_ordered,0)+NVL(pod.NONRECOVERABLE_TAX,0)) * NVL(pod.RATE,1),
7023 			      ROUND(pll.PRICE_OVERRIDE * pod.QUANTITY_ORDERED * NVL(pod.RATE,1) +(NVL(pod.NONRECOVERABLE_TAX,0)*NVL(pod.rate,1)))
7024 			      ) <> ROUND(pod.encumbered_amount)
7025        AND pod.amount_changed_flag IS NULL
7026        AND pod.prevent_encumbrance_flag ='N'
7027        AND pod.distribution_type = 'STANDARD'
7028        AND pod.po_header_id= p_po_header_id);
7029 
7030  IF PO_LOG.d_stmt THEN
7031    PO_LOG.proc_end(d_mod,'x_return_status',x_return_status);
7032  END IF;
7033 
7034 EXCEPTION
7035 
7036     WHEN No_Data_Found THEN
7037 
7038        x_return_status := 'Y';
7039        x_return_message := 'PO_VALID_ENC_AMT';
7040       IF PO_LOG.d_exc THEN
7041        PO_LOG.exc(d_mod,d_position,NULL);
7042       END IF;
7043 END check_encumbered_amount;
7044 
7045 
7046 -- Initialize package variables.
7047 BEGIN
7048   g_result_type_rank_SUCCESS := result_type_rank(c_result_type_SUCCESS);
7049   g_result_type_rank_FATAL := result_type_rank(c_result_type_FATAL);
7050 
7051 END PO_VALIDATIONS;