[Home] [Help]
PACKAGE BODY: APPS.OE_HEADER_UTIL
Source
1 PACKAGE BODY OE_Header_Util AS
2 /* $Header: OEXUHDRB.pls 120.36.12010000.11 2008/12/26 07:34:57 vbkapoor ship $ */
3
4 -- Global constant holding the package name
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_Header_Util';
7
8 -- LOCAL Procedures
9
10 -- Added 09-DEC-2002
11 -- Forward declaration of LOCAL PROCEDURE Blkt_Req_For_Curr_Upd_And_Del
12 PROCEDURE Blkt_Req_For_Curr_Upd_And_Del
13 (p_header_rec IN OE_Order_PUB.Header_Rec_Type
14 ,p_old_header_rec IN OE_Order_PUB.Header_Rec_Type
15 );
16
17 --bug 5083663
18 PROCEDURE Set_CC_Selected_From_Lov (p_CC_selected_from_LOV IN VARCHAR2)
19 IS
20 BEGIN
21 g_is_cc_selected_from_LOV := p_CC_selected_from_LOV;
22 EXCEPTION
23 WHEN OTHERS THEN
24 NULL;
25 END Set_CC_Selected_From_Lov;
26
27 -- Clear_Dependents
28
29 PROCEDURE Clear_Dependents
30 (p_src_attr_tbl IN OE_GLOBALS.NUMBER_Tbl_Type
31 ,p_initial_header_rec IN OE_AK_ORDER_HEADERS_V%ROWTYPE
32 ,p_old_header_rec IN OE_AK_ORDER_HEADERS_V%ROWTYPE
33 ,p_x_header_rec IN OUT NOCOPY OE_AK_ORDER_HEADERS_V%ROWTYPE
34 ,p_x_instrument_id IN NUMBER DEFAULT NULL
35 ,p_old_instrument_id IN NUMBER DEFAULT NULL)
36 IS
37 l_dep_attr_tbl OE_GLOBALS.NUMBER_Tbl_Type;
38
39 PROCEDURE ACCOUNTING_RULE
40 IS
41 BEGIN
42 IF (p_initial_header_rec.accounting_rule_id = FND_API.G_MISS_NUM
43 OR (OE_GLOBALS.Equal(p_initial_header_rec.accounting_rule_id, p_old_header_rec.accounting_rule_id)
44 AND (p_old_header_rec.header_id IS NOT NULL OR
45 p_initial_header_rec.accounting_rule_id IS NOT NULL))
46 ) -- AND condition added to fix 3098878
47 THEN
48 p_x_header_rec.accounting_rule_id := FND_API.G_MISS_NUM;
49 END IF;
50 END ACCOUNTING_RULE;
51
52 PROCEDURE ACCOUNTING_RULE_DURATION
53 IS
54 BEGIN
55 IF (p_initial_header_rec.accounting_rule_duration = FND_API.G_MISS_NUM
56 OR (OE_GLOBALS.Equal(p_initial_header_rec.accounting_rule_duration, p_old_header_rec.accounting_rule_duration)
57 AND (p_old_header_rec.header_id IS NOT NULL OR
58 p_initial_header_rec.accounting_rule_duration IS NOT NULL))
59 ) -- AND condition added to fix 3098878
60 THEN
61 p_x_header_rec.accounting_rule_duration := FND_API.G_MISS_NUM;
62 END IF;
63 END ACCOUNTING_RULE_DURATION;
64
65 PROCEDURE AGREEMENT IS
66 BEGIN
67 IF (p_initial_header_rec.agreement_id = FND_API.G_MISS_NUM
68 OR (OE_GLOBALS.Equal(p_initial_header_rec.agreement_id, p_old_header_rec.agreement_id)
69 AND (p_old_header_rec.header_id IS NOT NULL OR
70 p_initial_header_rec.agreement_id IS NOT NULL))
71 ) -- AND condition added to fix 3098878
72 THEN
73 p_x_header_rec.agreement_id := FND_API.G_MISS_NUM;
74 END IF;
75 END AGREEMENT;
76
77 PROCEDURE CONVERSION_RATE IS
78 BEGIN
79 IF (p_initial_header_rec.conversion_rate = FND_API.G_MISS_NUM
80 OR (OE_GLOBALS.Equal(p_initial_header_rec.conversion_rate, p_old_header_rec.conversion_rate)
81 AND (p_old_header_rec.header_id IS NOT NULL OR
82 p_initial_header_rec.conversion_rate IS NOT NULL))
83 ) -- AND condition added to fix 3098878
84 THEN
85 p_x_header_rec.conversion_rate := FND_API.G_MISS_NUM;
86 END IF;
87 END CONVERSION_RATE;
88
89 PROCEDURE CONVERSION_RATE_DATE IS
90 BEGIN
91 IF (p_initial_header_rec.conversion_rate_date = FND_API.G_MISS_DATE
92 OR (OE_GLOBALS.Equal(p_initial_header_rec.conversion_rate_date, p_old_header_rec.conversion_rate_date)
93 AND (p_old_header_rec.header_id IS NOT NULL OR
94 p_initial_header_rec.conversion_rate_date IS NOT NULL))
95 ) -- AND condition added to fix 3098878
96 THEN
97 p_x_header_rec.conversion_rate_date := FND_API.G_MISS_DATE;
98 END IF;
99 END CONVERSION_RATE_DATE;
100
101 PROCEDURE CONVERSION_TYPE IS
102 BEGIN
103 IF (p_initial_header_rec.conversion_type_code = FND_API.G_MISS_CHAR
104 OR (OE_GLOBALS.Equal(p_initial_header_rec.conversion_type_code, p_old_header_rec.conversion_type_code)
105 AND (p_old_header_rec.header_id IS NOT NULL OR
106 p_initial_header_rec.conversion_type_code IS NOT NULL))
107 ) -- AND condition added to fix 3098878
108 THEN
109 p_x_header_rec.conversion_type_code := FND_API.G_MISS_CHAR;
110 END IF;
111 END CONVERSION_TYPE;
112
113 PROCEDURE CREDIT_CARD_EXPIRATION_DATE IS
114 BEGIN
115 IF (p_initial_header_rec.credit_card_expiration_date = FND_API.G_MISS_DATE
116 OR (OE_GLOBALS.Equal(p_initial_header_rec.credit_card_expiration_date, p_old_header_rec.credit_card_expiration_date)
117 AND (p_old_header_rec.header_id IS NOT NULL OR
118 p_initial_header_rec.credit_card_expiration_date IS NOT NULL)
119 AND nvl(g_is_cc_selected_from_LOV,'N') <> 'Y') --bug 5083663
120 ) -- AND condition added to fix 3098878
121 THEN
122 p_x_header_rec.credit_card_expiration_date := FND_API.G_MISS_DATE;
123 END IF;
124 END CREDIT_CARD_EXPIRATION_DATE;
125
126 PROCEDURE CREDIT_CARD_HOLDER_NAME IS
127 BEGIN
128 IF (p_initial_header_rec.credit_card_holder_name = FND_API.G_MISS_CHAR
129 OR (OE_GLOBALS.Equal(p_initial_header_rec.credit_card_holder_name, p_old_header_rec.credit_card_holder_name)
130 AND (p_old_header_rec.header_id IS NOT NULL OR
131 p_initial_header_rec.credit_card_holder_name IS NOT NULL)
132 AND nvl(g_is_cc_selected_from_LOV,'N') <> 'Y') --bug 5083663
133 ) -- AND condition added to fix 3098878
134 THEN
135 p_x_header_rec.credit_card_holder_name := FND_API.G_MISS_CHAR;
136 END IF;
137 END CREDIT_CARD_HOLDER_NAME;
138
139 PROCEDURE CREDIT_CARD_NUMBER IS
140 BEGIN
141 IF (p_initial_header_rec.credit_card_number = FND_API.G_MISS_CHAR
142 OR (OE_GLOBALS.Is_Same_Credit_Card(p_old_header_rec.credit_card_number,p_initial_header_rec.credit_card_number,
143 p_old_instrument_id,p_x_instrument_id)
144 AND (p_old_header_rec.header_id IS NOT NULL OR
145 p_initial_header_rec.credit_card_number IS NOT NULL))
146 ) -- AND condition added to fix 3098878
147 THEN
148 oe_debug_pub.add('In credit card number clear ....'||p_x_header_rec.credit_card_number);
149 p_x_header_rec.credit_card_number := FND_API.G_MISS_CHAR;
150
151 END IF;
152 END CREDIT_CARD_NUMBER;
153
154 /* Fix Bug # 2297053: Added to clear Credit Card Type */
155 PROCEDURE CREDIT_CARD IS
156 BEGIN
157 IF (p_initial_header_rec.credit_card_code = FND_API.G_MISS_CHAR
158 OR (OE_GLOBALS.Equal(p_initial_header_rec.credit_card_code, p_old_header_rec.credit_card_code)
159 AND (p_old_header_rec.header_id IS NOT NULL OR
160 p_initial_header_rec.credit_card_code IS NOT NULL))
161 ) -- AND condition added to fix 3098878
162 THEN
163 p_x_header_rec.credit_card_code := FND_API.G_MISS_CHAR;
164 END IF;
165 END CREDIT_CARD;
166
167 PROCEDURE CHECK_NUMBER IS --For bug 2692314
168 BEGIN
169 IF (p_initial_header_rec.check_number = FND_API.G_MISS_CHAR
170 OR (OE_GLOBALS.Equal(p_initial_header_rec.check_number, p_old_header_rec.check_number)
171 AND (p_old_header_rec.header_id IS NOT NULL OR
172 p_initial_header_rec.check_number IS NOT NULL))
173 ) -- AND condition added to fix 3098878
174 THEN
175 p_x_header_rec.check_number := FND_API.G_MISS_CHAR;
176 END IF;
177 END CHECK_NUMBER;
178
179 PROCEDURE CUST_PO_NUMBER IS
180 BEGIN
181 IF (p_initial_header_rec.cust_po_number = FND_API.G_MISS_CHAR
182 OR (OE_GLOBALS.Equal(p_initial_header_rec.cust_po_number, p_old_header_rec.cust_po_number)
183 AND (p_old_header_rec.header_id IS NOT NULL OR
184 p_initial_header_rec.cust_po_number IS NOT NULL))
185 ) -- AND condition added to fix 3098878
186 THEN
187 p_x_header_rec.cust_po_number := FND_API.G_MISS_CHAR;
188 END IF;
189 END CUST_PO_NUMBER;
190
191 PROCEDURE CUSTOMER_PREFERENCE_SET_CODE IS
192 BEGIN
193 IF (p_initial_header_rec.Customer_Preference_Set_Code = FND_API.G_MISS_CHAR
194 OR (OE_GLOBALS.Equal(p_initial_header_rec.Customer_Preference_Set_Code, p_old_header_rec.Customer_Preference_Set_Code)
195 AND (p_old_header_rec.header_id IS NOT NULL OR
196 p_initial_header_rec.Customer_Preference_Set_Code IS NOT NULL))
197 ) -- AND condition added to fix 3098878
198 THEN
199 p_x_header_rec.Customer_Preference_Set_Code := FND_API.G_MISS_CHAR;
200 END IF;
201 END CUSTOMER_PREFERENCE_SET_CODE ;
202
203 PROCEDURE DEFAULT_FULFILLMENT_SET IS
204 BEGIN
205 IF (p_initial_header_rec.Default_Fulfillment_Set = FND_API.G_MISS_CHAR
206 OR (OE_GLOBALS.Equal(p_initial_header_rec.Default_Fulfillment_Set, p_old_header_rec.Default_Fulfillment_Set)
207 AND (p_old_header_rec.header_id IS NOT NULL OR
208 p_initial_header_rec.Default_Fulfillment_Set IS NOT NULL))
209 ) -- AND condition added to fix 3098878
210 THEN
211 p_x_header_rec.Default_Fulfillment_Set := FND_API.G_MISS_CHAR;
212 END IF;
213 END DEFAULT_FULFILLMENT_SET;
214
215 PROCEDURE DELIVER_TO_CONTACT IS
216 BEGIN
217 IF (p_initial_header_rec.deliver_to_contact_id = FND_API.G_MISS_NUM
218 OR (OE_GLOBALS.Equal(p_initial_header_rec.deliver_to_contact_id, p_old_header_rec.deliver_to_contact_id)
219 AND (p_old_header_rec.header_id IS NOT NULL OR
220 p_initial_header_rec.deliver_to_contact_id IS NOT NULL))
221 ) -- AND condition added to fix 3098878
222 THEN
223 p_x_header_rec.deliver_to_contact_id := FND_API.G_MISS_NUM;
224 END IF;
225 END DELIVER_TO_CONTACT;
226
227 PROCEDURE DELIVER_TO_ORG IS
228 BEGIN
229 IF (p_initial_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM
230 OR (OE_GLOBALS.Equal(p_initial_header_rec.deliver_to_org_id, p_old_header_rec.deliver_to_org_id)
231 AND (p_old_header_rec.header_id IS NOT NULL OR
232 p_initial_header_rec.deliver_to_org_id IS NOT NULL))
233 ) -- AND condition added to fix 3098878
234 THEN
235 p_x_header_rec.deliver_to_org_id := FND_API.G_MISS_NUM;
236 END IF;
237 END DELIVER_TO_ORG;
238
239 PROCEDURE DEMAND_CLASS IS
240 BEGIN
241 IF (p_initial_header_rec.demand_class_code = FND_API.G_MISS_CHAR
242 OR (OE_GLOBALS.Equal(p_initial_header_rec.demand_class_code, p_old_header_rec.demand_class_code)
243 AND (p_old_header_rec.header_id IS NOT NULL OR
244 p_initial_header_rec.demand_class_code IS NOT NULL))
245 ) -- AND condition added to fix 3098878
246 THEN
247 p_x_header_rec.demand_class_code := FND_API.G_MISS_CHAR;
248 END IF;
249 END DEMAND_CLASS;
250
251 PROCEDURE FOB_POINT IS
252 BEGIN
253 IF (p_initial_header_rec.fob_point_code = FND_API.G_MISS_CHAR
254 OR (OE_GLOBALS.Equal(p_initial_header_rec.fob_point_code, p_old_header_rec.fob_point_code)
255 AND (p_old_header_rec.header_id IS NOT NULL OR
256 p_initial_header_rec.fob_point_code IS NOT NULL))
257 ) -- AND condition added to fix 3098878
258 THEN
259 p_x_header_rec.fob_point_code := FND_API.G_MISS_CHAR;
260 END IF;
261 END FOB_POINT;
262
263 PROCEDURE FREIGHT_TERMS IS
264 BEGIN
265 IF (p_initial_header_rec.freight_terms_code = FND_API.G_MISS_CHAR
266 OR (OE_GLOBALS.Equal(p_initial_header_rec.freight_terms_code, p_old_header_rec.freight_terms_code)
267 AND (p_old_header_rec.header_id IS NOT NULL OR
268 p_initial_header_rec.freight_terms_code IS NOT NULL))
269 ) -- AND condition added to fix 3098878
270 THEN
271 p_x_header_rec.freight_terms_code := FND_API.G_MISS_CHAR;
272 END IF;
273 END FREIGHT_TERMS;
274
275 PROCEDURE FULFILLMENT_SET_NAME IS
276 BEGIN
277 IF (p_initial_header_rec.Fulfillment_Set_name = FND_API.G_MISS_CHAR
278 OR (OE_GLOBALS.Equal(p_initial_header_rec.Fulfillment_Set_name, p_old_header_rec.Fulfillment_Set_name)
279 AND (p_old_header_rec.header_id IS NOT NULL OR
280 p_initial_header_rec.Fulfillment_Set_name IS NOT NULL))
281 ) -- AND condition added to fix 3098878
282 THEN
283 p_x_header_rec.Fulfillment_Set_Name := FND_API.G_MISS_CHAR;
284 END IF;
285 END FULFILLMENT_SET_NAME;
286
287 PROCEDURE INVOICE_TO_CONTACT IS
288 BEGIN
289 IF (p_initial_header_rec.invoice_to_contact_id = FND_API.G_MISS_NUM
290 OR (OE_GLOBALS.Equal(p_initial_header_rec.invoice_to_contact_id, p_old_header_rec.invoice_to_contact_id)
291 AND (p_old_header_rec.header_id IS NOT NULL OR
292 p_initial_header_rec.invoice_to_contact_id IS NOT NULL))
293 ) -- AND condition added to fix 3098878
294 THEN
295 p_x_header_rec.invoice_to_contact_id := FND_API.G_MISS_NUM;
296 END IF;
297 END INVOICE_TO_CONTACT;
298
299 PROCEDURE INVOICE_TO_ORG IS
300 BEGIN
301 IF (p_initial_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM
302 OR (OE_GLOBALS.Equal(p_initial_header_rec.invoice_to_org_id, p_old_header_rec.invoice_to_org_id)
303 AND (p_old_header_rec.header_id IS NOT NULL OR
304 p_initial_header_rec.invoice_to_org_id IS NOT NULL))
305 ) -- AND condition added to fix 3098878
306 THEN
307 p_x_header_rec.invoice_to_org_id := FND_API.G_MISS_NUM;
308 END IF;
309 END INVOICE_TO_ORG;
310
311 PROCEDURE INVOICING_RULE IS
312 BEGIN
313 IF (p_initial_header_rec.invoicing_rule_id = FND_API.G_MISS_NUM
314 OR (OE_GLOBALS.Equal(p_initial_header_rec.invoicing_rule_id, p_old_header_rec.invoicing_rule_id)
315 AND (p_old_header_rec.header_id IS NOT NULL OR
316 p_initial_header_rec.invoicing_rule_id IS NOT NULL))
317 ) -- AND condition added to fix 3098878
318 THEN
319 p_x_header_rec.invoicing_rule_id := FND_API.G_MISS_NUM;
320 END IF;
321 END INVOICING_RULE;
322
323 PROCEDURE LINE_SET_NAME IS
324 BEGIN
325 IF (p_initial_header_rec.Line_Set_name = FND_API.G_MISS_CHAR
326 OR (OE_GLOBALS.Equal(p_initial_header_rec.Line_Set_name, p_old_header_rec.Line_Set_name)
327 AND (p_old_header_rec.header_id IS NOT NULL OR
328 p_initial_header_rec.Line_Set_name IS NOT NULL))
329 ) -- AND condition added to fix 3098878
330 THEN
331 p_x_header_rec.Line_Set_Name := FND_API.G_MISS_CHAR;
332 END IF;
333 END LINE_SET_NAME;
334
335 PROCEDURE ORDER_CATEGORY IS
336 BEGIN
337 IF (p_initial_header_rec.order_category_code = FND_API.G_MISS_CHAR
338 OR (OE_GLOBALS.Equal(p_initial_header_rec.order_category_code, p_old_header_rec.order_category_code)
339 AND (p_old_header_rec.header_id IS NOT NULL OR
340 p_initial_header_rec.order_category_code IS NOT NULL))
341 ) -- AND condition added to fix 3098878
342 THEN
343 p_x_header_rec.order_category_code := FND_API.G_MISS_CHAR;
344 END IF;
345 END ORDER_CATEGORY;
346
347 PROCEDURE ORDER_DATE_TYPE IS
348 BEGIN
349
350 IF (p_initial_header_rec.order_date_type_code = FND_API.G_MISS_CHAR
351 OR (OE_GLOBALS.Equal(p_initial_header_rec.order_date_type_code, p_old_header_rec.order_date_type_code)
352 AND (p_old_header_rec.header_id IS NOT NULL OR
353 p_initial_header_rec.order_date_type_code IS NOT NULL))
354 ) -- AND condition added to fix 3098878
355 THEN
356 p_x_header_rec.order_date_type_code := FND_API.G_MISS_CHAR;
357 END IF;
358 END ORDER_DATE_TYPE;
359
360 PROCEDURE ORDER_TYPE IS
361 BEGIN
362 IF (p_initial_header_rec.order_type_id = FND_API.G_MISS_NUM
363 OR (OE_GLOBALS.Equal(p_initial_header_rec.order_type_id, p_old_header_rec.order_type_id)
364 AND (p_old_header_rec.header_id IS NOT NULL OR
365 p_initial_header_rec.order_type_id IS NOT NULL))
366 ) -- AND condition added to fix 3098878
367 THEN
368 p_x_header_rec.order_type_id := FND_API.G_MISS_NUM;
369 END IF;
370 END ORDER_TYPE;
371
372 --Bug 4360599 Added this method to clear the payment Amount
373 PROCEDURE PAYMENT_AMOUNT IS
374 BEGIN
375 IF (p_initial_header_rec.PAYMENT_AMOUNT = FND_API.G_MISS_NUM
376 OR (OE_GLOBALS.Equal(p_initial_header_rec.PAYMENT_AMOUNT, p_old_header_rec.PAYMENT_AMOUNT)
377 AND (p_old_header_rec.header_id IS NOT NULL OR
378 p_initial_header_rec.PAYMENT_AMOUNT IS NOT NULL))
379 ) -- AND condition added to fix 3098878
380 THEN
381 p_x_header_rec.PAYMENT_AMOUNT := FND_API.G_MISS_NUM;
382 END IF;
383 END PAYMENT_AMOUNT;
384
385 PROCEDURE PAYMENT_TERM IS
386 BEGIN
387 IF (p_initial_header_rec.payment_term_id = FND_API.G_MISS_NUM
388 OR (OE_GLOBALS.Equal(p_initial_header_rec.payment_term_id, p_old_header_rec.payment_term_id)
389 AND (p_old_header_rec.header_id IS NOT NULL OR
390 p_initial_header_rec.payment_term_id IS NOT NULL))
391 ) -- AND condition added to fix 3098878
392 THEN
393 p_x_header_rec.payment_term_id := FND_API.G_MISS_NUM;
394 END IF;
395 END PAYMENT_TERM;
396
397 PROCEDURE PRICE_LIST IS
398 BEGIN
399 IF (p_initial_header_rec.price_list_id = FND_API.G_MISS_NUM
400 OR (OE_GLOBALS.Equal(p_initial_header_rec.price_list_id, p_old_header_rec.price_list_id)
401 AND (p_old_header_rec.header_id IS NOT NULL OR
402 p_initial_header_rec.price_list_id IS NOT NULL))
403 ) -- AND condition added to fix 3098878
404 THEN
405 p_x_header_rec.price_list_id := FND_API.G_MISS_NUM;
406 END IF;
407 END PRICE_LIST;
408
409 PROCEDURE PRICE_REQUEST_CODE IS -- PROMOTIONS SEP/01 BEGIN
410 BEGIN
411 IF (p_initial_header_rec.price_request_code = FND_API.G_MISS_CHAR
412 OR (OE_GLOBALS.Equal(p_initial_header_rec.price_request_code, p_old_header_rec.price_request_code)
413 AND (p_old_header_rec.header_id IS NOT NULL OR
414 p_initial_header_rec.price_request_code IS NOT NULL))
415 ) -- AND condition added to fix 3098878
416 THEN
417 p_x_header_rec.price_request_code := FND_API.G_MISS_CHAR;
418 END IF;
419 END PRICE_REQUEST_CODE; -- PROMOTIONS SEP/01 END
420
421 PROCEDURE REQUEST_DATE IS
422 BEGIN
423 IF (p_initial_header_rec.request_date = FND_API.G_MISS_DATE
424 OR (OE_GLOBALS.Equal(p_initial_header_rec.request_date, p_old_header_rec.request_date)
425 AND (p_old_header_rec.header_id IS NOT NULL OR
426 p_initial_header_rec.request_date IS NOT NULL))
427 ) -- AND condition added to fix 3098878
428 THEN
429 p_x_header_rec.request_date := FND_API.G_MISS_DATE;
430 END IF;
431 END REQUEST_DATE;
432
433 PROCEDURE SALESREP IS
434 BEGIN
435 IF (p_initial_header_rec.salesrep_id = FND_API.G_MISS_NUM
436 OR (OE_GLOBALS.Equal(p_initial_header_rec.salesrep_id, p_old_header_rec.salesrep_id)
437 AND (p_old_header_rec.header_id IS NOT NULL OR
438 p_initial_header_rec.salesrep_id IS NOT NULL))
439 ) -- AND condition added to fix 3098878
440 THEN
441 p_x_header_rec.salesrep_id := FND_API.G_MISS_NUM;
442 END IF;
443 END SALESREP;
444
445 PROCEDURE SALES_CHANNEL IS
446 BEGIN
447 IF (p_initial_header_rec.sales_channel_code = FND_API.G_MISS_CHAR
448 OR (OE_GLOBALS.Equal(p_initial_header_rec.sales_channel_code, p_old_header_rec.sales_channel_code)
449 AND (p_old_header_rec.header_id IS NOT NULL OR
450 p_initial_header_rec.sales_channel_code IS NOT NULL))
451 ) -- AND condition added to fix 3098878
452 THEN
453 p_x_header_rec.sales_channel_code := FND_API.G_MISS_CHAR;
454 END IF;
455 END SALES_CHANNEL;
456
457 PROCEDURE SHIPMENT_PRIORITY IS
458 BEGIN
459 IF (p_initial_header_rec.shipment_priority_code = FND_API.G_MISS_CHAR
460 OR (OE_GLOBALS.Equal(p_initial_header_rec.shipment_priority_code, p_old_header_rec.shipment_priority_code)
461 AND (p_old_header_rec.header_id IS NOT NULL OR
462 p_initial_header_rec.shipment_priority_code IS NOT NULL))
463 ) -- AND condition added to fix 3098878
464 THEN
465 p_x_header_rec.shipment_priority_code := FND_API.G_MISS_CHAR;
466 END IF;
467 END SHIPMENT_PRIORITY;
468
469 PROCEDURE SHIPPING_METHOD IS
470 BEGIN
471 IF (p_initial_header_rec.shipping_method_code = FND_API.G_MISS_CHAR
472 OR (OE_GLOBALS.Equal(p_initial_header_rec.shipping_method_code, p_old_header_rec.shipping_method_code)
473 AND (p_old_header_rec.header_id IS NOT NULL OR
474 p_initial_header_rec.shipping_method_code IS NOT NULL))
475 ) -- AND condition added to fix 3098878
476 THEN
477 p_x_header_rec.shipping_method_code := FND_API.G_MISS_CHAR;
478 END IF;
479 END SHIPPING_METHOD;
480
481 PROCEDURE SHIP_FROM_ORG IS
482 BEGIN
483 IF (p_initial_header_rec.ship_from_org_id = FND_API.G_MISS_NUM
484 OR (OE_GLOBALS.Equal(p_initial_header_rec.ship_from_org_id, p_old_header_rec.ship_from_org_id)
485 AND (p_old_header_rec.header_id IS NOT NULL OR
486 p_initial_header_rec.ship_from_org_id IS NOT NULL))
487 ) -- AND condition added to fix 3098878
488 THEN
489 p_x_header_rec.ship_from_org_id := FND_API.G_MISS_NUM;
490 END IF;
491 END SHIP_FROM_ORG;
492
493 PROCEDURE SHIP_TOLERANCE_ABOVE IS
494 BEGIN
495 IF (p_initial_header_rec.ship_tolerance_above = FND_API.G_MISS_NUM
496 OR (OE_GLOBALS.Equal(p_initial_header_rec.ship_tolerance_above, p_old_header_rec.ship_tolerance_above)
497 AND (p_old_header_rec.header_id IS NOT NULL OR
498 p_initial_header_rec.ship_tolerance_above IS NOT NULL))
499 ) -- AND condition added to fix 3098878
500 THEN
501 p_x_header_rec.ship_tolerance_above := FND_API.G_MISS_NUM;
502 END IF;
503 END SHIP_TOLERANCE_ABOVE;
504
505 PROCEDURE SHIP_TOLERANCE_BELOW IS
506 BEGIN
507 IF (p_initial_header_rec.ship_tolerance_below = FND_API.G_MISS_NUM
508 OR (OE_GLOBALS.Equal(p_initial_header_rec.ship_tolerance_below, p_old_header_rec.ship_tolerance_below)
509 AND (p_old_header_rec.header_id IS NOT NULL OR
510 p_initial_header_rec.ship_tolerance_below IS NOT NULL))
511 ) -- AND condition added to fix 3098878
512 THEN
513 p_x_header_rec.ship_tolerance_below := FND_API.G_MISS_NUM;
514 END IF;
515 END SHIP_TOLERANCE_BELOW;
516
517 PROCEDURE SHIP_TO_CONTACT IS
518 BEGIN
519 IF (p_initial_header_rec.ship_to_contact_id = FND_API.G_MISS_NUM
520 OR (OE_GLOBALS.Equal(p_initial_header_rec.ship_to_contact_id, p_old_header_rec.ship_to_contact_id)
521 AND (p_old_header_rec.header_id IS NOT NULL OR
522 p_initial_header_rec.ship_to_contact_id IS NOT NULL))
523 ) -- AND condition added to fix 3098878
524 THEN
525 p_x_header_rec.ship_to_contact_id := FND_API.G_MISS_NUM;
526 END IF;
527 END SHIP_TO_CONTACT;
528
529 PROCEDURE SHIP_TO_ORG IS
530 BEGIN
531 IF (p_initial_header_rec.ship_to_org_id = FND_API.G_MISS_NUM
532 OR (OE_GLOBALS.Equal(p_initial_header_rec.ship_to_org_id, p_old_header_rec.ship_to_org_id)
533 AND (p_old_header_rec.header_id IS NOT NULL OR
534 p_initial_header_rec.ship_to_org_id IS NOT NULL))
535 ) -- AND condition added to fix 3098878
536 THEN
537 p_x_header_rec.ship_to_org_id := FND_API.G_MISS_NUM;
538 END IF;
539 END SHIP_TO_ORG;
540
541 -- Fix bug 1753101: sold to contact dependency code added
542 PROCEDURE SOLD_TO_CONTACT IS
543 BEGIN
544 IF (p_initial_header_rec.sold_to_contact_id = FND_API.G_MISS_NUM
545 OR (OE_GLOBALS.Equal(p_initial_header_rec.sold_to_contact_id, p_old_header_rec.sold_to_contact_id)
546 AND (p_old_header_rec.header_id IS NOT NULL OR
547 p_initial_header_rec.sold_to_contact_id IS NOT NULL))
548 ) -- AND condition added to fix 3098878
549 THEN
550 p_x_header_rec.sold_to_contact_id := FND_API.G_MISS_NUM;
551 END IF;
552 END SOLD_TO_CONTACT;
553
554 PROCEDURE SOLD_TO_ORG IS
555 BEGIN
556 IF (p_initial_header_rec.sold_to_org_id = FND_API.G_MISS_NUM
557 OR (OE_GLOBALS.Equal(p_initial_header_rec.sold_to_org_id, p_old_header_rec.sold_to_org_id)
558 AND (p_old_header_rec.header_id IS NOT NULL OR
559 p_initial_header_rec.sold_to_org_id IS NOT NULL))
560 ) -- AND condition added to fix 3098878
561 THEN
562 p_x_header_rec.sold_to_org_id := FND_API.G_MISS_NUM;
563 END IF;
564 END SOLD_TO_ORG;
565
566 PROCEDURE SOLD_TO_PHONE IS
567 BEGIN
568 IF (p_initial_header_rec.sold_to_phone_id = FND_API.G_MISS_NUM
569 OR (OE_GLOBALS.Equal(p_initial_header_rec.sold_to_phone_id, p_old_header_rec.sold_to_phone_id)
570 AND (p_old_header_rec.header_id IS NOT NULL OR
571 p_initial_header_rec.sold_to_phone_id IS NOT NULL))
572 ) -- AND condition added to fix 3098878
573 THEN
574 p_x_header_rec.sold_to_phone_id := FND_API.G_MISS_NUM;
575 END IF;
576 END SOLD_TO_PHONE;
577
578
579 PROCEDURE TAX_EXEMPT_NUMBER IS
580 BEGIN
581 IF (p_initial_header_rec.tax_exempt_number = FND_API.G_MISS_CHAR
582 OR (OE_GLOBALS.Equal(p_initial_header_rec.tax_exempt_number, p_old_header_rec.tax_exempt_number)
583 AND (p_old_header_rec.header_id IS NOT NULL OR
584 p_initial_header_rec.tax_exempt_number IS NOT NULL))
585 ) -- AND condition added to fix 3098878
586 THEN
587 p_x_header_rec.tax_exempt_number := FND_API.G_MISS_CHAR;
588 END IF;
589 END TAX_EXEMPT_NUMBER;
590
591 PROCEDURE TAX_EXEMPT_REASON IS
592 BEGIN
593 IF (p_initial_header_rec.tax_exempt_reason_code = FND_API.G_MISS_CHAR
594 OR (OE_GLOBALS.Equal(p_initial_header_rec.tax_exempt_reason_code, p_old_header_rec.tax_exempt_reason_code)
595 AND (p_old_header_rec.header_id IS NOT NULL OR
596 p_initial_header_rec.tax_exempt_reason_code IS NOT NULL))
597 ) -- AND condition added to fix 3098878
598 THEN
599 -- If condition for bug #2892094
600 IF OE_GLOBALS.G_UI_FLAG THEN
601 p_x_header_rec.tax_exempt_reason_code := FND_API.G_MISS_CHAR;
602 END IF;
603 END IF;
604 END TAX_EXEMPT_REASON;
605
606 PROCEDURE TRANSACTIONAL_CURR IS
607 BEGIN
608 IF (p_initial_header_rec.transactional_curr_code = FND_API.G_MISS_CHAR
609 OR (OE_GLOBALS.Equal(p_initial_header_rec.transactional_curr_code, p_old_header_rec.transactional_curr_code)
610 AND (p_old_header_rec.header_id IS NOT NULL OR
611 p_initial_header_rec.transactional_curr_code IS NOT NULL))
612 ) -- AND condition added to fix 3098878
613 THEN
614 p_x_header_rec.transactional_curr_code := FND_API.G_MISS_CHAR;
615 END IF;
616 END TRANSACTIONAL_CURR;
617
618 PROCEDURE LATEST_SCHEDULE_LIMIT IS
619 BEGIN
620 IF (p_initial_header_rec.latest_schedule_limit = FND_API.G_MISS_NUM
621 OR (OE_GLOBALS.Equal(p_initial_header_rec.latest_schedule_limit, p_old_header_rec.latest_schedule_limit)
622 AND (p_old_header_rec.header_id IS NOT NULL OR
623 p_initial_header_rec.latest_schedule_limit IS NOT NULL))
624 ) -- AND condition added to fix 3098878
625 THEN
626 p_x_header_rec.latest_schedule_limit := FND_API.G_MISS_NUM;
627 END IF;
628 END LATEST_SCHEDULE_LIMIT;
629
630 PROCEDURE PACKING_INSTRUCTIONS IS -- added for 2665264
631 BEGIN
632 IF (p_initial_header_rec.packing_instructions = FND_API.G_MISS_CHAR
633 OR (OE_GLOBALS.Equal(p_initial_header_rec.packing_instructions, p_old_header_rec.packing_instructions)
634 AND (p_old_header_rec.header_id IS NOT NULL OR
635 p_initial_header_rec.packing_instructions IS NOT NULL))
636 ) -- AND condition added to fix 3098878
637 THEN
638 p_x_header_rec.packing_instructions := FND_API.G_MISS_CHAR;
639 END IF;
640 END PACKING_INSTRUCTIONS;
641
642 PROCEDURE SHIPPING_INSTRUCTIONS IS -- added for 2766005
643 BEGIN
644 IF (p_initial_header_rec.shipping_instructions = FND_API.G_MISS_CHAR
645 OR (OE_GLOBALS.Equal(p_initial_header_rec.shipping_instructions, p_old_header_rec.shipping_instructions)
646 AND (p_old_header_rec.header_id IS NOT NULL OR
647 p_initial_header_rec.shipping_instructions IS NOT NULL))
648 ) -- AND condition added to fix 3098878
649 THEN
650 p_x_header_rec.shipping_instructions := FND_API.G_MISS_CHAR;
651 END IF;
652 END SHIPPING_INSTRUCTIONS;
653
654 -- QUOTING changes
655
656 PROCEDURE TRANSACTION_PHASE IS
657 BEGIN
658 -- Transaction phase can only be cleared during CREATE operation
659 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
660 AND (p_initial_header_rec.transaction_phase_code = FND_API.G_MISS_CHAR
661 OR (OE_GLOBALS.Equal(p_initial_header_rec.transaction_phase_code, p_old_header_rec.transaction_phase_code)
662 AND (p_old_header_rec.header_id IS NOT NULL OR
663 p_initial_header_rec.transaction_phase_code IS NOT NULL))
664 ) -- 2nd AND condition added to fix 3098878
665 THEN
666 p_x_header_rec.transaction_phase_code := FND_API.G_MISS_CHAR;
667 END IF;
668 END TRANSACTION_PHASE;
669
670 PROCEDURE SOLD_TO_SITE_USE IS
671 BEGIN
672 IF (p_initial_header_rec.sold_to_site_use_id = FND_API.G_MISS_NUM
673 OR (OE_GLOBALS.Equal(p_initial_header_rec.sold_to_site_use_id, p_old_header_rec.sold_to_site_use_id)
674 AND (p_old_header_rec.header_id IS NOT NULL OR
675 p_initial_header_rec.sold_to_site_use_id IS NOT NULL))
676 ) -- AND condition added to fix 3098878
677 THEN
678 p_x_header_rec.sold_to_site_use_id := FND_API.G_MISS_NUM;
679 END IF;
680 END SOLD_TO_SITE_USE;
681
682 PROCEDURE QUOTE_DATE IS
683 BEGIN
684 IF (p_initial_header_rec.quote_date = FND_API.G_MISS_DATE
685 OR (OE_GLOBALS.Equal(p_initial_header_rec.quote_date, p_old_header_rec.quote_date)
686 AND (p_old_header_rec.header_id IS NOT NULL OR
687 p_initial_header_rec.quote_date IS NOT NULL))
688 ) -- AND condition added to fix 3098878
689 AND OE_Quote_Util.G_COMPLETE_NEG = 'N'
690 -- bug 3854887
691 AND p_x_header_rec.transaction_phase_code = 'N'
692 THEN
693 p_x_header_rec.quote_date := FND_API.G_MISS_DATE;
694 END IF;
695 END QUOTE_DATE;
696
697 PROCEDURE ORDERED_DATE IS
698 BEGIN
699 IF (p_initial_header_rec.ordered_date = FND_API.G_MISS_DATE
700 OR (OE_GLOBALS.Equal(p_initial_header_rec.ordered_date, p_old_header_rec.ordered_date)
701 AND (p_old_header_rec.header_id IS NOT NULL OR
702 p_initial_header_rec.ordered_date IS NOT NULL))
703 -- bug 3854887
704 AND (p_x_header_rec.transaction_phase_code IS NULL OR
705 p_x_header_rec.transaction_phase_code = 'F' OR
706 p_x_header_rec.transaction_phase_code = FND_API.G_MISS_CHAR)
707 ) -- AND condition added to fix 3098878
708 THEN
709 p_x_header_rec.ordered_date := FND_API.G_MISS_DATE;
710 END IF;
711 END ORDERED_DATE;
712
713 -- QUOTING changes END
714
715 --distributed orders
716 PROCEDURE end_customer IS
717 BEGIN
718 IF (p_initial_header_rec.end_customer_id = FND_API.G_MISS_NUM
719 OR OE_GLOBALS.Equal(p_initial_header_rec.end_customer_id
720 , p_old_header_rec.end_customer_id ))
721 THEN
722 p_x_header_rec.end_customer_id := FND_API.G_MISS_NUM;
723 END IF;
724 END end_customer;
725
726 PROCEDURE end_customer_contact IS
727 BEGIN
728 IF (p_initial_header_rec.end_customer_contact_id = FND_API.G_MISS_NUM
729 OR OE_GLOBALS.Equal(p_initial_header_rec.end_customer_contact_id
730 , p_old_header_rec.end_customer_contact_id ))
731 THEN
732 p_x_header_rec.end_customer_contact_id := FND_API.G_MISS_NUM;
733 END IF;
734 END end_customer_contact;
735
736 PROCEDURE end_customer_site_use IS
737 BEGIN
738 IF (p_initial_header_rec.end_customer_site_use_id = FND_API.G_MISS_NUM
739 OR OE_GLOBALS.Equal(p_initial_header_rec.end_customer_site_use_id ,
740 p_old_header_rec.end_customer_site_use_id ))
741 THEN
742 p_x_header_rec.end_customer_site_use_id := FND_API.G_MISS_NUM;
743 END IF;
744 END end_customer_site_use;
745
746 --key Transaction dates
747 PROCEDURE order_firmed_date IS
748 BEGIN
749 IF (p_initial_header_rec.order_firmed_date = FND_API.G_MISS_DATE
750 OR
751 (OE_GLOBALS.equal(p_initial_header_rec.order_firmed_date ,p_old_header_rec.order_firmed_date)
752 AND (p_initial_header_rec.order_firmed_date IS NOT NULL OR p_old_header_rec.order_firmed_date IS NOT NULL))
753 ) THEN
754 p_x_header_rec.order_firmed_date := FND_API.G_MISS_DATE;
755 END IF ;
756 END order_firmed_date;
757 -- end
758
759 BEGIN
760
761 oe_debug_pub.add('Entering OE_HEADER_UTIL.Clear_Dependent',1);
762 IF p_src_attr_tbl.COUNT <> 0 THEN
763
764 OE_Dependencies.Mark_Dependent
765 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
766 p_source_attr_tbl => p_src_attr_tbl,
767 p_dep_attr_tbl => l_dep_attr_tbl);
768
769 FOR I IN 1..l_dep_attr_tbl.COUNT LOOP
770 IF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ACCOUNTING_RULE THEN
771 ACCOUNTING_RULE;
772 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ACCOUNTING_RULE_DURATION THEN
773 ACCOUNTING_RULE_DURATION;
774 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_AGREEMENT THEN
775 AGREEMENT;
776 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CONVERSION_RATE THEN
777 CONVERSION_RATE;
778 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CONVERSION_RATE_DATE THEN
779 CONVERSION_RATE_DATE;
780 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CONVERSION_TYPE THEN
781 CONVERSION_TYPE;
782 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CREDIT_CARD_EXPIRATION_DATE THEN
783 CREDIT_CARD_EXPIRATION_DATE;
784 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CREDIT_CARD_HOLDER_NAME THEN
785 CREDIT_CARD_HOLDER_NAME;
786 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CREDIT_CARD_NUMBER THEN
787 CREDIT_CARD_NUMBER;
788 /* Fix Bug # 2297053: Added to clear Credit Card Type */
789 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CREDIT_CARD THEN
790 CREDIT_CARD;
791 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CHECK_NUMBER THEN --For bug 2692314
792 CHECK_NUMBER;
793 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CUST_PO_NUMBER THEN
794 CUST_PO_NUMBER;
795 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_CUSTOMER_PREFERENCE_SET THEN
796 CUSTOMER_PREFERENCE_SET_CODE;
797 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_DEFAULT_FULFILLMENT_SET THEN
798 DEFAULT_FULFILLMENT_SET;
799 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_DELIVER_TO_CONTACT THEN
800 DELIVER_TO_CONTACT;
801 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_DELIVER_TO_ORG THEN
802 DELIVER_TO_ORG;
803 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_DEMAND_CLASS THEN
804 DEMAND_CLASS;
805 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_FOB_POINT THEN
806 FOB_POINT;
807 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_FREIGHT_TERMS THEN
808 FREIGHT_TERMS;
809 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_INVOICE_TO_CONTACT THEN
810 INVOICE_TO_CONTACT;
811 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_INVOICE_TO_ORG THEN
812 INVOICE_TO_ORG;
813 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_INVOICING_RULE THEN
814 INVOICING_RULE;
815 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ORDER_CATEGORY THEN
816 ORDER_CATEGORY;
817 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ORDER_DATE_TYPE_CODE THEN
818 ORDER_DATE_TYPE;
819 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ORDER_TYPE THEN
820 ORDER_TYPE;
821 -- Added the call to the method to clear the payment amount bug 4360599
822 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_PAYMENT_AMOUNT THEN
823 PAYMENT_AMOUNT;
824 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_PAYMENT_TERM THEN
825 PAYMENT_TERM;
826 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_PRICE_LIST THEN
827 PRICE_LIST;
828 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_PRICE_REQUEST_CODE THEN -- PROMOTIONS SEP/01
829 PRICE_REQUEST_CODE;
830 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_REQUEST_DATE THEN
831 REQUEST_DATE;
832 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SALESREP THEN
833 SALESREP;
834 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SALES_CHANNEL THEN
835 SALES_CHANNEL;
836 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIPMENT_PRIORITY THEN
837 SHIPMENT_PRIORITY;
838 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIPPING_METHOD THEN
839 SHIPPING_METHOD;
840 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIP_FROM_ORG THEN
841 SHIP_FROM_ORG;
842 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIP_TOLERANCE_ABOVE THEN
843 SHIP_TOLERANCE_ABOVE;
844 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIP_TOLERANCE_BELOW THEN
845 SHIP_TOLERANCE_BELOW;
846 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIP_TO_CONTACT THEN
847 SHIP_TO_CONTACT;
848 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIP_TO_ORG THEN
849 SHIP_TO_ORG;
850 -- Fix bug 1753101: sold to contact dependency code added
851 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SOLD_TO_CONTACT THEN
852 SOLD_TO_CONTACT;
853 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SOLD_TO_ORG THEN
854 SOLD_TO_ORG;
855 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SOLD_TO_PHONE THEN
856 SOLD_TO_PHONE;
857 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_TAX_EXEMPT_NUMBER THEN
858 TAX_EXEMPT_NUMBER;
859 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_TAX_EXEMPT_REASON THEN
860 TAX_EXEMPT_REASON;
861 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_TRANSACTIONAL_CURR THEN
862 TRANSACTIONAL_CURR;
863 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_LATEST_SCHEDULE_LIMIT THEN
864 LATEST_SCHEDULE_LIMIT;
865 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_PACKING_INSTRUCTIONS THEN
866 PACKING_INSTRUCTIONS; -- added for 2665264
867 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SHIPPING_INSTRUCTIONS THEN
868 SHIPPING_INSTRUCTIONS; -- added for 2766005
869
870 -- QUOTING changes
871 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_TRANSACTION_PHASE THEN
872 IF OE_Code_Control.Code_Release_Level >= '110510' THEN
873 TRANSACTION_PHASE;
874 END IF;
875 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_SOLD_TO_SITE_USE THEN
876 IF OE_Code_Control.Code_Release_Level >= '110510' THEN
877 SOLD_TO_SITE_USE;
878 END IF;
879 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_QUOTE_DATE THEN
880 IF OE_Code_Control.Code_Release_Level >= '110510' THEN
881 QUOTE_DATE;
882 END IF;
883 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ORDERED_DATE THEN
884 IF OE_Code_Control.Code_Release_Level >= '110510' THEN
885 ORDERED_DATE;
886 END IF;
887 -- QUOTING changes END
888 -- Distributed orders @
889 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_END_CUSTOMER THEN
890 END_CUSTOMER;
891 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_END_CUSTOMER_CONTACT THEN
892 END_CUSTOMER_CONTACT;
893 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_END_CUSTOMER_SITE_USE THEN
894 END_CUSTOMER_SITE_USE;
895 ELSIF l_dep_attr_tbl(I) = OE_HEADER_UTIL.G_ORDER_FIRMED_DATE THEN --Key Transaction Dates
896 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110509' THEN
897 order_firmed_date;
898 END IF;
899 END IF;
900 END LOOP;
901 END IF;
902
903 oe_debug_pub.add('Exiting OE_HEADER_UTIL.Clear_Dependent',1);
904
905 EXCEPTION
906
907 WHEN FND_API.G_EXC_ERROR THEN
908 RAISE FND_API.G_EXC_ERROR;
909 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
910 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
911 WHEN OTHERS THEN
912 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
913 THEN
914 OE_MSG_PUB.Add_Exc_Msg
915 ( G_PKG_NAME
916 , 'Clear_Dependents'
917 );
918 END IF;
919
920 oe_debug_pub.add('Error : '||substr(sqlerrm,1,200),1);
921 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
922
923 END Clear_Dependents;
924
925 FUNCTION G_MISS_OE_AK_HEADER_REC
926 RETURN OE_AK_ORDER_HEADERS_V%ROWTYPE IS
927 l_rowtype_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
928 BEGIN
929
930 l_rowtype_rec.ACCOUNTING_RULE_ID := FND_API.G_MISS_NUM;
931 l_rowtype_rec.ACCOUNTING_RULE_DURATION := FND_API.G_MISS_NUM;
932 l_rowtype_rec.AGREEMENT_ID := FND_API.G_MISS_NUM;
933 l_rowtype_rec.ATTRIBUTE1 := FND_API.G_MISS_CHAR;
934 l_rowtype_rec.ATTRIBUTE10 := FND_API.G_MISS_CHAR;
935 l_rowtype_rec.ATTRIBUTE11 := FND_API.G_MISS_CHAR;
936 l_rowtype_rec.ATTRIBUTE12 := FND_API.G_MISS_CHAR;
937 l_rowtype_rec.ATTRIBUTE13 := FND_API.G_MISS_CHAR;
938 l_rowtype_rec.ATTRIBUTE14 := FND_API.G_MISS_CHAR;
939 l_rowtype_rec.ATTRIBUTE15 := FND_API.G_MISS_CHAR;
940 l_rowtype_rec.ATTRIBUTE16 := FND_API.G_MISS_CHAR; --For bug 2184255
941 l_rowtype_rec.ATTRIBUTE17 := FND_API.G_MISS_CHAR;
942 l_rowtype_rec.ATTRIBUTE18 := FND_API.G_MISS_CHAR;
943 l_rowtype_rec.ATTRIBUTE19 := FND_API.G_MISS_CHAR;
944 l_rowtype_rec.ATTRIBUTE2 := FND_API.G_MISS_CHAR;
945 l_rowtype_rec.ATTRIBUTE20 := FND_API.G_MISS_CHAR;
946 l_rowtype_rec.ATTRIBUTE3 := FND_API.G_MISS_CHAR;
947 l_rowtype_rec.ATTRIBUTE4 := FND_API.G_MISS_CHAR;
948 l_rowtype_rec.ATTRIBUTE5 := FND_API.G_MISS_CHAR;
949 l_rowtype_rec.ATTRIBUTE6 := FND_API.G_MISS_CHAR;
950 l_rowtype_rec.ATTRIBUTE7 := FND_API.G_MISS_CHAR;
951 l_rowtype_rec.ATTRIBUTE8 := FND_API.G_MISS_CHAR;
952 l_rowtype_rec.ATTRIBUTE9 := FND_API.G_MISS_CHAR;
953 l_rowtype_rec.BLANKET_NUMBER := FND_API.G_MISS_NUM;
954 l_rowtype_rec.BOOKED_FLAG := FND_API.G_MISS_CHAR;
955 l_rowtype_rec.BOOKED_DATE := FND_API.G_MISS_DATE;
956 l_rowtype_rec.CANCELLED_FLAG := FND_API.G_MISS_CHAR;
957 l_rowtype_rec.CHANGE_COMMENTS := FND_API.G_MISS_CHAR;
958 l_rowtype_rec.CHANGE_REASON := FND_API.G_MISS_CHAR;
959 l_rowtype_rec.CHECK_NUMBER := FND_API.G_MISS_CHAR;
960 l_rowtype_rec.CONTEXT := FND_API.G_MISS_CHAR;
961 l_rowtype_rec.CONVERSION_RATE := FND_API.G_MISS_NUM;
962 l_rowtype_rec.CONVERSION_RATE_DATE := FND_API.G_MISS_DATE;
963 l_rowtype_rec.CONVERSION_TYPE_CODE := FND_API.G_MISS_CHAR;
964 l_rowtype_rec.CUSTOMER_PREFERENCE_SET_CODE := FND_API.G_MISS_CHAR;
965 l_rowtype_rec.CREATED_BY := FND_API.G_MISS_NUM;
966 l_rowtype_rec.CREATION_DATE := FND_API.G_MISS_DATE;
967 l_rowtype_rec.CREDIT_CARD_APPROVAL_CODE := FND_API.G_MISS_CHAR;
968 l_rowtype_rec.CREDIT_CARD_CODE := FND_API.G_MISS_CHAR;
969 l_rowtype_rec.CREDIT_CARD_EXPIRATION_DATE := FND_API.G_MISS_DATE;
970 l_rowtype_rec.CREDIT_CARD_APPROVAL_DATE := FND_API.G_MISS_DATE;
971 l_rowtype_rec.CREDIT_CARD_HOLDER_NAME := FND_API.G_MISS_CHAR;
972 l_rowtype_rec.CREDIT_CARD_NUMBER := FND_API.G_MISS_CHAR;
973 l_rowtype_rec.CUST_PO_NUMBER := FND_API.G_MISS_CHAR;
974 l_rowtype_rec.DEFAULT_FULFILLMENT_SET := FND_API.G_MISS_CHAR;
975 l_rowtype_rec.DB_FLAG := FND_API.G_MISS_CHAR;
976 l_rowtype_rec.DELIVER_TO_CONTACT_ID := FND_API.G_MISS_NUM;
977 l_rowtype_rec.DELIVER_TO_ORG_ID := FND_API.G_MISS_NUM;
978 l_rowtype_rec.DEMAND_CLASS_CODE := FND_API.G_MISS_CHAR;
979 l_rowtype_rec.EARLIEST_SCHEDULE_LIMIT := FND_API.G_MISS_NUM;
980 l_rowtype_rec.EXPIRATION_DATE := FND_API.G_MISS_DATE;
981 l_rowtype_rec.FIRST_ACK_CODE := FND_API.G_MISS_CHAR;
982 l_rowtype_rec.FIRST_ACK_DATE := FND_API.G_MISS_DATE;
983 l_rowtype_rec.FOB_POINT_CODE := FND_API.G_MISS_CHAR;
984 l_rowtype_rec.FREIGHT_CARRIER_CODE := FND_API.G_MISS_CHAR;
985 l_rowtype_rec.FREIGHT_TERMS_CODE := FND_API.G_MISS_CHAR;
986 l_rowtype_rec.FULFILLMENT_SET_NAME := FND_API.G_MISS_CHAR;
987 l_rowtype_rec.GLOBAL_ATTRIBUTE1 := FND_API.G_MISS_CHAR;
988 l_rowtype_rec.GLOBAL_ATTRIBUTE10 := FND_API.G_MISS_CHAR;
989 l_rowtype_rec.GLOBAL_ATTRIBUTE11 := FND_API.G_MISS_CHAR;
990 l_rowtype_rec.GLOBAL_ATTRIBUTE12 := FND_API.G_MISS_CHAR;
991 l_rowtype_rec.GLOBAL_ATTRIBUTE13 := FND_API.G_MISS_CHAR;
992 l_rowtype_rec.GLOBAL_ATTRIBUTE14 := FND_API.G_MISS_CHAR;
993 l_rowtype_rec.GLOBAL_ATTRIBUTE15 := FND_API.G_MISS_CHAR;
994 l_rowtype_rec.GLOBAL_ATTRIBUTE16 := FND_API.G_MISS_CHAR;
995 l_rowtype_rec.GLOBAL_ATTRIBUTE17 := FND_API.G_MISS_CHAR;
996 l_rowtype_rec.GLOBAL_ATTRIBUTE18 := FND_API.G_MISS_CHAR;
997 l_rowtype_rec.GLOBAL_ATTRIBUTE19 := FND_API.G_MISS_CHAR;
998 l_rowtype_rec.GLOBAL_ATTRIBUTE2 := FND_API.G_MISS_CHAR;
999 l_rowtype_rec.GLOBAL_ATTRIBUTE20 := FND_API.G_MISS_CHAR;
1000 l_rowtype_rec.GLOBAL_ATTRIBUTE3 := FND_API.G_MISS_CHAR;
1001 l_rowtype_rec.GLOBAL_ATTRIBUTE4 := FND_API.G_MISS_CHAR;
1002 l_rowtype_rec.GLOBAL_ATTRIBUTE5 := FND_API.G_MISS_CHAR;
1003 l_rowtype_rec.GLOBAL_ATTRIBUTE6 := FND_API.G_MISS_CHAR;
1004 l_rowtype_rec.GLOBAL_ATTRIBUTE7 := FND_API.G_MISS_CHAR;
1005 l_rowtype_rec.GLOBAL_ATTRIBUTE8 := FND_API.G_MISS_CHAR;
1006 l_rowtype_rec.GLOBAL_ATTRIBUTE9 := FND_API.G_MISS_CHAR;
1007 l_rowtype_rec.GLOBAL_ATTRIBUTE_CATEGORY := FND_API.G_MISS_CHAR;
1008 l_rowtype_rec.HEADER_ID := FND_API.G_MISS_NUM;
1009 l_rowtype_rec.INVOICE_TO_CONTACT_ID := FND_API.G_MISS_NUM;
1010 l_rowtype_rec.INVOICE_TO_ORG_ID := FND_API.G_MISS_NUM;
1011 l_rowtype_rec.INVOICING_RULE_ID := FND_API.G_MISS_NUM;
1012 l_rowtype_rec.LAST_ACK_CODE := FND_API.G_MISS_CHAR;
1013 l_rowtype_rec.LAST_ACK_DATE := FND_API.G_MISS_DATE;
1014 l_rowtype_rec.LAST_UPDATED_BY := FND_API.G_MISS_NUM;
1015 l_rowtype_rec.LAST_UPDATE_DATE := FND_API.G_MISS_DATE;
1016 l_rowtype_rec.LAST_UPDATE_LOGIN := FND_API.G_MISS_NUM;
1017 l_rowtype_rec.LATEST_SCHEDULE_LIMIT := FND_API.G_MISS_NUM;
1018 l_rowtype_rec.LINE_SET_NAME := FND_API.G_MISS_CHAR;
1019 l_rowtype_rec.OPEN_FLAG := FND_API.G_MISS_CHAR;
1020 l_rowtype_rec.OPERATION := FND_API.G_MISS_CHAR;
1021 l_rowtype_rec.ORDERED_DATE := FND_API.G_MISS_DATE;
1022 l_rowtype_rec.ORDER_DATE_TYPE_CODE := FND_API.G_MISS_CHAR;
1023 l_rowtype_rec.ORDER_NUMBER := FND_API.G_MISS_NUM;
1024 l_rowtype_rec.ORDER_SOURCE_ID := FND_API.G_MISS_NUM;
1025 l_rowtype_rec.ORDER_TYPE_ID := FND_API.G_MISS_NUM;
1026 l_rowtype_rec.ORDER_CATEGORY_CODE := FND_API.G_MISS_CHAR;
1027 l_rowtype_rec.ORG_ID := FND_API.G_MISS_NUM;
1028 l_rowtype_rec.ORIG_SYS_DOCUMENT_REF := FND_API.G_MISS_CHAR;
1029 l_rowtype_rec.PACKING_INSTRUCTIONS := FND_API.G_MISS_CHAR;
1030 l_rowtype_rec.PARTIAL_SHIPMENTS_ALLOWED := FND_API.G_MISS_CHAR;
1031 l_rowtype_rec.PAYMENT_AMOUNT := FND_API.G_MISS_NUM;
1032 l_rowtype_rec.PAYMENT_TERM_ID := FND_API.G_MISS_NUM;
1033 l_rowtype_rec.PAYMENT_TYPE_CODE := FND_API.G_MISS_CHAR;
1034 l_rowtype_rec.PRICE_LIST_ID := FND_API.G_MISS_NUM;
1035 l_rowtype_rec.PRICE_REQUEST_CODE := FND_API.G_MISS_CHAR; -- PROMOTIONS SEP/01
1036 l_rowtype_rec.PRICING_DATE := FND_API.G_MISS_DATE;
1037 l_rowtype_rec.PROGRAM_APPLICATION_ID := FND_API.G_MISS_NUM;
1038 l_rowtype_rec.PROGRAM_ID := FND_API.G_MISS_NUM;
1039 l_rowtype_rec.PROGRAM_UPDATE_DATE := FND_API.G_MISS_DATE;
1040 l_rowtype_rec.REQUEST_DATE := FND_API.G_MISS_DATE;
1041 l_rowtype_rec.REQUEST_ID := FND_API.G_MISS_NUM;
1042 l_rowtype_rec.RETURN_REASON_CODE := FND_API.G_MISS_CHAR;
1043 l_rowtype_rec.upgraded_flag := FND_API.G_MISS_CHAR;
1044 l_rowtype_rec.RETURN_STATUS := FND_API.G_MISS_CHAR;
1045 l_rowtype_rec.SALESREP_ID := FND_API.G_MISS_NUM;
1046 l_rowtype_rec.SALES_CHANNEL_CODE := FND_API.G_MISS_CHAR;
1047 l_rowtype_rec.SHIPMENT_PRIORITY_CODE := FND_API.G_MISS_CHAR;
1048 l_rowtype_rec.SHIPPING_INSTRUCTIONS := FND_API.G_MISS_CHAR;
1049 l_rowtype_rec.SHIPPING_METHOD_CODE := FND_API.G_MISS_CHAR;
1050 l_rowtype_rec.SHIP_FROM_ORG_ID := FND_API.G_MISS_NUM;
1051 l_rowtype_rec.SHIP_TOLERANCE_ABOVE := FND_API.G_MISS_NUM;
1052 l_rowtype_rec.SHIP_TOLERANCE_BELOW := FND_API.G_MISS_NUM;
1053 l_rowtype_rec.SHIP_TO_CONTACT_ID := FND_API.G_MISS_NUM;
1054 l_rowtype_rec.SHIP_TO_ORG_ID := FND_API.G_MISS_NUM;
1055 l_rowtype_rec.SOLD_FROM_ORG_ID := FND_API.G_MISS_NUM;
1056 l_rowtype_rec.SOLD_TO_CONTACT_ID := FND_API.G_MISS_NUM;
1057 l_rowtype_rec.SOLD_TO_ORG_ID := FND_API.G_MISS_NUM;
1058 l_rowtype_rec.SOURCE_DOCUMENT_ID := FND_API.G_MISS_NUM;
1059 l_rowtype_rec.SOURCE_DOCUMENT_TYPE_ID := FND_API.G_MISS_NUM;
1060 l_rowtype_rec.TAX_EXEMPT_FLAG := FND_API.G_MISS_CHAR;
1061 l_rowtype_rec.TAX_EXEMPT_NUMBER := FND_API.G_MISS_CHAR;
1062 l_rowtype_rec.TAX_EXEMPT_REASON_CODE := FND_API.G_MISS_CHAR;
1063 l_rowtype_rec.TAX_POINT_CODE := FND_API.G_MISS_CHAR;
1064 l_rowtype_rec.TRANSACTIONAL_CURR_CODE := FND_API.G_MISS_CHAR;
1065 l_rowtype_rec.VERSION_NUMBER := FND_API.G_MISS_NUM;
1066 l_rowtype_rec.TP_ATTRIBUTE1 := FND_API.G_MISS_CHAR;
1067 l_rowtype_rec.TP_ATTRIBUTE10 := FND_API.G_MISS_CHAR;
1068 l_rowtype_rec.TP_ATTRIBUTE11 := FND_API.G_MISS_CHAR;
1069 l_rowtype_rec.TP_ATTRIBUTE12 := FND_API.G_MISS_CHAR;
1070 l_rowtype_rec.TP_ATTRIBUTE13 := FND_API.G_MISS_CHAR;
1071 l_rowtype_rec.TP_ATTRIBUTE14 := FND_API.G_MISS_CHAR;
1072 l_rowtype_rec.TP_ATTRIBUTE15 := FND_API.G_MISS_CHAR;
1073 l_rowtype_rec.TP_ATTRIBUTE2 := FND_API.G_MISS_CHAR;
1074 l_rowtype_rec.TP_ATTRIBUTE3 := FND_API.G_MISS_CHAR;
1075 l_rowtype_rec.TP_ATTRIBUTE4 := FND_API.G_MISS_CHAR;
1076 l_rowtype_rec.TP_ATTRIBUTE5 := FND_API.G_MISS_CHAR;
1077 l_rowtype_rec.TP_ATTRIBUTE6 := FND_API.G_MISS_CHAR;
1078 l_rowtype_rec.TP_ATTRIBUTE7 := FND_API.G_MISS_CHAR;
1079 l_rowtype_rec.TP_ATTRIBUTE8 := FND_API.G_MISS_CHAR;
1080 l_rowtype_rec.TP_ATTRIBUTE9 := FND_API.G_MISS_CHAR;
1081 l_rowtype_rec.TP_CONTEXT := FND_API.G_MISS_CHAR;
1082
1083 --QUOTING changes
1084 l_rowtype_rec.TRANSACTION_PHASE_CODE := FND_API.G_MISS_CHAR;
1085 l_rowtype_rec.USER_STATUS_CODE := FND_API.G_MISS_CHAR;
1086 l_rowtype_rec.QUOTE_NUMBER := FND_API.G_MISS_NUM;
1087 l_rowtype_rec.QUOTE_DATE := FND_API.G_MISS_DATE;
1088 l_rowtype_rec.SALES_DOCUMENT_NAME := FND_API.G_MISS_CHAR;
1089 l_rowtype_rec.SOLD_TO_SITE_USE_ID := FND_API.G_MISS_NUM;
1090 l_rowtype_rec.SOURCE_DOCUMENT_VERSION_NUMBER := FND_API.G_MISS_NUM;
1091 l_rowtype_rec.DRAFT_SUBMITTED_FLAG := FND_API.G_MISS_CHAR;
1092 -- QUOTING changes END
1093 --Key Transaction Dates
1094 l_rowtype_rec.order_firmed_date := FND_API.G_MISS_DATE;
1095
1096 RETURN l_rowtype_rec;
1097
1098 EXCEPTION
1099
1100 WHEN OTHERS THEN
1101 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1102 THEN
1103 OE_MSG_PUB.Add_Exc_Msg
1104 ( G_PKG_NAME
1105 , 'G_MISS_OE_AK_HEADER_REC'
1106 );
1107 END IF;
1108 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1109
1110 END G_MISS_OE_AK_HEADER_REC;
1111
1112 PROCEDURE API_Rec_To_Rowtype_Rec
1113 ( p_HEADER_rec IN OE_Order_PUB.HEADER_Rec_Type
1114 , x_rowtype_rec IN OUT NOCOPY OE_AK_ORDER_HEADERS_V%ROWTYPE
1115 ) IS
1116 BEGIN
1117
1118 x_rowtype_rec.ACCOUNTING_RULE_ID := p_header_rec.ACCOUNTING_RULE_ID;
1119 x_rowtype_rec.ACCOUNTING_RULE_DURATION := p_header_rec.ACCOUNTING_RULE_DURATION;
1120 x_rowtype_rec.AGREEMENT_ID := p_header_rec.AGREEMENT_ID;
1121 x_rowtype_rec.ATTRIBUTE1 := p_header_rec.ATTRIBUTE1;
1122 x_rowtype_rec.ATTRIBUTE10 := p_header_rec.ATTRIBUTE10;
1123 x_rowtype_rec.ATTRIBUTE11 := p_header_rec.ATTRIBUTE11;
1124 x_rowtype_rec.ATTRIBUTE12 := p_header_rec.ATTRIBUTE12;
1125 x_rowtype_rec.ATTRIBUTE13 := p_header_rec.ATTRIBUTE13;
1126 x_rowtype_rec.ATTRIBUTE14 := p_header_rec.ATTRIBUTE14;
1127 x_rowtype_rec.ATTRIBUTE15 := p_header_rec.ATTRIBUTE15;
1128 x_rowtype_rec.ATTRIBUTE16 := p_header_rec.ATTRIBUTE16; --For bug 2184255
1129 x_rowtype_rec.ATTRIBUTE17 := p_header_rec.ATTRIBUTE17;
1130 x_rowtype_rec.ATTRIBUTE18 := p_header_rec.ATTRIBUTE18;
1131 x_rowtype_rec.ATTRIBUTE19 := p_header_rec.ATTRIBUTE19;
1132 x_rowtype_rec.ATTRIBUTE2 := p_header_rec.ATTRIBUTE2;
1133 x_rowtype_rec.ATTRIBUTE20 := p_header_rec.ATTRIBUTE20;
1134 x_rowtype_rec.ATTRIBUTE3 := p_header_rec.ATTRIBUTE3;
1135 x_rowtype_rec.ATTRIBUTE4 := p_header_rec.ATTRIBUTE4;
1136 x_rowtype_rec.ATTRIBUTE5 := p_header_rec.ATTRIBUTE5;
1137 x_rowtype_rec.ATTRIBUTE6 := p_header_rec.ATTRIBUTE6;
1138 x_rowtype_rec.ATTRIBUTE7 := p_header_rec.ATTRIBUTE7;
1139 x_rowtype_rec.ATTRIBUTE8 := p_header_rec.ATTRIBUTE8;
1140 x_rowtype_rec.ATTRIBUTE9 := p_header_rec.ATTRIBUTE9;
1141 x_rowtype_rec.upgraded_flag := p_header_rec.upgraded_flag;
1142 x_rowtype_rec.BLANKET_NUMBER := p_header_rec.BLANKET_NUMBER;
1143 x_rowtype_rec.BOOKED_FLAG := p_header_rec.BOOKED_FLAG;
1144 x_rowtype_rec.BOOKED_DATE := p_header_rec.BOOKED_DATE;
1145 x_rowtype_rec.CANCELLED_FLAG := p_header_rec.CANCELLED_FLAG;
1146 x_rowtype_rec.CHANGE_COMMENTS := p_header_rec.CHANGE_COMMENTS;
1147 x_rowtype_rec.CHANGE_REASON := p_header_rec.CHANGE_REASON;
1148 x_rowtype_rec.CHECK_NUMBER := p_header_rec.CHECK_NUMBER;
1149 x_rowtype_rec.CONTEXT := p_header_rec.CONTEXT;
1150 x_rowtype_rec.CONVERSION_RATE := p_header_rec.CONVERSION_RATE;
1151 x_rowtype_rec.CONVERSION_RATE_DATE := p_header_rec.CONVERSION_RATE_DATE;
1152 x_rowtype_rec.CONVERSION_TYPE_CODE := p_header_rec.CONVERSION_TYPE_CODE;
1153 x_rowtype_rec.CUSTOMER_PREFERENCE_SET_CODE := p_header_rec.CUSTOMER_PREFERENCE_SET_CODE;
1154 x_rowtype_rec.CREATED_BY := p_header_rec.CREATED_BY;
1155 x_rowtype_rec.CREATION_DATE := p_header_rec.CREATION_DATE;
1156 x_rowtype_rec.CREDIT_CARD_APPROVAL_CODE := p_header_rec.CREDIT_CARD_APPROVAL_CODE;
1157 x_rowtype_rec.CREDIT_CARD_CODE := p_header_rec.CREDIT_CARD_CODE;
1158 x_rowtype_rec.CREDIT_CARD_EXPIRATION_DATE := p_header_rec.CREDIT_CARD_EXPIRATION_DATE;
1159 x_rowtype_rec.CREDIT_CARD_APPROVAL_DATE := p_header_rec.CREDIT_CARD_APPROVAL_DATE;
1160 x_rowtype_rec.CREDIT_CARD_HOLDER_NAME := p_header_rec.CREDIT_CARD_HOLDER_NAME;
1161 x_rowtype_rec.CREDIT_CARD_NUMBER := p_header_rec.CREDIT_CARD_NUMBER;
1162 x_rowtype_rec.CUST_PO_NUMBER := p_header_rec.CUST_PO_NUMBER;
1163 x_rowtype_rec.DEFAULT_FULFILLMENT_SET := p_header_rec.DEFAULT_FULFILLMENT_SET;
1164 x_rowtype_rec.DB_FLAG := p_header_rec.DB_FLAG;
1165 x_rowtype_rec.DELIVER_TO_CONTACT_ID := p_header_rec.DELIVER_TO_CONTACT_ID;
1166 x_rowtype_rec.DELIVER_TO_ORG_ID := p_header_rec.DELIVER_TO_ORG_ID;
1167 x_rowtype_rec.DEMAND_CLASS_CODE := p_header_rec.DEMAND_CLASS_CODE;
1168 x_rowtype_rec.EARLIEST_SCHEDULE_LIMIT := p_header_rec.EARLIEST_SCHEDULE_LIMIT;
1169 x_rowtype_rec.EXPIRATION_DATE := p_header_rec.EXPIRATION_DATE;
1170 x_rowtype_rec.FIRST_ACK_CODE := p_header_rec.FIRST_ACK_CODE;
1171 x_rowtype_rec.FIRST_ACK_DATE := p_header_rec.FIRST_ACK_DATE;
1172 x_rowtype_rec.FOB_POINT_CODE := p_header_rec.FOB_POINT_CODE;
1173 x_rowtype_rec.FREIGHT_CARRIER_CODE := p_header_rec.FREIGHT_CARRIER_CODE;
1174 x_rowtype_rec.FREIGHT_TERMS_CODE := p_header_rec.FREIGHT_TERMS_CODE;
1175 x_rowtype_rec.FULFILLMENT_SET_NAME := p_header_rec.FULFILLMENT_SET_NAME;
1176 x_rowtype_rec.GLOBAL_ATTRIBUTE1 := p_header_rec.GLOBAL_ATTRIBUTE1;
1177 x_rowtype_rec.GLOBAL_ATTRIBUTE10 := p_header_rec.GLOBAL_ATTRIBUTE10;
1178 x_rowtype_rec.GLOBAL_ATTRIBUTE11 := p_header_rec.GLOBAL_ATTRIBUTE11;
1179 x_rowtype_rec.GLOBAL_ATTRIBUTE12 := p_header_rec.GLOBAL_ATTRIBUTE12;
1180 x_rowtype_rec.GLOBAL_ATTRIBUTE13 := p_header_rec.GLOBAL_ATTRIBUTE13;
1181 x_rowtype_rec.GLOBAL_ATTRIBUTE14 := p_header_rec.GLOBAL_ATTRIBUTE14;
1182 x_rowtype_rec.GLOBAL_ATTRIBUTE15 := p_header_rec.GLOBAL_ATTRIBUTE15;
1183 x_rowtype_rec.GLOBAL_ATTRIBUTE16 := p_header_rec.GLOBAL_ATTRIBUTE16;
1184 x_rowtype_rec.GLOBAL_ATTRIBUTE17 := p_header_rec.GLOBAL_ATTRIBUTE17;
1185 x_rowtype_rec.GLOBAL_ATTRIBUTE18 := p_header_rec.GLOBAL_ATTRIBUTE18;
1186 x_rowtype_rec.GLOBAL_ATTRIBUTE19 := p_header_rec.GLOBAL_ATTRIBUTE19;
1187 x_rowtype_rec.GLOBAL_ATTRIBUTE2 := p_header_rec.GLOBAL_ATTRIBUTE2;
1188 x_rowtype_rec.GLOBAL_ATTRIBUTE20 := p_header_rec.GLOBAL_ATTRIBUTE20;
1189 x_rowtype_rec.GLOBAL_ATTRIBUTE3 := p_header_rec.GLOBAL_ATTRIBUTE3;
1190 x_rowtype_rec.GLOBAL_ATTRIBUTE4 := p_header_rec.GLOBAL_ATTRIBUTE4;
1191 x_rowtype_rec.GLOBAL_ATTRIBUTE5 := p_header_rec.GLOBAL_ATTRIBUTE5;
1192 x_rowtype_rec.GLOBAL_ATTRIBUTE6 := p_header_rec.GLOBAL_ATTRIBUTE6;
1193 x_rowtype_rec.GLOBAL_ATTRIBUTE7 := p_header_rec.GLOBAL_ATTRIBUTE7;
1194 x_rowtype_rec.GLOBAL_ATTRIBUTE8 := p_header_rec.GLOBAL_ATTRIBUTE8;
1195 x_rowtype_rec.GLOBAL_ATTRIBUTE9 := p_header_rec.GLOBAL_ATTRIBUTE9;
1196 x_rowtype_rec.GLOBAL_ATTRIBUTE_CATEGORY := p_header_rec.GLOBAL_ATTRIBUTE_CATEGORY;
1197 x_rowtype_rec.HEADER_ID := p_header_rec.HEADER_ID;
1198 x_rowtype_rec.INVOICE_TO_CONTACT_ID := p_header_rec.INVOICE_TO_CONTACT_ID;
1199 x_rowtype_rec.INVOICE_TO_ORG_ID := p_header_rec.INVOICE_TO_ORG_ID;
1200 x_rowtype_rec.INVOICING_RULE_ID := p_header_rec.INVOICING_RULE_ID;
1201 x_rowtype_rec.LAST_ACK_CODE := p_header_rec.LAST_ACK_CODE;
1202 x_rowtype_rec.LAST_ACK_DATE := p_header_rec.LAST_ACK_DATE;
1203 x_rowtype_rec.LAST_UPDATED_BY := p_header_rec.LAST_UPDATED_BY;
1204 x_rowtype_rec.LAST_UPDATE_DATE := p_header_rec.LAST_UPDATE_DATE;
1205 x_rowtype_rec.LAST_UPDATE_LOGIN := p_header_rec.LAST_UPDATE_LOGIN;
1206 x_rowtype_rec.LATEST_SCHEDULE_LIMIT := p_header_rec.LATEST_SCHEDULE_LIMIT;
1207 x_rowtype_rec.LINE_SET_NAME := p_header_rec.LINE_SET_NAME;
1208 x_rowtype_rec.OPEN_FLAG := p_header_rec.OPEN_FLAG;
1209 x_rowtype_rec.OPERATION := p_header_rec.OPERATION;
1210 x_rowtype_rec.ORDERED_DATE := p_header_rec.ORDERED_DATE;
1211 x_rowtype_rec.ORDER_DATE_TYPE_CODE := p_header_rec.ORDER_DATE_TYPE_CODE;
1212 x_rowtype_rec.ORDER_NUMBER := p_header_rec.ORDER_NUMBER;
1213 x_rowtype_rec.ORDER_SOURCE_ID := p_header_rec.ORDER_SOURCE_ID;
1214 x_rowtype_rec.ORDER_TYPE_ID := p_header_rec.ORDER_TYPE_ID;
1215 x_rowtype_rec.ORDER_CATEGORY_CODE := p_header_rec.ORDER_CATEGORY_CODE;
1216 x_rowtype_rec.ORG_ID := p_header_rec.ORG_ID;
1217 x_rowtype_rec.ORIG_SYS_DOCUMENT_REF := p_header_rec.ORIG_SYS_DOCUMENT_REF;
1218 x_rowtype_rec.PACKING_INSTRUCTIONS := p_header_rec.PACKING_INSTRUCTIONS;
1219 x_rowtype_rec.PARTIAL_SHIPMENTS_ALLOWED := p_header_rec.PARTIAL_SHIPMENTS_ALLOWED;
1220 x_rowtype_rec.PAYMENT_AMOUNT := p_header_rec.PAYMENT_AMOUNT;
1221 x_rowtype_rec.PAYMENT_TERM_ID := p_header_rec.PAYMENT_TERM_ID;
1222 x_rowtype_rec.PAYMENT_TYPE_CODE := p_header_rec.PAYMENT_TYPE_CODE;
1223 x_rowtype_rec.PRICE_LIST_ID := p_header_rec.PRICE_LIST_ID;
1224 x_rowtype_rec.PRICE_REQUEST_CODE := p_header_rec.PRICE_REQUEST_CODE; -- PROMOTIONS SEP/01
1225 x_rowtype_rec.PRICING_DATE := p_header_rec.PRICING_DATE;
1226 x_rowtype_rec.PROGRAM_APPLICATION_ID := p_header_rec.PROGRAM_APPLICATION_ID;
1227 x_rowtype_rec.PROGRAM_ID := p_header_rec.PROGRAM_ID;
1228 x_rowtype_rec.PROGRAM_UPDATE_DATE := p_header_rec.PROGRAM_UPDATE_DATE;
1229 x_rowtype_rec.REQUEST_DATE := p_header_rec.REQUEST_DATE;
1230 x_rowtype_rec.REQUEST_ID := p_header_rec.REQUEST_ID;
1231 x_rowtype_rec.RETURN_REASON_CODE := p_header_rec.RETURN_REASON_CODE;
1232 x_rowtype_rec.RETURN_STATUS := p_header_rec.RETURN_STATUS;
1233 x_rowtype_rec.SALESREP_ID := p_header_rec.SALESREP_ID;
1234 x_rowtype_rec.SALES_CHANNEL_CODE := p_header_rec.SALES_CHANNEL_CODE;
1235 x_rowtype_rec.SHIPMENT_PRIORITY_CODE := p_header_rec.SHIPMENT_PRIORITY_CODE;
1236 x_rowtype_rec.SHIPPING_INSTRUCTIONS := p_header_rec.SHIPPING_INSTRUCTIONS;
1237 x_rowtype_rec.SHIPPING_METHOD_CODE := p_header_rec.SHIPPING_METHOD_CODE;
1238 x_rowtype_rec.SHIP_FROM_ORG_ID := p_header_rec.SHIP_FROM_ORG_ID;
1239 x_rowtype_rec.SHIP_TOLERANCE_ABOVE := p_header_rec.SHIP_TOLERANCE_ABOVE;
1240 x_rowtype_rec.SHIP_TOLERANCE_BELOW := p_header_rec.SHIP_TOLERANCE_BELOW;
1241 x_rowtype_rec.SHIP_TO_CONTACT_ID := p_header_rec.SHIP_TO_CONTACT_ID;
1242 x_rowtype_rec.SHIP_TO_ORG_ID := p_header_rec.SHIP_TO_ORG_ID;
1243 x_rowtype_rec.SOLD_FROM_ORG_ID := p_header_rec.SOLD_FROM_ORG_ID;
1244 x_rowtype_rec.SOLD_TO_CONTACT_ID := p_header_rec.SOLD_TO_CONTACT_ID;
1245 x_rowtype_rec.SOLD_TO_ORG_ID := p_header_rec.SOLD_TO_ORG_ID;
1246 x_rowtype_rec.SOURCE_DOCUMENT_ID := p_header_rec.SOURCE_DOCUMENT_ID;
1247 x_rowtype_rec.SOURCE_DOCUMENT_TYPE_ID := p_header_rec.SOURCE_DOCUMENT_TYPE_ID;
1248 x_rowtype_rec.TAX_EXEMPT_FLAG := p_header_rec.TAX_EXEMPT_FLAG;
1249 x_rowtype_rec.TAX_EXEMPT_NUMBER := p_header_rec.TAX_EXEMPT_NUMBER;
1250 x_rowtype_rec.TAX_EXEMPT_REASON_CODE := p_header_rec.TAX_EXEMPT_REASON_CODE;
1251 x_rowtype_rec.TAX_POINT_CODE := p_header_rec.TAX_POINT_CODE;
1252 x_rowtype_rec.TRANSACTIONAL_CURR_CODE := p_header_rec.TRANSACTIONAL_CURR_CODE;
1253 x_rowtype_rec.VERSION_NUMBER := p_header_rec.VERSION_NUMBER;
1254 x_rowtype_rec.FLOW_STATUS_CODE := p_header_rec.FLOW_STATUS_CODE;
1255 x_rowtype_rec.TP_ATTRIBUTE1 := p_header_rec.TP_ATTRIBUTE1;
1256 x_rowtype_rec.TP_ATTRIBUTE10 := p_header_rec.TP_ATTRIBUTE10;
1257 x_rowtype_rec.TP_ATTRIBUTE11 := p_header_rec.TP_ATTRIBUTE11;
1258 x_rowtype_rec.TP_ATTRIBUTE12 := p_header_rec.TP_ATTRIBUTE12;
1259 x_rowtype_rec.TP_ATTRIBUTE13 := p_header_rec.TP_ATTRIBUTE13;
1260 x_rowtype_rec.TP_ATTRIBUTE14 := p_header_rec.TP_ATTRIBUTE14;
1261 x_rowtype_rec.TP_ATTRIBUTE15 := p_header_rec.TP_ATTRIBUTE15;
1262 x_rowtype_rec.TP_ATTRIBUTE2 := p_header_rec.TP_ATTRIBUTE2;
1263 x_rowtype_rec.TP_ATTRIBUTE3 := p_header_rec.TP_ATTRIBUTE3;
1264 x_rowtype_rec.TP_ATTRIBUTE4 := p_header_rec.TP_ATTRIBUTE4;
1265 x_rowtype_rec.TP_ATTRIBUTE5 := p_header_rec.TP_ATTRIBUTE5;
1266 x_rowtype_rec.TP_ATTRIBUTE6 := p_header_rec.TP_ATTRIBUTE6;
1267 x_rowtype_rec.TP_ATTRIBUTE7 := p_header_rec.TP_ATTRIBUTE7;
1268 x_rowtype_rec.TP_ATTRIBUTE8 := p_header_rec.TP_ATTRIBUTE8;
1269 x_rowtype_rec.TP_ATTRIBUTE9 := p_header_rec.TP_ATTRIBUTE9;
1270 x_rowtype_rec.TP_CONTEXT := p_header_rec.TP_CONTEXT;
1271
1272 -- QUOTING changes
1273 x_rowtype_rec.quote_date := p_header_rec.quote_date;
1274 x_rowtype_rec.quote_number := p_header_rec.quote_number;
1275 x_rowtype_rec.sales_document_name := p_header_rec.sales_document_name;
1276 x_rowtype_rec.transaction_phase_code := p_header_rec.transaction_phase_code;
1277 x_rowtype_rec.user_status_code := p_header_rec.user_status_code;
1278 x_rowtype_rec.draft_submitted_flag := p_header_rec.draft_submitted_flag;
1279 x_rowtype_rec.source_document_version_number := p_header_rec.source_document_version_number;
1280 x_rowtype_rec.sold_to_site_use_id := p_header_rec.sold_to_site_use_id;
1281 -- QUOTING changes END
1282 x_rowtype_rec.IB_OWNER := p_header_rec.IB_OWNER;
1283 x_rowtype_rec.IB_INSTALLED_AT_LOCATION := p_header_rec.IB_INSTALLED_AT_LOCATION;
1284 x_rowtype_rec.IB_CURRENT_LOCATION := p_header_rec.IB_CURRENT_LOCATION;
1285 x_rowtype_rec.END_CUSTOMER_ID := p_header_rec.END_CUSTOMER_ID;
1286 x_rowtype_rec.END_CUSTOMER_CONTACT_ID := p_header_rec.END_CUSTOMER_CONTACT_ID;
1287 x_rowtype_rec.END_CUSTOMER_SITE_USE_ID := p_header_rec.END_CUSTOMER_SITE_USE_ID;
1288 x_rowtype_rec.CUSTOMER_SIGNATURE := p_header_rec.CUSTOMER_SIGNATURE;
1289 x_rowtype_rec.CUSTOMER_SIGNATURE_DATE := p_header_rec.CUSTOMER_SIGNATURE_DATE;
1290 x_rowtype_rec.SUPPLIER_SIGNATURE := p_header_rec.SUPPLIER_SIGNATURE;
1291 x_rowtype_rec.SUPPLIER_SIGNATURE_DATE := p_header_rec.SUPPLIER_SIGNATURE_DATE;
1292 --key Transaction Dates
1293 x_rowtype_rec.order_firmed_date := p_header_rec.order_firmed_date;
1294
1295 EXCEPTION
1296
1297 WHEN OTHERS THEN
1298 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1299 THEN
1300 OE_MSG_PUB.Add_Exc_Msg
1301 ( G_PKG_NAME
1302 , 'API_Rec_To_RowType_Rec'
1303 );
1304 END IF;
1305 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1306 END API_Rec_To_RowType_Rec;
1307
1308 PROCEDURE Rowtype_Rec_To_API_Rec
1309 ( p_record IN OE_AK_ORDER_HEADERS_V%ROWTYPE
1310 , x_api_rec IN OUT NOCOPY OE_Order_PUB.HEADER_Rec_Type
1311 ) IS
1312 BEGIN
1313
1314 x_api_rec.ACCOUNTING_RULE_ID := p_record.ACCOUNTING_RULE_ID;
1315 x_api_rec.ACCOUNTING_RULE_DURATION := p_record.ACCOUNTING_RULE_DURATION;
1316 x_api_rec.AGREEMENT_ID := p_record.AGREEMENT_ID;
1317 x_api_rec.ATTRIBUTE1 := p_record.ATTRIBUTE1;
1318 x_api_rec.ATTRIBUTE10 := p_record.ATTRIBUTE10;
1319 x_api_rec.ATTRIBUTE11 := p_record.ATTRIBUTE11;
1320 x_api_rec.ATTRIBUTE12 := p_record.ATTRIBUTE12;
1321 x_api_rec.ATTRIBUTE13 := p_record.ATTRIBUTE13;
1322 x_api_rec.ATTRIBUTE14 := p_record.ATTRIBUTE14;
1323 x_api_rec.ATTRIBUTE15 := p_record.ATTRIBUTE15;
1324 x_api_rec.ATTRIBUTE16 := p_record.ATTRIBUTE16; --For bug 2184255
1325 x_api_rec.ATTRIBUTE17 := p_record.ATTRIBUTE17;
1326 x_api_rec.ATTRIBUTE18 := p_record.ATTRIBUTE18;
1327 x_api_rec.ATTRIBUTE19 := p_record.ATTRIBUTE19;
1328 x_api_rec.ATTRIBUTE2 := p_record.ATTRIBUTE2;
1329 x_api_rec.ATTRIBUTE20 := p_record.ATTRIBUTE20;
1330 x_api_rec.ATTRIBUTE3 := p_record.ATTRIBUTE3;
1331 x_api_rec.ATTRIBUTE4 := p_record.ATTRIBUTE4;
1332 x_api_rec.ATTRIBUTE5 := p_record.ATTRIBUTE5;
1333 x_api_rec.ATTRIBUTE6 := p_record.ATTRIBUTE6;
1334 x_api_rec.ATTRIBUTE7 := p_record.ATTRIBUTE7;
1335 x_api_rec.ATTRIBUTE8 := p_record.ATTRIBUTE8;
1336 x_api_rec.ATTRIBUTE9 := p_record.ATTRIBUTE9;
1337 x_api_rec.BLANKET_NUMBER := p_record.BLANKET_NUMBER;
1338 x_api_rec.BOOKED_FLAG := p_record.BOOKED_FLAG;
1339 x_api_rec.BOOKED_DATE := p_record.BOOKED_DATE;
1340 x_api_rec.CANCELLED_FLAG := p_record.CANCELLED_FLAG;
1341 x_api_rec.CHANGE_COMMENTS := p_record.CHANGE_COMMENTS;
1342 x_api_rec.CHANGE_REASON := p_record.CHANGE_REASON;
1343 x_api_rec.CHECK_NUMBER := p_record.CHECK_NUMBER;
1344 x_api_rec.CONTEXT := p_record.CONTEXT;
1345 x_api_rec.CONVERSION_RATE := p_record.CONVERSION_RATE;
1346 x_api_rec.CONVERSION_RATE_DATE := p_record.CONVERSION_RATE_DATE;
1347 x_api_rec.CONVERSION_TYPE_CODE := p_record.CONVERSION_TYPE_CODE;
1348 x_api_rec.upgraded_flag := p_record.upgraded_flag;
1349 x_api_rec.CUSTOMER_PREFERENCE_SET_CODE := p_record.CUSTOMER_PREFERENCE_SET_CODE;
1350 x_api_rec.CREATED_BY := p_record.CREATED_BY;
1351 x_api_rec.CREATION_DATE := p_record.CREATION_DATE;
1352 x_api_rec.CREDIT_CARD_APPROVAL_CODE := p_record.CREDIT_CARD_APPROVAL_CODE;
1353 x_api_rec.CREDIT_CARD_CODE := p_record.CREDIT_CARD_CODE;
1354 x_api_rec.CREDIT_CARD_EXPIRATION_DATE := p_record.CREDIT_CARD_EXPIRATION_DATE;
1355 x_api_rec.CREDIT_CARD_APPROVAL_DATE := p_record.CREDIT_CARD_APPROVAL_DATE;
1356 x_api_rec.CREDIT_CARD_HOLDER_NAME := p_record.CREDIT_CARD_HOLDER_NAME;
1357 x_api_rec.CREDIT_CARD_NUMBER := p_record.CREDIT_CARD_NUMBER;
1358 x_api_rec.CUST_PO_NUMBER := p_record.CUST_PO_NUMBER;
1359 x_api_rec.DB_FLAG := p_record.DB_FLAG;
1360 x_api_rec.DEFAULT_FULFILLMENT_SET := p_record.DEFAULT_FULFILLMENT_SET;
1361 x_api_rec.DELIVER_TO_CONTACT_ID := p_record.DELIVER_TO_CONTACT_ID;
1362 x_api_rec.DELIVER_TO_ORG_ID := p_record.DELIVER_TO_ORG_ID;
1363 x_api_rec.DEMAND_CLASS_CODE := p_record.DEMAND_CLASS_CODE;
1364 x_api_rec.EARLIEST_SCHEDULE_LIMIT := p_record.EARLIEST_SCHEDULE_LIMIT;
1365 x_api_rec.EXPIRATION_DATE := p_record.EXPIRATION_DATE;
1366 x_api_rec.FIRST_ACK_CODE := p_record.FIRST_ACK_CODE;
1367 x_api_rec.FIRST_ACK_DATE := p_record.FIRST_ACK_DATE;
1368 x_api_rec.FOB_POINT_CODE := p_record.FOB_POINT_CODE;
1369 x_api_rec.FREIGHT_CARRIER_CODE := p_record.FREIGHT_CARRIER_CODE;
1370 x_api_rec.FREIGHT_TERMS_CODE := p_record.FREIGHT_TERMS_CODE;
1371 x_api_rec.FULFILLMENT_SET_NAME := p_record.FULFILLMENT_SET_NAME;
1372 x_api_rec.GLOBAL_ATTRIBUTE1 := p_record.GLOBAL_ATTRIBUTE1;
1373 x_api_rec.GLOBAL_ATTRIBUTE10 := p_record.GLOBAL_ATTRIBUTE10;
1374 x_api_rec.GLOBAL_ATTRIBUTE11 := p_record.GLOBAL_ATTRIBUTE11;
1375 x_api_rec.GLOBAL_ATTRIBUTE12 := p_record.GLOBAL_ATTRIBUTE12;
1376 x_api_rec.GLOBAL_ATTRIBUTE13 := p_record.GLOBAL_ATTRIBUTE13;
1377 x_api_rec.GLOBAL_ATTRIBUTE14 := p_record.GLOBAL_ATTRIBUTE14;
1378 x_api_rec.GLOBAL_ATTRIBUTE15 := p_record.GLOBAL_ATTRIBUTE15;
1379 x_api_rec.GLOBAL_ATTRIBUTE16 := p_record.GLOBAL_ATTRIBUTE16;
1380 x_api_rec.GLOBAL_ATTRIBUTE17 := p_record.GLOBAL_ATTRIBUTE17;
1381 x_api_rec.GLOBAL_ATTRIBUTE18 := p_record.GLOBAL_ATTRIBUTE18;
1382 x_api_rec.GLOBAL_ATTRIBUTE19 := p_record.GLOBAL_ATTRIBUTE19;
1383 x_api_rec.GLOBAL_ATTRIBUTE2 := p_record.GLOBAL_ATTRIBUTE2;
1384 x_api_rec.GLOBAL_ATTRIBUTE20 := p_record.GLOBAL_ATTRIBUTE20;
1385 x_api_rec.GLOBAL_ATTRIBUTE3 := p_record.GLOBAL_ATTRIBUTE3;
1386 x_api_rec.GLOBAL_ATTRIBUTE4 := p_record.GLOBAL_ATTRIBUTE4;
1387 x_api_rec.GLOBAL_ATTRIBUTE5 := p_record.GLOBAL_ATTRIBUTE5;
1388 x_api_rec.GLOBAL_ATTRIBUTE6 := p_record.GLOBAL_ATTRIBUTE6;
1389 x_api_rec.GLOBAL_ATTRIBUTE7 := p_record.GLOBAL_ATTRIBUTE7;
1390 x_api_rec.GLOBAL_ATTRIBUTE8 := p_record.GLOBAL_ATTRIBUTE8;
1391 x_api_rec.GLOBAL_ATTRIBUTE9 := p_record.GLOBAL_ATTRIBUTE9;
1392 x_api_rec.GLOBAL_ATTRIBUTE_CATEGORY := p_record.GLOBAL_ATTRIBUTE_CATEGORY;
1393 x_api_rec.HEADER_ID := p_record.HEADER_ID;
1394 x_api_rec.INVOICE_TO_CONTACT_ID := p_record.INVOICE_TO_CONTACT_ID;
1395 x_api_rec.INVOICE_TO_ORG_ID := p_record.INVOICE_TO_ORG_ID;
1396 x_api_rec.INVOICING_RULE_ID := p_record.INVOICING_RULE_ID;
1397 x_api_rec.LAST_ACK_CODE := p_record.LAST_ACK_CODE;
1398 x_api_rec.LAST_ACK_DATE := p_record.LAST_ACK_DATE;
1399 x_api_rec.LAST_UPDATED_BY := p_record.LAST_UPDATED_BY;
1400 x_api_rec.LAST_UPDATE_DATE := p_record.LAST_UPDATE_DATE;
1401 x_api_rec.LAST_UPDATE_LOGIN := p_record.LAST_UPDATE_LOGIN;
1402 x_api_rec.LATEST_SCHEDULE_LIMIT := p_record.LATEST_SCHEDULE_LIMIT;
1403 x_api_rec.LINE_SET_NAME := p_record.LINE_SET_NAME;
1404 x_api_rec.OPEN_FLAG := p_record.OPEN_FLAG;
1405 x_api_rec.OPERATION := p_record.OPERATION;
1406 x_api_rec.ORDERED_DATE := p_record.ORDERED_DATE;
1407 x_api_rec.ORDER_DATE_TYPE_CODE := p_record.ORDER_DATE_TYPE_CODE;
1408 x_api_rec.ORDER_NUMBER := p_record.ORDER_NUMBER;
1409 x_api_rec.ORDER_SOURCE_ID := p_record.ORDER_SOURCE_ID;
1410 x_api_rec.ORDER_TYPE_ID := p_record.ORDER_TYPE_ID;
1411 x_api_rec.ORDER_CATEGORY_CODE := p_record.ORDER_CATEGORY_CODE;
1412 x_api_rec.ORG_ID := p_record.ORG_ID;
1413 x_api_rec.ORIG_SYS_DOCUMENT_REF := p_record.ORIG_SYS_DOCUMENT_REF;
1414 x_api_rec.PACKING_INSTRUCTIONS := p_record.PACKING_INSTRUCTIONS;
1415 x_api_rec.PARTIAL_SHIPMENTS_ALLOWED := p_record.PARTIAL_SHIPMENTS_ALLOWED;
1416 x_api_rec.PAYMENT_AMOUNT := p_record.PAYMENT_AMOUNT;
1417 x_api_rec.PAYMENT_TERM_ID := p_record.PAYMENT_TERM_ID;
1418 x_api_rec.PAYMENT_TYPE_CODE := p_record.PAYMENT_TYPE_CODE;
1419 x_api_rec.PRICE_LIST_ID := p_record.PRICE_LIST_ID;
1420 x_api_rec.PRICE_REQUEST_CODE := p_record.PRICE_REQUEST_CODE; -- PROMOTIONS SEP/01
1421 x_api_rec.PRICING_DATE := p_record.PRICING_DATE;
1422 x_api_rec.PROGRAM_APPLICATION_ID := p_record.PROGRAM_APPLICATION_ID;
1423 x_api_rec.PROGRAM_ID := p_record.PROGRAM_ID;
1424 x_api_rec.PROGRAM_UPDATE_DATE := p_record.PROGRAM_UPDATE_DATE;
1425 x_api_rec.REQUEST_DATE := p_record.REQUEST_DATE;
1426 x_api_rec.REQUEST_ID := p_record.REQUEST_ID;
1427 x_api_rec.RETURN_REASON_CODE := p_record.RETURN_REASON_CODE;
1428 x_api_rec.RETURN_STATUS := p_record.RETURN_STATUS;
1429 x_api_rec.SALESREP_ID := p_record.SALESREP_ID;
1430 x_api_rec.SALES_CHANNEL_CODE := p_record.SALES_CHANNEL_CODE;
1431 x_api_rec.SHIPMENT_PRIORITY_CODE := p_record.SHIPMENT_PRIORITY_CODE;
1432 x_api_rec.SHIPPING_INSTRUCTIONS := p_record.SHIPPING_INSTRUCTIONS;
1433 x_api_rec.SHIPPING_METHOD_CODE := p_record.SHIPPING_METHOD_CODE;
1434 x_api_rec.SHIP_FROM_ORG_ID := p_record.SHIP_FROM_ORG_ID;
1435 x_api_rec.SHIP_TOLERANCE_ABOVE := p_record.SHIP_TOLERANCE_ABOVE;
1436 x_api_rec.SHIP_TOLERANCE_BELOW := p_record.SHIP_TOLERANCE_BELOW;
1437 x_api_rec.SHIP_TO_CONTACT_ID := p_record.SHIP_TO_CONTACT_ID;
1438 x_api_rec.SHIP_TO_ORG_ID := p_record.SHIP_TO_ORG_ID;
1439 x_api_rec.SOLD_FROM_ORG_ID := p_record.SOLD_FROM_ORG_ID;
1440 x_api_rec.SOLD_TO_CONTACT_ID := p_record.SOLD_TO_CONTACT_ID;
1441 x_api_rec.SOLD_TO_ORG_ID := p_record.SOLD_TO_ORG_ID;
1442 x_api_rec.SOURCE_DOCUMENT_ID := p_record.SOURCE_DOCUMENT_ID;
1443 x_api_rec.SOURCE_DOCUMENT_TYPE_ID := p_record.SOURCE_DOCUMENT_TYPE_ID;
1444 x_api_rec.TAX_EXEMPT_FLAG := p_record.TAX_EXEMPT_FLAG;
1445 x_api_rec.TAX_EXEMPT_NUMBER := p_record.TAX_EXEMPT_NUMBER;
1446 x_api_rec.TAX_EXEMPT_REASON_CODE := p_record.TAX_EXEMPT_REASON_CODE;
1447 x_api_rec.TAX_POINT_CODE := p_record.TAX_POINT_CODE;
1448 x_api_rec.TRANSACTIONAL_CURR_CODE := p_record.TRANSACTIONAL_CURR_CODE;
1449 x_api_rec.VERSION_NUMBER := p_record.VERSION_NUMBER;
1450 x_api_rec.FLOW_STATUS_CODE := p_record.FLOW_STATUS_CODE;
1451 x_api_rec.TP_ATTRIBUTE1 := p_record.TP_ATTRIBUTE1;
1452 x_api_rec.TP_ATTRIBUTE10 := p_record.TP_ATTRIBUTE10;
1453 x_api_rec.TP_ATTRIBUTE11 := p_record.TP_ATTRIBUTE11;
1454 x_api_rec.TP_ATTRIBUTE12 := p_record.TP_ATTRIBUTE12;
1455 x_api_rec.TP_ATTRIBUTE13 := p_record.TP_ATTRIBUTE13;
1456 x_api_rec.TP_ATTRIBUTE14 := p_record.TP_ATTRIBUTE14;
1457 x_api_rec.TP_ATTRIBUTE15 := p_record.TP_ATTRIBUTE15;
1458 x_api_rec.TP_ATTRIBUTE2 := p_record.TP_ATTRIBUTE2;
1459 x_api_rec.TP_ATTRIBUTE3 := p_record.TP_ATTRIBUTE3;
1460 x_api_rec.TP_ATTRIBUTE4 := p_record.TP_ATTRIBUTE4;
1461 x_api_rec.TP_ATTRIBUTE5 := p_record.TP_ATTRIBUTE5;
1462 x_api_rec.TP_ATTRIBUTE6 := p_record.TP_ATTRIBUTE6;
1463 x_api_rec.TP_ATTRIBUTE7 := p_record.TP_ATTRIBUTE7;
1464 x_api_rec.TP_ATTRIBUTE8 := p_record.TP_ATTRIBUTE8;
1465 x_api_rec.TP_ATTRIBUTE9 := p_record.TP_ATTRIBUTE9;
1466 x_api_rec.TP_CONTEXT := p_record.TP_CONTEXT;
1467
1468 -- QUOTING changes
1469 x_api_rec.quote_number := p_record.quote_number;
1470 x_api_rec.quote_date := p_record.quote_date;
1471 x_api_rec.sales_document_name := p_record.sales_document_name;
1472 x_api_rec.transaction_phase_code := p_record.transaction_phase_code;
1473 x_api_rec.user_status_code := p_record.user_status_code;
1474 x_api_rec.draft_submitted_flag := p_record.draft_submitted_flag;
1475 x_api_rec.source_document_version_number := p_record.source_document_version_number;
1476 x_api_rec.sold_to_site_use_id := p_record.sold_to_site_use_id;
1477 -- QUOTING changes END
1478 x_api_rec.IB_OWNER := p_record.IB_OWNER;
1479 x_api_rec.IB_INSTALLED_AT_LOCATION := p_record.IB_INSTALLED_AT_LOCATION;
1480 x_api_rec.IB_CURRENT_LOCATION := p_record.IB_CURRENT_LOCATION;
1481 x_api_rec.END_CUSTOMER_ID := p_record.END_CUSTOMER_ID;
1482 x_api_rec.END_CUSTOMER_CONTACT_ID := p_record.END_CUSTOMER_CONTACT_ID;
1483 x_api_rec.END_CUSTOMER_SITE_USE_ID := p_record.END_CUSTOMER_SITE_USE_ID;
1484 x_api_rec.CUSTOMER_SIGNATURE := p_record.CUSTOMER_SIGNATURE;
1485 x_api_rec.CUSTOMER_SIGNATURE_DATE := p_record.CUSTOMER_SIGNATURE_DATE;
1486 x_api_rec.SUPPLIER_SIGNATURE := p_record.SUPPLIER_SIGNATURE;
1487 x_api_rec.SUPPLIER_SIGNATURE_DATE := p_record.SUPPLIER_SIGNATURE_DATE;
1488 --key Transaction dates
1489 x_api_rec.order_firmed_date := p_record.order_firmed_date;
1490
1491 EXCEPTION
1492
1493 WHEN OTHERS THEN
1494 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1495 THEN
1496 OE_MSG_PUB.Add_Exc_Msg
1497 ( G_PKG_NAME
1498 , 'Rowtype_Rec_To_API_Rec'
1499 );
1500 END IF;
1501 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1502 END Rowtype_Rec_To_API_Rec;
1503
1504 -- Procedure Clear_Dependent_Attr: Overloaded for view%rowtype PARAMETERS
1505
1506 PROCEDURE Clear_Dependent_Attr
1507 ( p_attr_id IN NUMBER := FND_API.G_MISS_NUM
1508 , p_initial_header_rec IN OE_AK_ORDER_HEADERS_V%ROWTYPE
1509 , p_old_header_rec IN OE_AK_ORDER_HEADERS_V%ROWTYPE
1510 , p_x_header_rec IN OUT NOCOPY OE_AK_ORDER_HEADERS_V%ROWTYPE
1511 , p_x_instrument_id IN NUMBER DEFAULT NULL --R12 CC Encryption
1512 , p_old_instrument_id IN NUMBER DEFAULT NULL
1513 )
1514 IS
1515 l_index NUMBER :=0;
1516 l_src_attr_tbl OE_GLOBALS.NUMBER_Tbl_Type;
1517 BEGIN
1518
1519 oe_debug_pub.add('Entering OE_HEADER_UTIL.CLEAR_DEPENDENT_ATTR', 1);
1520
1521 IF p_attr_id <> FND_API.G_MISS_NUM THEN
1522
1523 l_index := l_index + 1.0;
1524 l_src_attr_tbl(l_index) := p_attr_id;
1525
1526 -- If attr_id is missing compare old and new records and for
1527 -- every changed attribute clear its dependent fields.
1528
1529 ELSE
1530
1531 IF NOT OE_GLOBALS.Equal(p_x_header_rec.agreement_id,p_old_header_rec.agreement_id)
1532 THEN
1533 l_index := l_index + 1.0;
1534 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_AGREEMENT;
1535 END IF;
1536
1537 IF NOT OE_GLOBALS.Equal(p_x_header_rec.deliver_to_org_id,p_old_header_rec.deliver_to_org_id)
1538 THEN
1539 l_index := l_index + 1.0;
1540 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_DELIVER_TO_ORG;
1541 END IF;
1542
1543 IF NOT OE_GLOBALS.Equal(p_x_header_rec.invoice_to_contact_id,p_old_header_rec.invoice_to_contact_id)
1544 THEN
1545 l_index := l_index + 1.0;
1546 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_INVOICE_TO_CONTACT;
1547 END IF;
1548
1549 IF NOT OE_GLOBALS.Equal(p_x_header_rec.invoice_to_org_id,p_old_header_rec.invoice_to_org_id)
1550 THEN
1551 l_index := l_index + 1.0;
1552 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_INVOICE_TO_ORG;
1553 END IF;
1554
1555 IF NOT OE_GLOBALS.Equal(p_x_header_rec.ordered_date,p_old_header_rec.ordered_date)
1556 THEN
1557 l_index := l_index + 1.0;
1558 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_ORDERED_DATE;
1559 END IF;
1560
1561 IF NOT OE_GLOBALS.Equal(p_x_header_rec.order_type_id,p_old_header_rec.order_type_id)
1562 THEN
1563 l_index := l_index + 1.0;
1564 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_ORDER_TYPE;
1565 END IF;
1566
1567 IF NOT OE_GLOBALS.Equal(p_x_header_rec.payment_type_code,p_old_header_rec.payment_type_code)
1568 THEN
1569 l_index := l_index + 1.0;
1570 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_PAYMENT_TYPE;
1571 END IF;
1572
1573 /* Fix Bug # 2297053: Clear attributes dependent on Credit Card Number */
1574 IF NOT OE_GLOBALS.Is_Same_Credit_Card(p_old_header_rec.credit_card_number,p_x_header_rec.credit_card_number,
1575 p_old_instrument_id,p_x_instrument_id)
1576 THEN
1577 l_index := l_index + 1.0;
1578 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_CREDIT_CARD_NUMBER;
1579 END IF;
1580
1581 IF NOT OE_GLOBALS.Equal(p_x_header_rec.price_list_id,p_old_header_rec.price_list_id)
1582 THEN
1583 l_index := l_index + 1.0;
1584 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_PRICE_LIST;
1585 END IF;
1586
1587 IF NOT OE_GLOBALS.Equal(p_x_header_rec.request_date,p_old_header_rec.request_date)
1588 THEN
1589 l_index := l_index + 1.0;
1590 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_REQUEST_DATE;
1591 END IF;
1592
1593 IF NOT OE_GLOBALS.Equal(p_x_header_rec.ship_from_org_id,p_old_header_rec.ship_from_org_id)
1594 THEN
1595 l_index := l_index + 1.0;
1596 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SHIP_FROM_ORG;
1597 END IF;
1598
1599 IF NOT OE_GLOBALS.Equal(p_x_header_rec.ship_to_contact_id,p_old_header_rec.ship_to_contact_id)
1600 THEN
1601 l_index := l_index + 1.0;
1602 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SHIP_TO_CONTACT;
1603 END IF;
1604
1605 IF NOT OE_GLOBALS.Equal(p_x_header_rec.ship_to_org_id,p_old_header_rec.ship_to_org_id)
1606 THEN
1607 l_index := l_index + 1.0;
1608 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SHIP_TO_ORG;
1609 END IF;
1610
1611 IF NOT OE_GLOBALS.Equal(p_x_header_rec.sold_to_org_id,p_old_header_rec.sold_to_org_id)
1612 THEN
1613 l_index := l_index + 1.0;
1614 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SOLD_TO_ORG;
1615 END IF;
1616
1617 IF NOT OE_GLOBALS.Equal(p_x_header_rec.sold_to_phone_id,p_old_header_rec.sold_to_phone_id)
1618 THEN
1619 l_index := l_index + 1.0;
1620 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SOLD_TO_PHONE;
1621 END IF;
1622
1623 IF NOT OE_GLOBALS.Equal(p_x_header_rec.tax_exempt_flag,p_old_header_rec.tax_exempt_flag)
1624 THEN
1625 l_index := l_index + 1.0;
1626 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_TAX_EXEMPT;
1627 END IF;
1628
1629 IF NOT OE_GLOBALS.Equal(p_x_header_rec.transactional_curr_code,p_old_header_rec.transactional_curr_code)
1630 THEN
1631 l_index := l_index + 1.0;
1632 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_TRANSACTIONAL_CURR;
1633 END IF;
1634
1635 IF NOT OE_GLOBALS.Equal(p_x_header_rec.blanket_number,p_old_header_rec.blanket_number)
1636 THEN
1637 l_index := l_index + 1.0;
1638 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_BLANKET_NUMBER;
1639 END IF;
1640
1641 -- QUOTING changes
1642 IF NOT OE_GLOBALS.Equal(p_x_header_rec.transaction_phase_code,p_old_header_rec.transaction_phase_code)
1643 THEN
1644 l_index := l_index + 1.0;
1645 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_TRANSACTION_PHASE;
1646 END IF;
1647 -- QUOTING changes END
1648
1649 --distributed order @
1650 IF NOT OE_GLOBALS.Equal(p_x_header_rec.end_customer_id,p_old_header_rec.end_customer_id)
1651 THEN
1652 l_index := l_index + 1.0;
1653 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_END_CUSTOMER;
1654 END IF;
1655
1656 -- bug 5127922
1657 IF NOT OE_GLOBALS.Equal(p_x_header_rec.sold_to_site_use_id,p_old_header_rec.sold_to_site_use_id)
1658 THEN
1659 l_index := l_index + 1.0;
1660 l_src_attr_tbl(l_index) := OE_HEADER_UTIL.G_SOLD_TO_SITE_USE;
1661 END IF;
1662
1663 END IF;
1664
1665 Clear_Dependents
1666 (p_src_attr_tbl => l_src_attr_tbl
1667 ,p_initial_header_rec => p_initial_header_rec
1668 ,p_old_header_rec => p_old_header_rec
1669 ,p_x_header_rec => p_x_header_rec
1670 ,p_x_instrument_id => p_x_instrument_id
1671 ,p_old_instrument_id => p_old_instrument_id);
1672 --bug 5083663
1673 --Need to reset the global flag for cc dependent attributes, so that they
1674 --can be cleared during the future calls when the cc is not selected
1675 --from the LOV.
1676 g_is_cc_selected_from_LOV := 'N';
1677
1678 oe_debug_pub.add('Exiting OE_HEADER_UTIL.CLEAR_DEPENDENT_ATTR', 1);
1679
1680 EXCEPTION
1681 WHEN FND_API.G_EXC_ERROR THEN
1682 RAISE FND_API.G_EXC_ERROR;
1683 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1684 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1685 WHEN OTHERS THEN
1686 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1687 THEN
1688 OE_MSG_PUB.Add_Exc_Msg
1689 ( G_PKG_NAME
1690 , 'Clear_Dependent_Attr'
1691 );
1692 END IF;
1693 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1694
1695 END Clear_Dependent_Attr;
1696
1697 PROCEDURE Clear_Dependent_Attr
1698 ( p_attr_id IN NUMBER := FND_API.G_MISS_NUM
1699 , p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
1700 , p_old_header_rec IN OE_Order_PUB.Header_Rec_Type :=
1701 OE_Order_PUB.G_MISS_HEADER_REC
1702 )
1703 IS
1704 l_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
1705 l_old_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
1706 l_initial_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
1707 BEGIN
1708 oe_debug_pub.add('Security code in Clear_dep_attr....'||p_x_header_rec.instrument_security_code);
1709 API_Rec_To_Rowtype_Rec(p_x_header_rec, l_header_rec);
1710 API_Rec_To_Rowtype_Rec(p_old_header_rec, l_old_header_rec);
1711
1712 l_initial_header_rec := l_header_rec;
1713
1714 Clear_Dependent_Attr
1715 (p_attr_id => p_attr_id
1716 ,p_initial_header_rec => l_initial_header_rec
1717 ,p_old_header_rec => l_old_header_rec
1718 ,p_x_header_rec => l_header_rec
1719 ,p_x_instrument_id => p_x_header_rec.cc_instrument_id
1720 ,p_old_instrument_id => p_old_header_rec.cc_instrument_id
1721 );
1722
1723 Rowtype_Rec_To_API_Rec(l_header_rec, p_x_header_rec);
1724
1725 END Clear_Dependent_Attr;
1726
1727 -- Procedure Apply_Attribute_Changes
1728
1729 PROCEDURE Apply_Attribute_Changes
1730 ( p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
1731 , p_old_header_rec IN OE_Order_PUB.Header_Rec_Type :=
1732 OE_Order_PUB.G_MISS_HEADER_REC
1733 )
1734 IS
1735 l_return_status VARCHAR2(1):= FND_API.G_RET_STS_SUCCESS;
1736
1737 l_verify_payment_flag VARCHAR2(30) := 'N';
1738 l_level VARCHAR2(10) ;
1739 l_copy_orig_price VARCHAR2(1):='Y';
1740 -- added by Renga for multiple payments
1741
1742 cursor payment_count_cur is
1743 select count(payment_type_code)
1744 from oe_payments
1745 where header_id = p_x_header_rec.header_id
1746 and line_id is null;
1747
1748 cursor delete_payment_count_cur is
1749 select count(payment_type_code)
1750 from oe_payments
1751 where header_id = p_x_header_rec.header_id
1752 and line_id is null
1753 and payment_type_code in ('CREDIT_CARD','ACH','DIRECT_DEBIT');
1754
1755 l_payments_upd_flag VARCHAR2(1) := 'N';
1756 l_delete_payment_count NUMBER :=0;
1757 l_payment_count number := 0;
1758 l_log_delete_payment_req VARCHAR2(1) := 'N';
1759
1760 BEGIN
1761
1762 oe_debug_pub.add('Entering OE_HEADER_UTIL.APPLY_ATTRIBUTE_CHANGES', 1);
1763
1764 -- Load out record
1765
1766 IF NOT OE_GLOBALS.Equal(p_x_header_rec.booked_flag,p_old_header_rec.booked_flag)
1767 THEN
1768 IF p_x_header_rec.booked_flag = 'Y' THEN
1769 p_x_header_rec.flow_status_code := 'BOOKED';
1770 END IF;
1771 END IF;
1772
1773 IF NOT OE_GLOBALS.Equal(p_x_header_rec.cancelled_flag,p_old_header_rec.cancelled_flag)
1774 THEN
1775 IF p_x_header_rec.cancelled_flag = 'Y' THEN
1776
1777 Oe_Sales_Can_Util.Check_Constraints(p_x_header_rec,
1778 p_old_header_rec,
1779 l_return_status);
1780 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1781 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1782 oe_debug_pub.ADD('Update Line Process Order return UNEXP_ERROR');
1783 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1784 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1785 oe_debug_pub.ADD('Update Line Process Order return RET_STS_ERROR');
1786 RAISE FND_API.G_EXC_ERROR;
1787 END IF;
1788 END IF;
1789
1790 --p_x_header_rec.flow_status_code := 'CANCELLED';
1791
1792 END IF; -- cancelled flag
1793
1794 END IF;
1795 oe_debug_pub.add('Raj1', 1);
1796 oe_debug_pub.add('Operation--'||p_x_header_rec.operation);
1797 oe_debug_pub.add('payment type--'||nvl(p_x_header_rec.payment_type_code,'xxx'));
1798 oe_debug_pub.add('Old inv to ...'||p_x_header_rec.invoice_to_org_id);
1799 oe_debug_pub.add('New inv to...'||p_old_header_rec.invoice_to_org_id);
1800
1801 IF NOT OE_GLOBALS.Equal(p_x_header_rec.invoice_to_org_id,p_old_header_rec.invoice_to_org_id)
1802 THEN
1803 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1804 --R12 CC Encryption
1805 --Delayed request for deleting the payments when
1806 --invoice to changes
1807 IF p_x_header_rec.payment_type_code in ('ACH','DIRECT_DEBIT','CREDIT_CARD') OR
1808 p_x_header_rec.payment_type_code IS NULL THEN --null for prepayments
1809 OPEN delete_payment_count_cur;
1810 FETCH delete_payment_count_cur into l_delete_payment_count;
1811 close delete_payment_count_cur;
1812 IF l_delete_payment_count > 0 THEN
1813 l_log_delete_payment_req := 'Y';
1814 END IF;
1815
1816 oe_debug_pub.add('Payment_type code in invoice to '||p_x_header_rec.payment_type_code);
1817 oe_debug_pub.add('Delete Payment Count count'||l_delete_payment_count);
1818 oe_debug_pub.add('Log delete payment req Flag'||l_log_delete_payment_req);
1819 IF l_log_delete_payment_req = 'Y' THEN
1820 OE_delayed_requests_Pvt.log_request
1821 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER_PAYMENT,
1822 p_entity_id => p_x_Header_rec.header_id,
1823 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1824 p_requesting_entity_id => p_x_Header_rec.header_id,
1825 p_request_type => OE_GLOBALS.G_DELETE_PAYMENTS,
1826 p_param1 => to_char(p_old_header_rec.invoice_to_org_id),
1827 x_return_status => l_return_status);
1828
1829 END IF;--Log delayed req.
1830 END IF;--Payment type code check for deleting payments
1831 --R12 CC Encryption
1832 IF p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
1833 oe_debug_pub.add('Log Verify Payment Delayed Request in Invoice To');
1834 -- Set Flag to Log a request for Verify Payment
1835 l_verify_payment_flag := 'Y';
1836 ELSE
1837 -- BUG 2114156
1838 oe_debug_pub.add('Call OE_CREDIT_CHECK_UTIL.GET_credit_check_level ');
1839 l_level := NULL ;
1840
1841 l_level :=
1842 OE_CREDIT_CHECK_UTIL.GET_credit_check_level
1843 ( p_calling_action => 'UPDATE'
1844 , p_order_type_id =>
1845 p_x_header_rec.order_type_id
1846 ) ;
1847 oe_debug_pub.add('l_level = '|| l_level );
1848
1849 IF l_level = 'ORDER'
1850 THEN
1851
1852
1853 -- Set Flag to Log a request for Verify Payment
1854 oe_debug_pub.add('Log Verify Payment Delayed Request in Invoice To - Credit Check');
1855 --
1856 l_verify_payment_flag := 'Y';
1857 END IF;
1858 END IF;
1859 END IF;--Operation - Update
1860 END IF;
1861 oe_debug_pub.add('Raj2', 1);
1862 oe_debug_pub.add('p_x_header_rec.open_flag:'||p_x_header_rec.open_flag);
1863 oe_debug_pub.add('p_old_header_rec.open_flag:'||p_old_header_rec.open_flag);
1864
1865
1866 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.open_flag,
1867 p_old_header_rec.open_flag)) OR
1868 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
1869 p_x_header_rec.open_flag IS NOT NULL)
1870 --OR cnd for bug 5060064
1871 THEN
1872 IF p_x_header_rec.open_flag = 'N' THEN
1873 p_x_header_rec.flow_status_code := 'CLOSED';
1874 IF p_x_header_rec.cancelled_flag = 'Y' THEN
1875 --p_x_header_rec.flow_status_code := 'CANCELLED';
1876 null;
1877 END IF;
1878 END IF;
1879
1880 END IF;
1881
1882 IF NOT OE_GLOBALS.Equal(p_x_header_rec.order_type_id,p_old_header_rec.order_type_id)
1883 THEN
1884
1885 -- If the Order Type has changed, we need to sync up the
1886 -- MTL_SALES_ORDERS table.
1887 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1888
1889
1890 IF p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
1891
1892 -- Set Flag to Log a request for Verify Payment
1893 oe_debug_pub.add('Log Verify Payment Delayed Request in Order Type');
1894 l_verify_payment_flag := 'Y';
1895 ELSE
1896
1897 /* Additional Task - If the payment type is not CREDIT CARD ,
1898 then also log the delayed request for Verify payment if the
1899 Order is booked */
1900
1901 IF p_x_header_rec.booked_flag ='Y'
1902 THEN
1903
1904 oe_debug_pub.add('Log Verify Payment Delayed Request in Order Type',3);
1905 l_verify_payment_flag := 'Y';
1906
1907 END IF;
1908
1909 END IF;
1910 END IF;
1911 END IF;
1912
1913 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.salesrep_id,
1914 p_old_header_rec.salesrep_id)) OR
1915 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
1916 p_x_header_rec.salesrep_id IS NOT NULL )
1917 --OR condition added for bug 5060064
1918 THEN
1919
1920 IF NOT (nvl(p_x_header_rec.source_document_type_id,-99) = 2 AND
1921 p_x_header_rec.operation = oe_globals.g_opr_create)THEN
1922 IF p_x_header_rec.salesrep_id IS NOT NULL THEN
1923 IF OE_Validate_Header_Scredit.G_Create_Auto_Sales_Credit = 'Y' THEN
1924 OE_delayed_requests_Pvt.log_request
1925 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1926 p_entity_id => p_x_header_rec.header_id,
1927 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1928 p_requesting_entity_id => p_x_header_rec.header_id,
1929 p_request_type => OE_GLOBALS.G_DFLT_HSCREDIT_FOR_SREP,
1930 p_param1 => p_x_header_rec.header_id,
1931 p_param2 => p_x_header_rec.salesrep_id,
1932 x_return_status => l_return_status);
1933 END IF;
1934
1935 /* Else added for bug 4139105 */
1936 ELSE
1937 IF OE_Validate_Header_Scredit.G_Create_Auto_Sales_Credit = 'Y' THEN
1938 OE_DELAYED_REQUESTS_PVT.Delete_Request
1939 (
1940 p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1941 p_entity_id => p_x_header_rec.header_id,
1942 p_request_type => OE_GLOBALS.G_DFLT_HSCREDIT_FOR_SREP,
1943 x_return_status => l_return_status
1944 );
1945 END IF;
1946 /* End of bug 4139105 */
1947
1948 END IF;
1949
1950 END IF;
1951
1952 NULL;
1953 END IF;
1954 oe_debug_pub.add('Raj3', 1);
1955
1956 IF NOT OE_GLOBALS.Equal(p_x_header_rec.sold_to_org_id,p_old_header_rec.sold_to_org_id)
1957 THEN
1958 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
1959 AND p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
1960
1961 -- Set Flag to Log a request for Verify Payment
1962 oe_debug_pub.add('Log Verify Payment Delayed Request in Sold To',3);
1963 --
1964 l_verify_payment_flag := 'Y';
1965
1966 END IF;
1967
1968 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1969 -- Log request to evaluate Holds.
1970 oe_debug_pub.ADD('Customer update: logging request for eval_hold_source',1);
1971 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
1972 'Entity ID:' || to_char(p_x_header_rec.sold_to_org_id),1);
1973 OE_delayed_requests_Pvt.log_request
1974 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1975 p_entity_id => p_x_header_rec.header_id,
1976 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
1977 p_requesting_entity_id => p_x_header_rec.header_id,
1978 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
1979 p_request_unique_key1 => 'CUSTOMER',
1980 p_param1 => 'C',
1981 p_param2 => p_x_header_rec.sold_to_org_id,
1982 x_return_status => l_return_status);
1983 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
1984 END IF;
1985
1986
1987 END IF;
1988
1989 IF NOT OE_GLOBALS.Equal(p_x_header_rec.tax_point_code,p_old_header_rec.tax_point_code)
1990 THEN
1991 NULL;
1992 END IF;
1993
1994 IF NOT OE_GLOBALS.Equal(p_x_header_rec.transactional_curr_code,p_old_header_rec.transactional_curr_code)
1995 THEN
1996 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
1997 THEN
1998
1999 IF p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
2000
2001 -- Set Flag to Log a request for Verify Payment
2002 oe_debug_pub.add('Log Verify Payment Delayed Request in Curr Code',3);
2003 l_verify_payment_flag := 'Y';
2004
2005 ELSE
2006 /* Additional Task - If the payment type is not CREDIT CARD,
2007 then also log delayed req for verify payment if the
2008 order is booked */
2009
2010 if p_x_header_rec.booked_flag ='Y' then
2011 oe_debug_pub.add('Log Verify Payment Delayed Request in Currency Code',3);
2012 l_verify_payment_flag := 'Y';
2013 end if;
2014 END IF;
2015 END IF;
2016 END IF;
2017
2018 IF NOT OE_GLOBALS.Equal(p_x_header_rec.payment_type_code,p_old_header_rec.payment_type_code)
2019 THEN
2020 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
2021 --R12 CC Encryption
2022 --Credit card processing would
2023 --now be handled in pre_write_process procedure
2024 IF p_x_header_rec.payment_type_code IS NOT NULL
2025 AND p_x_header_rec.payment_type_code <> 'CREDIT_CARD' THEN
2026 -- Set Flag Log a request for Verify Payment
2027 oe_debug_pub.add('Log Verify Payment Delayed Request in Payment Type',3);
2028 l_verify_payment_flag := 'Y';
2029 l_payments_upd_flag := 'Y';
2030 END IF;
2031
2032 --R12 CC Encryption
2033 END IF;
2034 END IF;
2035 IF NOT OE_GLOBALS.Equal(p_x_header_rec.payment_amount,p_old_header_rec.payment_amount)
2036 THEN
2037 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2038 AND p_x_header_rec.payment_type_code in ('CASH', 'CHECK')
2039 THEN
2040
2041 -- Set Flag to Log a request for Verify Payment
2042 oe_debug_pub.add('Log Update Payments Delayed',3);
2043 --
2044 --l_verify_payment_flag := 'Y';
2045
2046 l_payments_upd_flag := 'Y';
2047
2048 END IF;
2049 END IF;
2050
2051 IF NOT OE_GLOBALS.Equal(p_x_header_rec.check_number,p_old_header_rec.check_number)
2052 THEN
2053 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2054 AND p_x_header_rec.payment_type_code = 'CHECK'
2055 THEN
2056
2057 -- Set Flag to Log a request for Verify Payment
2058 oe_debug_pub.add('Log Update Payments Delayed',3);
2059 --
2060 --l_verify_payment_flag := 'Y';
2061
2062 l_payments_upd_flag := 'Y';
2063
2064 END IF;
2065 END IF;
2066
2067
2068 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_holder_name,p_old_header_rec.credit_card_holder_name)
2069 THEN
2070 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2071 AND p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
2072
2073 -- Set Flag to Log a request for Verify Payment
2074 oe_debug_pub.add('Log Verify Payment Delayed Request in CC Holder',3);
2075 --
2076 l_verify_payment_flag := 'Y';
2077 --R12 CC Encryption
2078 --Credit card processing would now be handled in pre_write_process procedure
2079 --l_payments_upd_flag := 'Y';
2080 --R12 CC Encryption
2081
2082 END IF;
2083 END IF;
2084
2085 IF NOT OE_GLOBALS.Is_Same_Credit_Card(p_old_header_rec.credit_card_number,
2086 p_x_header_rec.credit_card_number,
2087 p_old_header_rec.cc_instrument_id,
2088 p_x_header_rec.cc_instrument_id)
2089 THEN
2090 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2091 AND p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
2092
2093 -- Set Flag to Log a request for Verify Payment
2094 oe_debug_pub.add('Log Verify Payment Delayed Request in CC Number',3);
2095 --
2096 l_verify_payment_flag := 'Y';
2097 --R12 CC Encryption
2098 --Credit card processing would now be handled in pre_write_process procedure
2099 --l_payments_upd_flag := 'Y';
2100
2101 --R12 CC Encryption
2102 END IF;
2103 END IF;
2104 oe_debug_pub.add('Raj4', 1);
2105
2106 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_expiration_date,p_old_header_rec.credit_card_expiration_date)
2107 THEN
2108 /* Fix Bug # 3686048(FP 3659342): Set the Exp Date as the Last Day of the Month */
2109 select last_day(p_x_header_rec.credit_card_expiration_date)
2110 into p_x_header_rec.credit_card_expiration_date from dual;
2111
2112 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2113 AND p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
2114
2115 -- Set Flag to Log a request for Verify Payment
2116 oe_debug_pub.add('Log Verify Payment Delayed Request in CC Exp Date',3);
2117 --
2118 l_verify_payment_flag := 'Y';
2119 --R12 CC Encryption
2120 --Credit card processing would now be handled in pre_write_process procedure
2121 --l_payments_upd_flag := 'Y';
2122 --R12 CC Encryption
2123
2124 END IF;
2125 END IF;
2126
2127 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_approval_code,p_old_header_rec.credit_card_approval_code)
2128 THEN
2129 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2130 AND p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
2131
2132 -- Set Flag to Log a request for Verify Payment
2133 oe_debug_pub.add('Log Verify Payment Delayed Request in CC Approval',3);
2134 --
2135 l_verify_payment_flag := 'Y';
2136 --R12 CC Encryption
2137 --Credit card processing would now be handled in pre_write_process procedure
2138 --l_payments_upd_flag := 'Y';
2139 --R12 CC Encryption
2140
2141 END IF;
2142 END IF;
2143
2144
2145 /* Fix for 1559906: New Procedure to Copy Freight Charges */
2146
2147 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.source_document_type_id,
2148 p_old_header_rec.source_document_type_id)) OR
2149 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
2150 AND p_x_header_rec.source_document_type_id = 2)
2151 --OR condition added for bug 5060064
2152 THEN
2153 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
2154 AND p_x_header_rec.source_document_type_id = 2 THEN
2155
2156 -- Added IF condition for bug 6697401
2157 IF OE_ORDER_COPY_UTIL.G_COPY_REC.line_price_mode =
2158 OE_ORDER_COPY_UTIL.G_CPY_ORIG_PRICE THEN
2159
2160 oe_debug_pub.add(' Copy as original price');
2161 -- bug 6697401
2162 -- Log a request to copy Freight Charges to the copied order.
2163 oe_debug_pub.add('Log Delayed Request To Copy Charges in SRC Doc Type Id',3);
2164
2165 OE_delayed_requests_Pvt.log_request(
2166 p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2167 p_entity_id => p_x_header_rec.header_id,
2168 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2169 p_requesting_entity_id => p_x_header_rec.header_id,
2170 p_param1 => p_x_header_rec.order_category_code,
2171 p_param2 => p_x_header_rec.source_document_id,
2172 p_request_type => OE_GLOBALS.G_COPY_FREIGHT_CHARGES,
2173 x_return_status => l_return_status);
2174 END IF; -- bug 6697401
2175 END IF;
2176 END IF;
2177
2178 /* Added the following code to fix the bug 2170086 */
2179 IF NOT OE_GLOBALS.Equal(p_x_header_rec.source_document_type_id,p_old_header_rec.source_document_type_id) OR
2180 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
2181 AND p_x_header_rec.source_document_type_id = 2 )
2182 --OR condition added for bug 5060064
2183 THEN
2184 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
2185 AND p_x_header_rec.source_document_type_id = 2 THEN
2186
2187 -- Log a request to copy header adjustments to the copied order.
2188 oe_debug_pub.add('Log Delayed Request To Copy header adjustments ',3);
2189 --
2190
2191 IF OE_ORDER_COPY_UTIL.G_COPY_REC.line_price_mode IN (OE_ORDER_COPY_UTIL.G_CPY_ORIG_PRICE,OE_ORDER_COPY_UTIL.G_CPY_REPRICE_PARTIAL) THEN
2192 oe_debug_pub.add(' Copy as original price');
2193 OE_delayed_requests_Pvt.log_request(
2194 p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2195 p_entity_id => p_x_header_rec.header_id,
2196 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2197 p_requesting_entity_id => p_x_header_rec.header_id,
2198 p_param1 => p_x_header_rec.order_category_code,
2199 p_param2 => p_x_header_rec.source_document_id,
2200 p_request_type => OE_GLOBALS.G_COPY_HEADER_ADJUSTMENTS ,
2201 x_return_status => l_return_status);
2202 END IF;
2203 END IF;
2204 END IF;
2205
2206 /* End of the code added to fix the bug 2170086 */
2207 -- Bug 2619506
2208 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.transactional_curr_code,p_old_header_rec.transactional_curr_code)) OR
2209 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
2210 p_x_header_rec.transactional_curr_code IS NOT NULL)
2211 -- OR condition added for bug 5060064
2212 THEN
2213 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2214 THEN
2215 If nvl(p_x_header_rec.booked_flag, 'N') <> 'Y' Then
2216 OE_delayed_requests_Pvt.log_request(
2217 p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2218 p_entity_id => p_x_header_rec.header_id,
2219 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2220 p_requesting_entity_id => p_x_header_rec.header_id,
2221 p_param1 => p_x_header_rec.header_id,
2222 p_param2 => 'BATCH',
2223 p_request_unique_key1 => 'BATCH',
2224 p_param3 => 'PRICE_ORDER',
2225 p_request_type => OE_GLOBALS.G_PRICE_ORDER,
2226 x_return_status => l_return_status);
2227 Else
2228 OE_delayed_requests_Pvt.log_request(
2229 p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2230 p_entity_id => p_x_header_rec.header_id,
2231 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2232 p_requesting_entity_id => p_x_header_rec.header_id,
2233 p_param1 => p_x_header_rec.header_id,
2234 p_param2 => 'BATCH,BOOK',
2235 p_request_unique_key1 => 'BATCH,BOOK',
2236 p_param3 => 'PRICE_ORDER',
2237 p_request_type => OE_GLOBALS.G_PRICE_ORDER,
2238 x_return_status => l_return_status);
2239 End If;
2240 End If;
2241 End If;
2242
2243 --ER#7479609 start
2244 IF NOT OE_GLOBALS.Equal(p_x_header_rec.payment_type_code,p_old_header_rec.payment_type_code)
2245 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2246 THEN
2247 OE_Holds_PUB.G_PAYMENT_HOLD_APPLIED := 'N';
2248 OE_Holds_PUB.G_HDR_PAYMENT := 'Y';
2249 oe_debug_pub.ADD('payment type update: logging request for eval_hold_source',1);
2250 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
2251 'Entity ID:' || to_char(p_x_header_rec.payment_type_code),1);
2252 OE_delayed_requests_Pvt.log_request
2253 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2254 p_entity_id => p_x_header_rec.header_id,
2255 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2256 p_requesting_entity_id => p_x_header_rec.header_id,
2257 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
2258 p_request_unique_key1 => 'PAYMENT_TYPE',
2259 p_param1 => 'P',
2260 p_param2 => p_x_header_rec.payment_type_code,
2261 x_return_status => l_return_status);
2262 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
2263
2264 END IF;
2265
2266 IF NOT OE_GLOBALS.Equal(p_x_header_rec.transactional_curr_code,p_old_header_rec.transactional_curr_code)
2267 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2268 THEN
2269 oe_debug_pub.ADD('Currency update: logging request for eval_hold_source',1);
2270 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
2271 'Entity ID:' || to_char(p_x_header_rec.transactional_curr_code),1);
2272 OE_delayed_requests_Pvt.log_request
2273 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2274 p_entity_id => p_x_header_rec.header_id,
2275 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2276 p_requesting_entity_id => p_x_header_rec.header_id,
2277 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
2278 p_request_unique_key1 => 'CURRENCY',
2279 p_param1 => 'TC',
2280 p_param2 => p_x_header_rec.transactional_curr_code,
2281 x_return_status => l_return_status);
2282 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
2283
2284 END IF;
2285
2286 IF NOT OE_GLOBALS.Equal(p_x_header_rec.sales_channel_code,p_old_header_rec.sales_channel_code)
2287 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2288 THEN
2289 oe_debug_pub.ADD('sales channel update: logging request for eval_hold_source',1);
2290 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
2291 'Entity ID:' || to_char(p_x_header_rec.sales_channel_code),1);
2292 OE_delayed_requests_Pvt.log_request
2293 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2294 p_entity_id => p_x_header_rec.header_id,
2295 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2296 p_requesting_entity_id => p_x_header_rec.header_id,
2297 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
2298 p_request_unique_key1 => 'SALES_CHANNEL',
2299 p_param1 => 'SC',
2300 p_param2 => p_x_header_rec.sales_channel_code,
2301 x_return_status => l_return_status);
2302 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
2303
2304 END IF;
2305
2306 IF NOT OE_GLOBALS.Equal(p_x_header_rec.price_list_id,p_old_header_rec.price_list_id)
2307 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2308 THEN
2309 oe_debug_pub.ADD('price list update: logging request for eval_hold_source',1);
2310 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
2311 'Entity ID:' || to_char(p_x_header_rec.price_list_id),1);
2312 OE_delayed_requests_Pvt.log_request
2313 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2314 p_entity_id => p_x_header_rec.header_id,
2315 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2316 p_requesting_entity_id => p_x_header_rec.header_id,
2317 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
2318 p_request_unique_key1 => 'PRICE_LIST',
2319 p_param1 => 'PL',
2320 p_param2 => p_x_header_rec.price_list_id,
2321 x_return_status => l_return_status);
2322 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
2323
2324 END IF;
2325
2326 IF NOT OE_GLOBALS.Equal(p_x_header_rec.order_type_id,p_old_header_rec.order_type_id)
2327 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
2328 THEN
2329 oe_debug_pub.ADD('Order type update: logging request for eval_hold_source',1);
2330 oe_debug_pub.ADD('Header ID:' || to_char(p_x_header_rec.header_id) ||
2331 'Entity ID:' || to_char(p_x_header_rec.order_type_id),1);
2332 OE_delayed_requests_Pvt.log_request
2333 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2334 p_entity_id => p_x_header_rec.header_id,
2335 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2336 p_requesting_entity_id => p_x_header_rec.header_id,
2337 p_request_type => OE_GLOBALS.G_EVAL_HOLD_SOURCE,
2338 p_request_unique_key1 => 'ORDER_TYPE',
2339 p_param1 => 'OT',
2340 p_param2 => p_x_header_rec.order_type_id,
2341 x_return_status => l_return_status);
2342 oe_debug_pub.ADD('after call to log_request: l_return_status: '||l_return_status , 1);
2343
2344 END IF;
2345 --ER#7479609 end
2346
2347 IF (l_verify_payment_flag = 'Y') THEN
2348
2349 -- Log a request for Verify Payment
2350 oe_debug_pub.add('Logging Delayed Request for Verify Payment',3);
2351 --
2352 OE_delayed_requests_Pvt.log_request
2353 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2354 p_entity_id => p_x_header_rec.header_id,
2355 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2356 p_requesting_entity_id => p_x_header_rec.header_id,
2357 p_request_type => OE_GLOBALS.G_VERIFY_PAYMENT,
2358 x_return_status => l_return_status);
2359
2360 END IF;
2361
2362 /* code added by Renga for multiple payments */
2363 l_payment_count := 0;
2364 Begin
2365
2366 oe_debug_pub.add('before getting payment count ', 1);
2367 open payment_count_cur;
2368 fetch payment_count_cur into l_payment_count;
2369 close payment_count_cur;
2370
2371 Exception
2372
2373 when others then
2374 l_payment_count := 0;
2375
2376 End;
2377
2378 IF OE_PrePayment_UTIL.IS_MULTIPLE_PAYMENTS_ENABLED = TRUE
2379 and l_payments_upd_flag = 'Y'
2380 and l_payment_count > 0 then --modified for bug 3733877
2381
2382 oe_debug_pub.add('logging synch payment delayed request', 1);
2383
2384 OE_delayed_requests_Pvt.log_request
2385 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
2386 p_entity_id => p_x_header_rec.header_id,
2387 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
2388 p_requesting_entity_id => p_x_header_rec.header_id,
2389 p_request_type => OE_GLOBALS.G_UPDATE_HDR_PAYMENT,
2390 p_param1 => 'UPDATE_PAYMENT',
2391 x_return_status => l_return_status);
2392
2393 END IF; -- if multiple payments enabled and l_payments_upd_flag = 'Y'
2394 -- and l_payment_count = 1
2395 /*-- 3288805
2396 Store the new order_date_type_code--*/
2397 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.order_date_type_code, p_old_header_rec.order_date_type_code)) OR
2398 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
2399 p_x_header_rec.order_date_type_code IS NOT NULL)
2400 --OR cnd added for bug 5060064
2401 THEN
2402 IF ( nvl(OE_Schedule_Util.G_HEADER_ID, 0) = p_x_header_rec.header_id )
2403 THEN
2404 OE_Schedule_Util.G_DATE_TYPE := p_x_header_rec.order_date_type_code; END IF;
2405 END IF;
2406 /*-- 3288805 --*/
2407 oe_debug_pub.add('Exiting OE_HEADER_UTIL.APPLY_ATTRIBUTE_CHANGES', 1);
2408
2409 END Apply_Attribute_Changes;
2410
2411 -- Procedure Complete_Record
2412
2413 PROCEDURE Complete_Record
2414 ( p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
2415 , p_old_header_rec IN OE_Order_PUB.Header_Rec_Type
2416 )
2417 IS
2418
2419 BEGIN
2420
2421 oe_debug_pub.add('Entering OE_HEADER_UTIL.COMPLETE_RECORD', 1);
2422
2423 IF p_x_header_rec.accounting_rule_id = FND_API.G_MISS_NUM THEN
2424 p_x_header_rec.accounting_rule_id := p_old_header_rec.accounting_rule_id;
2425 END IF;
2426
2427 IF p_x_header_rec.accounting_rule_duration = FND_API.G_MISS_NUM THEN
2428 p_x_header_rec.accounting_rule_duration := p_old_header_rec.accounting_rule_duration;
2429 END IF;
2430
2431 IF p_x_header_rec.agreement_id = FND_API.G_MISS_NUM THEN
2432 p_x_header_rec.agreement_id := p_old_header_rec.agreement_id;
2433 END IF;
2434
2435 IF p_x_header_rec.upgraded_flag = FND_API.G_MISS_CHAR THEN
2436 p_x_header_rec.upgraded_flag := p_old_header_rec.upgraded_flag;
2437 END IF;
2438
2439 IF p_x_header_rec.blanket_number = FND_API.G_MISS_NUM THEN
2440 p_x_header_rec.blanket_number := p_old_header_rec.blanket_number;
2441 END IF;
2442
2443 IF p_x_header_rec.booked_flag = FND_API.G_MISS_CHAR THEN
2444 p_x_header_rec.booked_flag := p_old_header_rec.booked_flag;
2445 END IF;
2446
2447 IF p_x_header_rec.booked_date = FND_API.G_MISS_DATE THEN
2448 p_x_header_rec.booked_date := p_old_header_rec.booked_date;
2449 END IF;
2450
2451 IF p_x_header_rec.cancelled_flag = FND_API.G_MISS_CHAR THEN
2452 p_x_header_rec.cancelled_flag := p_old_header_rec.cancelled_flag;
2453 END IF;
2454
2455 IF p_x_header_rec.attribute1 = FND_API.G_MISS_CHAR THEN
2456 p_x_header_rec.attribute1 := p_old_header_rec.attribute1;
2457 END IF;
2458
2459 IF p_x_header_rec.attribute10 = FND_API.G_MISS_CHAR THEN
2460 p_x_header_rec.attribute10 := p_old_header_rec.attribute10;
2461 END IF;
2462
2463 IF p_x_header_rec.attribute11 = FND_API.G_MISS_CHAR THEN
2464 p_x_header_rec.attribute11 := p_old_header_rec.attribute11;
2465 END IF;
2466
2467 IF p_x_header_rec.attribute12 = FND_API.G_MISS_CHAR THEN
2468 p_x_header_rec.attribute12 := p_old_header_rec.attribute12;
2469 END IF;
2470
2471 IF p_x_header_rec.attribute13 = FND_API.G_MISS_CHAR THEN
2472 p_x_header_rec.attribute13 := p_old_header_rec.attribute13;
2473 END IF;
2474
2475 IF p_x_header_rec.attribute14 = FND_API.G_MISS_CHAR THEN
2476 p_x_header_rec.attribute14 := p_old_header_rec.attribute14;
2477 END IF;
2478
2479 IF p_x_header_rec.attribute15 = FND_API.G_MISS_CHAR THEN
2480 p_x_header_rec.attribute15 := p_old_header_rec.attribute15;
2481 END IF;
2482
2483 IF p_x_header_rec.attribute16 = FND_API.G_MISS_CHAR THEN --bug 2184255
2484 p_x_header_rec.attribute16 := p_old_header_rec.attribute16;
2485 END IF;
2486
2487 IF p_x_header_rec.attribute17 = FND_API.G_MISS_CHAR THEN
2488 p_x_header_rec.attribute17 := p_old_header_rec.attribute17;
2489 END IF;
2490
2491 IF p_x_header_rec.attribute18 = FND_API.G_MISS_CHAR THEN
2492 p_x_header_rec.attribute18 := p_old_header_rec.attribute18;
2493 END IF;
2494
2495 IF p_x_header_rec.attribute19 = FND_API.G_MISS_CHAR THEN
2496 p_x_header_rec.attribute19 := p_old_header_rec.attribute19;
2497 END IF;
2498
2499 IF p_x_header_rec.attribute2 = FND_API.G_MISS_CHAR THEN
2500 p_x_header_rec.attribute2 := p_old_header_rec.attribute2;
2501 END IF;
2502
2503 IF p_x_header_rec.attribute20 = FND_API.G_MISS_CHAR THEN --bug2184255
2504 p_x_header_rec.attribute20:= p_old_header_rec.attribute20;
2505 END IF;
2506
2507 IF p_x_header_rec.attribute3 = FND_API.G_MISS_CHAR THEN
2508 p_x_header_rec.attribute3 := p_old_header_rec.attribute3;
2509 END IF;
2510
2511 IF p_x_header_rec.attribute4 = FND_API.G_MISS_CHAR THEN
2512 p_x_header_rec.attribute4 := p_old_header_rec.attribute4;
2513 END IF;
2514
2515 IF p_x_header_rec.attribute5 = FND_API.G_MISS_CHAR THEN
2516 p_x_header_rec.attribute5 := p_old_header_rec.attribute5;
2517 END IF;
2518
2519 IF p_x_header_rec.attribute6 = FND_API.G_MISS_CHAR THEN
2520 p_x_header_rec.attribute6 := p_old_header_rec.attribute6;
2521 END IF;
2522
2523 IF p_x_header_rec.attribute7 = FND_API.G_MISS_CHAR THEN
2524 p_x_header_rec.attribute7 := p_old_header_rec.attribute7;
2525 END IF;
2526
2527 IF p_x_header_rec.attribute8 = FND_API.G_MISS_CHAR THEN
2528 p_x_header_rec.attribute8 := p_old_header_rec.attribute8;
2529 END IF;
2530
2531 IF p_x_header_rec.attribute9 = FND_API.G_MISS_CHAR THEN
2532 p_x_header_rec.attribute9 := p_old_header_rec.attribute9;
2533 END IF;
2534
2535 IF p_x_header_rec.context = FND_API.G_MISS_CHAR THEN
2536 p_x_header_rec.context := p_old_header_rec.context;
2537 END IF;
2538
2539 IF p_x_header_rec.conversion_rate = FND_API.G_MISS_NUM THEN
2540 p_x_header_rec.conversion_rate := p_old_header_rec.conversion_rate;
2541 END IF;
2542
2543 IF p_x_header_rec.conversion_rate_date = FND_API.G_MISS_DATE THEN
2544 p_x_header_rec.conversion_rate_date := p_old_header_rec.conversion_rate_date;
2545 END IF;
2546
2547 IF p_x_header_rec.conversion_type_code = FND_API.G_MISS_CHAR THEN
2548 p_x_header_rec.conversion_type_code := p_old_header_rec.conversion_type_code;
2549 END IF;
2550 IF p_x_header_rec.CUSTOMER_PREFERENCE_SET_CODE = FND_API.G_MISS_CHAR THEN
2551 p_x_header_rec.CUSTOMER_PREFERENCE_SET_CODE := p_old_header_rec.CUSTOMER_PREFERENCE_SET_CODE;
2552 END IF;
2553
2554 IF p_x_header_rec.created_by = FND_API.G_MISS_NUM THEN
2555 p_x_header_rec.created_by := p_old_header_rec.created_by;
2556 END IF;
2557
2558 IF p_x_header_rec.creation_date = FND_API.G_MISS_DATE THEN
2559 p_x_header_rec.creation_date := p_old_header_rec.creation_date;
2560 END IF;
2561
2562 IF p_x_header_rec.cust_po_number = FND_API.G_MISS_CHAR THEN
2563 p_x_header_rec.cust_po_number := p_old_header_rec.cust_po_number;
2564 END IF;
2565
2566 IF p_x_header_rec.default_fulfillment_set = FND_API.G_MISS_CHAR THEN
2567 p_x_header_rec.default_fulfillment_set := p_old_header_rec.default_fulfillment_set;
2568 END IF;
2569
2570
2571 IF p_x_header_rec.deliver_to_contact_id = FND_API.G_MISS_NUM THEN
2572 p_x_header_rec.deliver_to_contact_id := p_old_header_rec.deliver_to_contact_id;
2573 END IF;
2574
2575 IF p_x_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM THEN
2576 p_x_header_rec.deliver_to_org_id := p_old_header_rec.deliver_to_org_id;
2577 END IF;
2578
2579 IF p_x_header_rec.demand_class_code = FND_API.G_MISS_CHAR THEN
2580 p_x_header_rec.demand_class_code := p_old_header_rec.demand_class_code;
2581 END IF;
2582
2583 IF p_x_header_rec.expiration_date = FND_API.G_MISS_DATE THEN
2584 p_x_header_rec.expiration_date := p_old_header_rec.expiration_date;
2585 END IF;
2586
2587 IF p_x_header_rec.earliest_schedule_limit = FND_API.G_MISS_NUM THEN
2588 p_x_header_rec.earliest_schedule_limit := p_old_header_rec.earliest_schedule_limit;
2589 END IF;
2590
2591 IF p_x_header_rec.fob_point_code = FND_API.G_MISS_CHAR THEN
2592 p_x_header_rec.fob_point_code := p_old_header_rec.fob_point_code;
2593 END IF;
2594
2595 IF p_x_header_rec.freight_carrier_code = FND_API.G_MISS_CHAR THEN
2596 p_x_header_rec.freight_carrier_code := p_old_header_rec.freight_carrier_code;
2597 END IF;
2598
2599 IF p_x_header_rec.freight_terms_code = FND_API.G_MISS_CHAR THEN
2600 p_x_header_rec.freight_terms_code := p_old_header_rec.freight_terms_code;
2601 END IF;
2602
2603 IF p_x_header_rec.fulfillment_set_name = FND_API.G_MISS_CHAR THEN
2604 p_x_header_rec.fulfillment_set_name := p_old_header_rec.fulfillment_set_name;
2605 END IF;
2606
2607 IF p_x_header_rec.global_attribute1 = FND_API.G_MISS_CHAR THEN
2608 p_x_header_rec.global_attribute1 := p_old_header_rec.global_attribute1;
2609 END IF;
2610
2611 IF p_x_header_rec.global_attribute10 = FND_API.G_MISS_CHAR THEN
2612 p_x_header_rec.global_attribute10 := p_old_header_rec.global_attribute10;
2613 END IF;
2614
2615 IF p_x_header_rec.global_attribute11 = FND_API.G_MISS_CHAR THEN
2616 p_x_header_rec.global_attribute11 := p_old_header_rec.global_attribute11;
2617 END IF;
2618
2619 IF p_x_header_rec.global_attribute12 = FND_API.G_MISS_CHAR THEN
2620 p_x_header_rec.global_attribute12 := p_old_header_rec.global_attribute12;
2621 END IF;
2622
2623 IF p_x_header_rec.global_attribute13 = FND_API.G_MISS_CHAR THEN
2624 p_x_header_rec.global_attribute13 := p_old_header_rec.global_attribute13;
2625 END IF;
2626
2627 IF p_x_header_rec.global_attribute14 = FND_API.G_MISS_CHAR THEN
2628 p_x_header_rec.global_attribute14 := p_old_header_rec.global_attribute14;
2629 END IF;
2630
2631 IF p_x_header_rec.global_attribute15 = FND_API.G_MISS_CHAR THEN
2632 p_x_header_rec.global_attribute15 := p_old_header_rec.global_attribute15;
2633 END IF;
2634
2635 IF p_x_header_rec.global_attribute16 = FND_API.G_MISS_CHAR THEN
2636 p_x_header_rec.global_attribute16 := p_old_header_rec.global_attribute16;
2637 END IF;
2638
2639 IF p_x_header_rec.global_attribute17 = FND_API.G_MISS_CHAR THEN
2640 p_x_header_rec.global_attribute17 := p_old_header_rec.global_attribute17;
2641 END IF;
2642
2643 IF p_x_header_rec.global_attribute18 = FND_API.G_MISS_CHAR THEN
2644 p_x_header_rec.global_attribute18 := p_old_header_rec.global_attribute18;
2645 END IF;
2646
2647 IF p_x_header_rec.global_attribute19 = FND_API.G_MISS_CHAR THEN
2648 p_x_header_rec.global_attribute19 := p_old_header_rec.global_attribute19;
2649 END IF;
2650
2651 IF p_x_header_rec.global_attribute2 = FND_API.G_MISS_CHAR THEN
2652 p_x_header_rec.global_attribute2 := p_old_header_rec.global_attribute2;
2653 END IF;
2654
2655 IF p_x_header_rec.global_attribute20 = FND_API.G_MISS_CHAR THEN
2656 p_x_header_rec.global_attribute20 := p_old_header_rec.global_attribute20;
2657 END IF;
2658
2659 IF p_x_header_rec.global_attribute3 = FND_API.G_MISS_CHAR THEN
2660 p_x_header_rec.global_attribute3 := p_old_header_rec.global_attribute3;
2661 END IF;
2662
2663 IF p_x_header_rec.global_attribute4 = FND_API.G_MISS_CHAR THEN
2664 p_x_header_rec.global_attribute4 := p_old_header_rec.global_attribute4;
2665 END IF;
2666
2667 IF p_x_header_rec.global_attribute5 = FND_API.G_MISS_CHAR THEN
2668 p_x_header_rec.global_attribute5 := p_old_header_rec.global_attribute5;
2669 END IF;
2670
2671 IF p_x_header_rec.global_attribute6 = FND_API.G_MISS_CHAR THEN
2672 p_x_header_rec.global_attribute6 := p_old_header_rec.global_attribute6;
2673 END IF;
2674
2675 IF p_x_header_rec.global_attribute7 = FND_API.G_MISS_CHAR THEN
2676 p_x_header_rec.global_attribute7 := p_old_header_rec.global_attribute7;
2677 END IF;
2678
2679 IF p_x_header_rec.global_attribute8 = FND_API.G_MISS_CHAR THEN
2680 p_x_header_rec.global_attribute8 := p_old_header_rec.global_attribute8;
2681 END IF;
2682
2683 IF p_x_header_rec.global_attribute9 = FND_API.G_MISS_CHAR THEN
2684 p_x_header_rec.global_attribute9 := p_old_header_rec.global_attribute9;
2685 END IF;
2686
2687 IF p_x_header_rec.global_attribute_category = FND_API.G_MISS_CHAR THEN
2688 p_x_header_rec.global_attribute_category := p_old_header_rec.global_attribute_category;
2689 END IF;
2690
2691 IF p_x_header_rec.header_id = FND_API.G_MISS_NUM THEN
2692 p_x_header_rec.header_id := p_old_header_rec.header_id;
2693 END IF;
2694
2695 IF p_x_header_rec.invoice_to_contact_id = FND_API.G_MISS_NUM THEN
2696 p_x_header_rec.invoice_to_contact_id := p_old_header_rec.invoice_to_contact_id;
2697 END IF;
2698
2699 IF p_x_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM THEN
2700 p_x_header_rec.invoice_to_org_id := p_old_header_rec.invoice_to_org_id;
2701 END IF;
2702
2703 IF p_x_header_rec.invoicing_rule_id = FND_API.G_MISS_NUM THEN
2704 p_x_header_rec.invoicing_rule_id := p_old_header_rec.invoicing_rule_id;
2705 END IF;
2706
2707 IF p_x_header_rec.last_updated_by = FND_API.G_MISS_NUM THEN
2708 p_x_header_rec.last_updated_by := p_old_header_rec.last_updated_by;
2709 END IF;
2710
2711 IF p_x_header_rec.last_update_date = FND_API.G_MISS_DATE THEN
2712 p_x_header_rec.last_update_date := p_old_header_rec.last_update_date;
2713 END IF;
2714
2715 IF p_x_header_rec.last_update_login = FND_API.G_MISS_NUM THEN
2716 p_x_header_rec.last_update_login := p_old_header_rec.last_update_login;
2717 END IF;
2718
2719 IF p_x_header_rec.latest_schedule_limit = FND_API.G_MISS_NUM THEN
2720 p_x_header_rec.latest_schedule_limit := p_old_header_rec.latest_schedule_limit;
2721 END IF;
2722
2723 IF p_x_header_rec.open_flag = FND_API.G_MISS_CHAR THEN
2724 p_x_header_rec.open_flag := p_old_header_rec.open_flag;
2725 END IF;
2726
2727 IF p_x_header_rec.ordered_date = FND_API.G_MISS_DATE THEN
2728 p_x_header_rec.ordered_date := p_old_header_rec.ordered_date;
2729 END IF;
2730
2731 IF p_x_header_rec.order_number = FND_API.G_MISS_NUM THEN
2732 p_x_header_rec.order_number := p_old_header_rec.order_number;
2733 END IF;
2734
2735 IF p_x_header_rec.order_date_type_code = FND_API.G_MISS_CHAR THEN
2736 p_x_header_rec.order_date_type_code := p_old_header_rec.order_date_type_code;
2737 END IF;
2738
2739 IF p_x_header_rec.order_source_id = FND_API.G_MISS_NUM THEN
2740 p_x_header_rec.order_source_id := p_old_header_rec.order_source_id;
2741 END IF;
2742
2743 IF p_x_header_rec.order_type_id = FND_API.G_MISS_NUM THEN
2744 p_x_header_rec.order_type_id := p_old_header_rec.order_type_id;
2745 END IF;
2746
2747 IF p_x_header_rec.order_category_code = FND_API.G_MISS_CHAR THEN
2748 p_x_header_rec.order_category_code := p_old_header_rec.order_category_code;
2749 END IF;
2750
2751 IF p_x_header_rec.org_id = FND_API.G_MISS_NUM THEN
2752 p_x_header_rec.org_id := p_old_header_rec.org_id;
2753 END IF;
2754
2755 IF p_x_header_rec.orig_sys_document_ref = FND_API.G_MISS_CHAR THEN
2756 p_x_header_rec.orig_sys_document_ref := p_old_header_rec.orig_sys_document_ref;
2757 END IF;
2758
2759 IF p_x_header_rec.partial_shipments_allowed = FND_API.G_MISS_CHAR THEN
2760 p_x_header_rec.partial_shipments_allowed := p_old_header_rec.partial_shipments_allowed;
2761 END IF;
2762
2763 IF p_x_header_rec.payment_term_id = FND_API.G_MISS_NUM THEN
2764 p_x_header_rec.payment_term_id := p_old_header_rec.payment_term_id;
2765 END IF;
2766
2767 IF p_x_header_rec.price_list_id = FND_API.G_MISS_NUM THEN
2768 p_x_header_rec.price_list_id := p_old_header_rec.price_list_id;
2769 END IF;
2770
2771 IF p_x_header_rec.price_request_code = FND_API.G_MISS_CHAR THEN -- PROMOTIONS SEP/01
2772 p_x_header_rec.price_request_code := p_old_header_rec.price_request_code;
2773 END IF;
2774
2775 IF p_x_header_rec.pricing_date = FND_API.G_MISS_DATE THEN
2776 p_x_header_rec.pricing_date := p_old_header_rec.pricing_date;
2777 END IF;
2778
2779 IF p_x_header_rec.program_application_id = FND_API.G_MISS_NUM THEN
2780 p_x_header_rec.program_application_id := p_old_header_rec.program_application_id;
2781 END IF;
2782
2783 IF p_x_header_rec.program_id = FND_API.G_MISS_NUM THEN
2784 p_x_header_rec.program_id := p_old_header_rec.program_id;
2785 END IF;
2786
2787 IF p_x_header_rec.program_update_date = FND_API.G_MISS_DATE THEN
2788 p_x_header_rec.program_update_date := p_old_header_rec.program_update_date;
2789 END IF;
2790
2791 IF p_x_header_rec.request_date = FND_API.G_MISS_DATE THEN
2792 p_x_header_rec.request_date := p_old_header_rec.request_date;
2793 END IF;
2794
2795 IF p_x_header_rec.request_id = FND_API.G_MISS_NUM THEN
2796 p_x_header_rec.request_id := p_old_header_rec.request_id;
2797 END IF;
2798
2799 IF p_x_header_rec.return_reason_code = FND_API.G_MISS_CHAR THEN
2800 p_x_header_rec.return_reason_code := p_old_header_rec.return_reason_code;
2801 END IF;
2802
2803 IF p_x_header_rec.salesrep_id = FND_API.G_MISS_NUM THEN
2804 p_x_header_rec.salesrep_id := p_old_header_rec.salesrep_id;
2805 END IF;
2806
2807 IF p_x_header_rec.sales_channel_code = FND_API.G_MISS_CHAR THEN
2808 p_x_header_rec.sales_channel_code := p_old_header_rec.sales_channel_code;
2809 END IF;
2810
2811 IF p_x_header_rec.shipment_priority_code = FND_API.G_MISS_CHAR THEN
2812 p_x_header_rec.shipment_priority_code := p_old_header_rec.shipment_priority_code;
2813 END IF;
2814
2815 IF p_x_header_rec.shipping_method_code = FND_API.G_MISS_CHAR THEN
2816 p_x_header_rec.shipping_method_code := p_old_header_rec.shipping_method_code;
2817 END IF;
2818
2819 IF p_x_header_rec.ship_from_org_id = FND_API.G_MISS_NUM THEN
2820 p_x_header_rec.ship_from_org_id := p_old_header_rec.ship_from_org_id;
2821 END IF;
2822
2823 IF p_x_header_rec.ship_tolerance_above = FND_API.G_MISS_NUM THEN
2824 p_x_header_rec.ship_tolerance_above := p_old_header_rec.ship_tolerance_above;
2825 END IF;
2826
2827 IF p_x_header_rec.ship_tolerance_below = FND_API.G_MISS_NUM THEN
2828 p_x_header_rec.ship_tolerance_below := p_old_header_rec.ship_tolerance_below;
2829 END IF;
2830
2831 IF p_x_header_rec.ship_to_contact_id = FND_API.G_MISS_NUM THEN
2832 p_x_header_rec.ship_to_contact_id := p_old_header_rec.ship_to_contact_id;
2833 END IF;
2834
2835 IF p_x_header_rec.ship_to_org_id = FND_API.G_MISS_NUM THEN
2836 p_x_header_rec.ship_to_org_id := p_old_header_rec.ship_to_org_id;
2837 END IF;
2838
2839 IF p_x_header_rec.sold_from_org_id = FND_API.G_MISS_NUM THEN
2840 p_x_header_rec.sold_from_org_id := p_old_header_rec.sold_from_org_id;
2841 END IF;
2842
2843 IF p_x_header_rec.sold_to_contact_id = FND_API.G_MISS_NUM THEN
2844 p_x_header_rec.sold_to_contact_id := p_old_header_rec.sold_to_contact_id;
2845 END IF;
2846
2847 IF p_x_header_rec.sold_to_org_id = FND_API.G_MISS_NUM THEN
2848 p_x_header_rec.sold_to_org_id := p_old_header_rec.sold_to_org_id;
2849 END IF;
2850
2851 IF p_x_header_rec.sold_to_phone_id = FND_API.G_MISS_NUM THEN
2852 p_x_header_rec.sold_to_phone_id := p_old_header_rec.sold_to_phone_id;
2853 END IF;
2854
2855 IF p_x_header_rec.source_document_id = FND_API.G_MISS_NUM THEN
2856 p_x_header_rec.source_document_id := p_old_header_rec.source_document_id;
2857 END IF;
2858
2859 IF p_x_header_rec.source_document_type_id = FND_API.G_MISS_NUM THEN
2860 p_x_header_rec.source_document_type_id := p_old_header_rec.source_document_type_id;
2861 END IF;
2862
2863 IF p_x_header_rec.tax_exempt_flag = FND_API.G_MISS_CHAR THEN
2864 p_x_header_rec.tax_exempt_flag := p_old_header_rec.tax_exempt_flag;
2865 END IF;
2866
2867 IF p_x_header_rec.tax_exempt_number = FND_API.G_MISS_CHAR THEN
2868 p_x_header_rec.tax_exempt_number := p_old_header_rec.tax_exempt_number;
2869 END IF;
2870
2871 IF p_x_header_rec.tax_exempt_reason_code = FND_API.G_MISS_CHAR THEN
2872 p_x_header_rec.tax_exempt_reason_code := p_old_header_rec.tax_exempt_reason_code;
2873 END IF;
2874
2875 IF p_x_header_rec.tax_point_code = FND_API.G_MISS_CHAR THEN
2876 p_x_header_rec.tax_point_code := p_old_header_rec.tax_point_code;
2877 END IF;
2878
2879 IF p_x_header_rec.transactional_curr_code = FND_API.G_MISS_CHAR THEN
2880 p_x_header_rec.transactional_curr_code := p_old_header_rec.transactional_curr_code;
2881 END IF;
2882
2883 -- For bug 2916613
2884 IF p_x_header_rec.tp_attribute1 = FND_API.G_MISS_CHAR THEN
2885 p_x_header_rec.tp_attribute1 := p_old_header_rec.tp_attribute1;
2886 END IF;
2887
2888 IF p_x_header_rec.tp_attribute10 = FND_API.G_MISS_CHAR THEN
2889 p_x_header_rec.tp_attribute10 := p_old_header_rec.tp_attribute10;
2890 END IF;
2891
2892 IF p_x_header_rec.tp_attribute11 = FND_API.G_MISS_CHAR THEN
2893 p_x_header_rec.tp_attribute11 := p_old_header_rec.tp_attribute11;
2894 END IF;
2895
2896 IF p_x_header_rec.tp_attribute12 = FND_API.G_MISS_CHAR THEN
2897 p_x_header_rec.tp_attribute12 := p_old_header_rec.tp_attribute12;
2898 END IF;
2899
2900 IF p_x_header_rec.tp_attribute13 = FND_API.G_MISS_CHAR THEN
2901 p_x_header_rec.tp_attribute13 := p_old_header_rec.tp_attribute13;
2902 END IF;
2903
2904 IF p_x_header_rec.tp_attribute14 = FND_API.G_MISS_CHAR THEN
2905 p_x_header_rec.tp_attribute14 := p_old_header_rec.tp_attribute14;
2906 END IF;
2907
2908 IF p_x_header_rec.tp_attribute15 = FND_API.G_MISS_CHAR THEN
2909 p_x_header_rec.tp_attribute15 := p_old_header_rec.tp_attribute15;
2910 END IF;
2911
2912 IF p_x_header_rec.tp_attribute2 = FND_API.G_MISS_CHAR THEN
2913 p_x_header_rec.tp_attribute2 := p_old_header_rec.tp_attribute2;
2914 END IF;
2915
2916 IF p_x_header_rec.tp_attribute3 = FND_API.G_MISS_CHAR THEN
2917 p_x_header_rec.tp_attribute3 := p_old_header_rec.tp_attribute3;
2918 END IF;
2919
2920 IF p_x_header_rec.tp_attribute4 = FND_API.G_MISS_CHAR THEN
2921 p_x_header_rec.tp_attribute4 := p_old_header_rec.tp_attribute4;
2922 END IF;
2923
2924 IF p_x_header_rec.tp_attribute5 = FND_API.G_MISS_CHAR THEN
2925 p_x_header_rec.tp_attribute5 := p_old_header_rec.tp_attribute5;
2926 END IF;
2927
2928 IF p_x_header_rec.tp_attribute6 = FND_API.G_MISS_CHAR THEN
2929 p_x_header_rec.tp_attribute6 := p_old_header_rec.tp_attribute6;
2930 END IF;
2931
2932 IF p_x_header_rec.tp_attribute7 = FND_API.G_MISS_CHAR THEN
2933 p_x_header_rec.tp_attribute7 := p_old_header_rec.tp_attribute7;
2934 END IF;
2935
2936 IF p_x_header_rec.tp_attribute8 = FND_API.G_MISS_CHAR THEN
2937 p_x_header_rec.tp_attribute8 := p_old_header_rec.tp_attribute8;
2938 END IF;
2939
2940 IF p_x_header_rec.tp_attribute9 = FND_API.G_MISS_CHAR THEN
2941 p_x_header_rec.tp_attribute9 := p_old_header_rec.tp_attribute9;
2942 END IF;
2943
2944 IF p_x_header_rec.tp_context = FND_API.G_MISS_CHAR THEN
2945 p_x_header_rec.tp_context := p_old_header_rec.tp_context;
2946 END IF;
2947 --End bug 2916613
2948
2949 IF p_x_header_rec.version_number = FND_API.G_MISS_NUM THEN
2950 p_x_header_rec.version_number := p_old_header_rec.version_number;
2951 END IF;
2952
2953 IF p_x_header_rec.payment_type_code = FND_API.G_MISS_CHAR THEN
2954 p_x_header_rec.payment_type_code := p_old_header_rec.payment_type_code;
2955 END IF;
2956
2957 IF p_x_header_rec.payment_amount = FND_API.G_MISS_NUM THEN
2958 p_x_header_rec.payment_amount := p_old_header_rec.payment_amount;
2959 END IF;
2960
2961 IF p_x_header_rec.check_number = FND_API.G_MISS_CHAR THEN
2962 p_x_header_rec.check_number := p_old_header_rec.check_number;
2963 END IF;
2964 --R12 CC Encryption
2965 --These details not stored in oe_payments table now and centrally stored in payments tables
2966 /*
2967 IF p_x_header_rec.credit_card_code = FND_API.G_MISS_CHAR THEN
2968 p_x_header_rec.credit_card_code := p_old_header_rec.credit_card_code;
2969 END IF;
2970
2971 IF p_x_header_rec.credit_card_holder_name = FND_API.G_MISS_CHAR THEN
2972 p_x_header_rec.credit_card_holder_name := p_old_header_rec.credit_card_holder_name;
2973 END IF;
2974
2975 IF p_x_header_rec.credit_card_number = FND_API.G_MISS_CHAR THEN
2976 p_x_header_rec.credit_card_number := p_old_header_rec.credit_card_number;
2977 END IF;
2978
2979 IF p_x_header_rec.credit_card_expiration_date = FND_API.G_MISS_DATE THEN
2980 p_x_header_rec.credit_card_expiration_date := p_old_header_rec.credit_card_expiration_date;
2981 END IF;
2982
2983 IF p_x_header_rec.credit_card_approval_date = FND_API.G_MISS_DATE THEN
2984 p_x_header_rec.credit_card_approval_date := p_old_header_rec.credit_card_approval_date;
2985 END IF;
2986
2987 IF p_x_header_rec.credit_card_approval_code = FND_API.G_MISS_CHAR THEN
2988 p_x_header_rec.credit_card_approval_code := p_old_header_rec.credit_card_approval_code;
2989 END IF;*/
2990 --R12 CC Encryption
2991
2992 IF p_x_header_rec.first_ack_code = FND_API.G_MISS_CHAR THEN
2993 p_x_header_rec.first_ack_code := p_old_header_rec.first_ack_code;
2994 END IF;
2995
2996 IF p_x_header_rec.first_ack_date = FND_API.G_MISS_DATE THEN
2997 p_x_header_rec.first_ack_date := p_old_header_rec.first_ack_date;
2998 END IF;
2999
3000 IF p_x_header_rec.last_ack_code = FND_API.G_MISS_CHAR THEN
3001 p_x_header_rec.last_ack_code := p_old_header_rec.last_ack_code;
3002 END IF;
3003
3004 IF p_x_header_rec.last_ack_date = FND_API.G_MISS_DATE THEN
3005 p_x_header_rec.last_ack_date := p_old_header_rec.last_ack_date;
3006 END IF;
3007
3008 IF p_x_header_rec.line_set_name = FND_API.G_MISS_CHAR THEN
3009 p_x_header_rec.line_set_name := p_old_header_rec.line_set_name;
3010 END IF;
3011
3012 IF p_x_header_rec.shipping_instructions = FND_API.G_MISS_CHAR THEN
3013 p_x_header_rec.shipping_instructions := p_old_header_rec.shipping_instructions;
3014 END IF;
3015
3016 IF p_x_header_rec.packing_instructions = FND_API.G_MISS_CHAR THEN
3017 p_x_header_rec.packing_instructions := p_old_header_rec.packing_instructions;
3018 END IF;
3019
3020 IF p_x_header_rec.marketing_source_code_id = FND_API.G_MISS_NUM THEN
3021 p_x_header_rec.marketing_source_code_id := p_old_header_rec.marketing_source_code_id;
3022 END IF;
3023
3024 IF p_x_header_rec.flow_status_code = 'ENTERED' THEN
3025 -- QUOTING change - do not override 'ENTERED' status with old
3026 -- value as status should be set to entered during complete
3027 -- negotiation call
3028 IF OE_Quote_Util.G_COMPLETE_NEG = 'N' THEN
3029 -- flow_status_code is initilized to ENTERED
3030 p_x_header_rec.flow_status_code := p_old_header_rec.flow_status_code;
3031 END IF;
3032 END IF;
3033
3034 -- QUOTING changes
3035
3036 IF p_x_header_rec.quote_date = FND_API.G_MISS_DATE THEN
3037 p_x_header_rec.quote_date := p_old_header_rec.quote_date;
3038 END IF;
3039
3040 IF p_x_header_rec.quote_number = FND_API.G_MISS_NUM THEN
3041 p_x_header_rec.quote_number := p_old_header_rec.quote_number;
3042 END IF;
3043
3044 IF p_x_header_rec.sales_document_name = FND_API.G_MISS_CHAR THEN
3045 p_x_header_rec.sales_document_name := p_old_header_rec.sales_document_name;
3046 END IF;
3047
3048 IF p_x_header_rec.transaction_phase_code = FND_API.G_MISS_CHAR THEN
3049 p_x_header_rec.transaction_phase_code := p_old_header_rec.transaction_phase_code;
3050 END IF;
3051
3052 IF p_x_header_rec.user_status_code = FND_API.G_MISS_CHAR THEN
3053 p_x_header_rec.user_status_code := p_old_header_rec.user_status_code;
3054 END IF;
3055
3056 IF p_x_header_rec.draft_submitted_flag = FND_API.G_MISS_CHAR THEN
3057 p_x_header_rec.draft_submitted_flag := p_old_header_rec.draft_submitted_flag;
3058 END IF;
3059
3060 IF p_x_header_rec.source_document_version_number = FND_API.G_MISS_NUM THEN
3061 p_x_header_rec.source_document_version_number := p_old_header_rec.source_document_version_number;
3062 END IF;
3063
3064 IF p_x_header_rec.sold_to_site_use_id = FND_API.G_MISS_NUM THEN
3065 p_x_header_rec.sold_to_site_use_id := p_old_header_rec.sold_to_site_use_id;
3066 END IF;
3067
3068 -- QUOTING changes END
3069
3070
3071 IF p_x_header_rec.Minisite_id = FND_API.G_MISS_NUM THEN
3072 p_x_header_rec.Minisite_id := p_old_header_rec.Minisite_id;
3073 END IF;
3074
3075 IF p_x_header_rec.End_customer_id = FND_API.G_MISS_NUM THEN
3076 p_x_header_rec.End_customer_id := p_old_header_rec.End_customer_id;
3077 END IF;
3078
3079 IF p_x_header_rec.End_customer_contact_id = FND_API.G_MISS_NUM THEN
3080 p_x_header_rec.End_customer_contact_id := p_old_header_rec.End_customer_contact_id;
3081 END IF;
3082
3083 IF p_x_header_rec.End_customer_site_use_id = FND_API.G_MISS_NUM THEN
3084 p_x_header_rec.End_customer_site_use_id := p_old_header_rec.End_customer_site_use_id;
3085 END IF;
3086
3087 IF p_x_header_rec.Ib_owner = FND_API.G_MISS_CHAR THEN
3088 p_x_header_rec.Ib_owner := p_old_header_rec.Ib_owner;
3089 END IF;
3090
3091 IF p_x_header_rec.Ib_installed_at_location = FND_API.G_MISS_CHAR THEN
3092 p_x_header_rec.Ib_installed_at_location := p_old_header_rec.Ib_installed_at_location;
3093 END IF;
3094
3095 IF p_x_header_rec.Ib_current_location= FND_API.G_MISS_CHAR THEN
3096 p_x_header_rec.Ib_current_location := p_old_header_rec.Ib_current_location;
3097 END IF;
3098
3099 IF p_x_header_rec.supplier_signature= FND_API.G_MISS_CHAR THEN
3100 p_x_header_rec.supplier_signature := p_old_header_rec.supplier_signature;
3101 END IF;
3102
3103 IF p_x_header_rec.supplier_signature_date= FND_API.G_MISS_DATE THEN
3104 p_x_header_rec.supplier_signature_date := p_old_header_rec.supplier_signature_date;
3105 END IF;
3106
3107 IF p_x_header_rec.customer_signature= FND_API.G_MISS_CHAR THEN
3108 p_x_header_rec.customer_signature := p_old_header_rec.customer_signature;
3109 END IF;
3110
3111 IF p_x_header_rec.customer_signature_date= FND_API.G_MISS_DATE THEN
3112 p_x_header_rec.customer_signature_date := p_old_header_rec.customer_signature_date;
3113 END IF;
3114
3115 /* Contract related changes */
3116
3117 IF p_x_header_rec.contract_template_id = FND_API.G_MISS_NUM THEN
3118 p_x_header_rec.contract_template_id := p_old_header_rec.contract_template_id;
3119 END IF;
3120
3121 IF p_x_header_rec.contract_source_doc_type_code = FND_API.G_MISS_CHAR THEN
3122 p_x_header_rec.contract_source_doc_type_code := p_old_header_rec.contract_source_doc_type_code;
3123 END IF;
3124
3125 IF p_x_header_rec.contract_source_document_id = FND_API.G_MISS_NUM THEN
3126 p_x_header_rec.contract_source_document_id := p_old_header_rec.contract_source_document_id;
3127 END IF;
3128
3129 --key Transaction Dates
3130 IF p_x_header_rec.order_firmed_date = FND_API.G_MISS_DATE THEN
3131 p_x_header_rec.order_firmed_date := p_old_header_rec.order_firmed_date;
3132 END IF;
3133 oe_debug_pub.add('Exiting OE_HEADER_UTIL.COMPLETE_RECORD', 1);
3134
3135
3136 END Complete_Record;
3137
3138 -- Procedure Convert_Miss_To_Null
3139
3140 PROCEDURE Convert_Miss_To_Null
3141 ( p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
3142 )
3143 IS
3144 --p_x_header_rec OE_Order_PUB.Header_Rec_Type := p_header_rec;
3145 BEGIN
3146
3147 oe_debug_pub.add('Entering OE_HEADER_UTIL.CONVERT_MISS_TO_NULL', 1);
3148
3149 IF p_x_header_rec.accounting_rule_id = FND_API.G_MISS_NUM THEN
3150 p_x_header_rec.accounting_rule_id := NULL;
3151 END IF;
3152
3153 IF p_x_header_rec.accounting_rule_duration = FND_API.G_MISS_NUM THEN
3154 p_x_header_rec.accounting_rule_duration := NULL;
3155 END IF;
3156
3157 IF p_x_header_rec.agreement_id = FND_API.G_MISS_NUM THEN
3158 p_x_header_rec.agreement_id := NULL;
3159 END IF;
3160
3161 IF p_x_header_rec.blanket_number = FND_API.G_MISS_NUM THEN
3162 p_x_header_rec.blanket_number := NULL;
3163 END IF;
3164
3165 IF p_x_header_rec.booked_flag = FND_API.G_MISS_CHAR THEN
3166 p_x_header_rec.booked_flag := NULL;
3167 END IF;
3168
3169 IF p_x_header_rec.upgraded_flag = FND_API.G_MISS_CHAR THEN
3170 p_x_header_rec.upgraded_flag := NULL;
3171 END IF;
3172
3173 IF p_x_header_rec.booked_date = FND_API.G_MISS_DATE THEN
3174 p_x_header_rec.booked_date := NULL;
3175 END IF;
3176
3177 IF p_x_header_rec.cancelled_flag = FND_API.G_MISS_CHAR THEN
3178 p_x_header_rec.cancelled_flag := NULL;
3179 END IF;
3180
3181 IF p_x_header_rec.attribute1 = FND_API.G_MISS_CHAR THEN
3182 p_x_header_rec.attribute1 := NULL;
3183 END IF;
3184
3185 IF p_x_header_rec.attribute10 = FND_API.G_MISS_CHAR THEN
3186 p_x_header_rec.attribute10 := NULL;
3187 END IF;
3188
3189 IF p_x_header_rec.attribute11 = FND_API.G_MISS_CHAR THEN
3190 p_x_header_rec.attribute11 := NULL;
3191 END IF;
3192
3193 IF p_x_header_rec.attribute12 = FND_API.G_MISS_CHAR THEN
3194 p_x_header_rec.attribute12 := NULL;
3195 END IF;
3196
3197 IF p_x_header_rec.attribute13 = FND_API.G_MISS_CHAR THEN
3198 p_x_header_rec.attribute13 := NULL;
3199 END IF;
3200
3201 IF p_x_header_rec.attribute14 = FND_API.G_MISS_CHAR THEN
3202 p_x_header_rec.attribute14 := NULL;
3203 END IF;
3204
3205 IF p_x_header_rec.attribute15 = FND_API.G_MISS_CHAR THEN
3206 p_x_header_rec.attribute15 := NULL;
3207 END IF;
3208
3209 IF p_x_header_rec.attribute16 = FND_API.G_MISS_CHAR THEN --For bug 2184255
3210 p_x_header_rec.attribute16 := NULL;
3211 END IF;
3212
3213 IF p_x_header_rec.attribute17 = FND_API.G_MISS_CHAR THEN
3214 p_x_header_rec.attribute17 := NULL;
3215 END IF;
3216
3217 IF p_x_header_rec.attribute18 = FND_API.G_MISS_CHAR THEN
3218 p_x_header_rec.attribute18 := NULL;
3219 END IF;
3220
3221 IF p_x_header_rec.attribute19 = FND_API.G_MISS_CHAR THEN
3222 p_x_header_rec.attribute19 := NULL;
3223 END IF;
3224
3225 IF p_x_header_rec.attribute2 = FND_API.G_MISS_CHAR THEN
3226 p_x_header_rec.attribute2 := NULL;
3227 END IF;
3228
3229 IF p_x_header_rec.attribute20 = FND_API.G_MISS_CHAR THEN --For bug 2184255
3230 p_x_header_rec.attribute20 := NULL;
3231 END IF;
3232
3233 IF p_x_header_rec.attribute3 = FND_API.G_MISS_CHAR THEN
3234 p_x_header_rec.attribute3 := NULL;
3235 END IF;
3236
3237 IF p_x_header_rec.attribute4 = FND_API.G_MISS_CHAR THEN
3238 p_x_header_rec.attribute4 := NULL;
3239 END IF;
3240
3241 IF p_x_header_rec.attribute5 = FND_API.G_MISS_CHAR THEN
3242 p_x_header_rec.attribute5 := NULL;
3243 END IF;
3244
3245 IF p_x_header_rec.attribute6 = FND_API.G_MISS_CHAR THEN
3246 p_x_header_rec.attribute6 := NULL;
3247 END IF;
3248
3249 IF p_x_header_rec.attribute7 = FND_API.G_MISS_CHAR THEN
3250 p_x_header_rec.attribute7 := NULL;
3251 END IF;
3252
3253 IF p_x_header_rec.attribute8 = FND_API.G_MISS_CHAR THEN
3254 p_x_header_rec.attribute8 := NULL;
3255 END IF;
3256
3257 IF p_x_header_rec.attribute9 = FND_API.G_MISS_CHAR THEN
3258 p_x_header_rec.attribute9 := NULL;
3259 END IF;
3260
3261 IF p_x_header_rec.context = FND_API.G_MISS_CHAR THEN
3262 p_x_header_rec.context := NULL;
3263 END IF;
3264
3265 IF p_x_header_rec.conversion_rate = FND_API.G_MISS_NUM THEN
3266 p_x_header_rec.conversion_rate := NULL;
3267 END IF;
3268
3269 IF p_x_header_rec.conversion_rate_date = FND_API.G_MISS_DATE THEN
3270 p_x_header_rec.conversion_rate_date := NULL;
3271 END IF;
3272
3273 IF p_x_header_rec.conversion_type_code = FND_API.G_MISS_CHAR THEN
3274 p_x_header_rec.conversion_type_code := NULL;
3275 END IF;
3276
3277 IF p_x_header_rec.CUSTOMER_PREFERENCE_SET_CODE = FND_API.G_MISS_CHAR THEN
3278 p_x_header_rec.CUSTOMER_PREFERENCE_SET_CODE := NULL;
3279 END IF;
3280
3281 IF p_x_header_rec.created_by = FND_API.G_MISS_NUM THEN
3282 p_x_header_rec.created_by := NULL;
3283 END IF;
3284
3285 IF p_x_header_rec.creation_date = FND_API.G_MISS_DATE THEN
3286 p_x_header_rec.creation_date := NULL;
3287 END IF;
3288
3289 IF p_x_header_rec.cust_po_number = FND_API.G_MISS_CHAR THEN
3290 p_x_header_rec.cust_po_number := NULL;
3291 END IF;
3292
3293 IF p_x_header_rec.default_fulfillment_set = FND_API.G_MISS_CHAR THEN
3294 p_x_header_rec.default_fulfillment_set := NULL;
3295 END IF;
3296
3297 IF p_x_header_rec.deliver_to_contact_id = FND_API.G_MISS_NUM THEN
3298 p_x_header_rec.deliver_to_contact_id := NULL;
3299 END IF;
3300
3301 IF p_x_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM THEN
3302 p_x_header_rec.deliver_to_org_id := NULL;
3303 END IF;
3304
3305 IF p_x_header_rec.demand_class_code = FND_API.G_MISS_CHAR THEN
3306 p_x_header_rec.demand_class_code := NULL;
3307 END IF;
3308
3309 IF p_x_header_rec.expiration_date = FND_API.G_MISS_DATE THEN
3310 p_x_header_rec.expiration_date := NULL;
3311 END IF;
3312
3313 IF p_x_header_rec.earliest_schedule_limit = FND_API.G_MISS_NUM THEN
3314 p_x_header_rec.earliest_schedule_limit := NULL;
3315 END IF;
3316
3317 IF p_x_header_rec.fob_point_code = FND_API.G_MISS_CHAR THEN
3318 p_x_header_rec.fob_point_code := NULL;
3319 END IF;
3320
3321 IF p_x_header_rec.freight_carrier_code = FND_API.G_MISS_CHAR THEN
3322 p_x_header_rec.freight_carrier_code := NULL;
3323 END IF;
3324
3325 IF p_x_header_rec.freight_terms_code = FND_API.G_MISS_CHAR THEN
3326 p_x_header_rec.freight_terms_code := NULL;
3327 END IF;
3328
3329 IF p_x_header_rec.fulfillment_set_name = FND_API.G_MISS_CHAR THEN
3330 p_x_header_rec.fulfillment_set_name := NULL;
3331 END IF;
3332
3333 IF p_x_header_rec.global_attribute1 = FND_API.G_MISS_CHAR THEN
3334 p_x_header_rec.global_attribute1 := NULL;
3335 END IF;
3336
3337 IF p_x_header_rec.global_attribute10 = FND_API.G_MISS_CHAR THEN
3338 p_x_header_rec.global_attribute10 := NULL;
3339 END IF;
3340
3341 IF p_x_header_rec.global_attribute11 = FND_API.G_MISS_CHAR THEN
3342 p_x_header_rec.global_attribute11 := NULL;
3343 END IF;
3344
3345 IF p_x_header_rec.global_attribute12 = FND_API.G_MISS_CHAR THEN
3346 p_x_header_rec.global_attribute12 := NULL;
3347 END IF;
3348
3349 IF p_x_header_rec.global_attribute13 = FND_API.G_MISS_CHAR THEN
3350 p_x_header_rec.global_attribute13 := NULL;
3351 END IF;
3352
3353 IF p_x_header_rec.global_attribute14 = FND_API.G_MISS_CHAR THEN
3354 p_x_header_rec.global_attribute14 := NULL;
3355 END IF;
3356
3357 IF p_x_header_rec.global_attribute15 = FND_API.G_MISS_CHAR THEN
3358 p_x_header_rec.global_attribute15 := NULL;
3359 END IF;
3360
3361 IF p_x_header_rec.global_attribute16 = FND_API.G_MISS_CHAR THEN
3362 p_x_header_rec.global_attribute16 := NULL;
3363 END IF;
3364
3365 IF p_x_header_rec.global_attribute17 = FND_API.G_MISS_CHAR THEN
3366 p_x_header_rec.global_attribute17 := NULL;
3367 END IF;
3368
3369 IF p_x_header_rec.global_attribute18 = FND_API.G_MISS_CHAR THEN
3370 p_x_header_rec.global_attribute18 := NULL;
3371 END IF;
3372
3373 IF p_x_header_rec.global_attribute19 = FND_API.G_MISS_CHAR THEN
3374 p_x_header_rec.global_attribute19 := NULL;
3375 END IF;
3376
3377 IF p_x_header_rec.global_attribute2 = FND_API.G_MISS_CHAR THEN
3378 p_x_header_rec.global_attribute2 := NULL;
3379 END IF;
3380
3381 IF p_x_header_rec.global_attribute20 = FND_API.G_MISS_CHAR THEN
3382 p_x_header_rec.global_attribute20 := NULL;
3383 END IF;
3384
3385 IF p_x_header_rec.global_attribute3 = FND_API.G_MISS_CHAR THEN
3386 p_x_header_rec.global_attribute3 := NULL;
3387 END IF;
3388
3389 IF p_x_header_rec.global_attribute4 = FND_API.G_MISS_CHAR THEN
3390 p_x_header_rec.global_attribute4 := NULL;
3391 END IF;
3392
3393 IF p_x_header_rec.global_attribute5 = FND_API.G_MISS_CHAR THEN
3394 p_x_header_rec.global_attribute5 := NULL;
3395 END IF;
3396
3397 IF p_x_header_rec.global_attribute6 = FND_API.G_MISS_CHAR THEN
3398 p_x_header_rec.global_attribute6 := NULL;
3399 END IF;
3400
3401 IF p_x_header_rec.global_attribute7 = FND_API.G_MISS_CHAR THEN
3402 p_x_header_rec.global_attribute7 := NULL;
3403 END IF;
3404
3405 IF p_x_header_rec.global_attribute8 = FND_API.G_MISS_CHAR THEN
3406 p_x_header_rec.global_attribute8 := NULL;
3407 END IF;
3408
3409 IF p_x_header_rec.global_attribute9 = FND_API.G_MISS_CHAR THEN
3410 p_x_header_rec.global_attribute9 := NULL;
3411 END IF;
3412
3413 IF p_x_header_rec.global_attribute_category = FND_API.G_MISS_CHAR THEN
3414 p_x_header_rec.global_attribute_category := NULL;
3415 END IF;
3416
3417 IF p_x_header_rec.header_id = FND_API.G_MISS_NUM THEN
3418 p_x_header_rec.header_id := NULL;
3419 END IF;
3420
3421 IF p_x_header_rec.invoice_to_contact_id = FND_API.G_MISS_NUM THEN
3422 p_x_header_rec.invoice_to_contact_id := NULL;
3423 END IF;
3424
3425 IF p_x_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM THEN
3426 p_x_header_rec.invoice_to_org_id := NULL;
3427 END IF;
3428
3429 IF p_x_header_rec.invoicing_rule_id = FND_API.G_MISS_NUM THEN
3430 p_x_header_rec.invoicing_rule_id := NULL;
3431 END IF;
3432
3433 IF p_x_header_rec.last_updated_by = FND_API.G_MISS_NUM THEN
3434 p_x_header_rec.last_updated_by := NULL;
3435 END IF;
3436
3437 IF p_x_header_rec.last_update_date = FND_API.G_MISS_DATE THEN
3438 p_x_header_rec.last_update_date := NULL;
3439 END IF;
3440
3441 IF p_x_header_rec.last_update_login = FND_API.G_MISS_NUM THEN
3442 p_x_header_rec.last_update_login := NULL;
3443 END IF;
3444
3445
3446 IF p_x_header_rec.latest_schedule_limit = FND_API.G_MISS_NUM THEN
3447 p_x_header_rec.latest_schedule_limit := NULL;
3448 END IF;
3449
3450 IF p_x_header_rec.line_set_name = FND_API.G_MISS_CHAR THEN
3451 p_x_header_rec.line_set_name := NULL;
3452 END IF;
3453
3454 IF p_x_header_rec.open_flag = FND_API.G_MISS_CHAR THEN
3455 p_x_header_rec.open_flag := NULL;
3456 END IF;
3457
3458 IF p_x_header_rec.ordered_date = FND_API.G_MISS_DATE THEN
3459 p_x_header_rec.ordered_date := NULL;
3460 END IF;
3461
3462 IF p_x_header_rec.order_date_type_code = FND_API.G_MISS_CHAR THEN
3463 p_x_header_rec.order_date_type_code := NULL;
3464 END IF;
3465
3466 IF p_x_header_rec.order_number = FND_API.G_MISS_NUM THEN
3467 p_x_header_rec.order_number := NULL;
3468 END IF;
3469
3470 IF p_x_header_rec.order_source_id = FND_API.G_MISS_NUM THEN
3471 p_x_header_rec.order_source_id := NULL;
3472 END IF;
3473
3474 IF p_x_header_rec.order_type_id = FND_API.G_MISS_NUM THEN
3475 p_x_header_rec.order_type_id := NULL;
3476 END IF;
3477 IF p_x_header_rec.order_category_code = FND_API.G_MISS_CHAR THEN
3478 p_x_header_rec.order_category_code := NULL;
3479 END IF;
3480
3481 IF p_x_header_rec.org_id = FND_API.G_MISS_NUM THEN
3482 p_x_header_rec.org_id := NULL;
3483 END IF;
3484
3485 IF p_x_header_rec.orig_sys_document_ref = FND_API.G_MISS_CHAR THEN
3486 p_x_header_rec.orig_sys_document_ref := NULL;
3487 END IF;
3488
3489 IF p_x_header_rec.partial_shipments_allowed = FND_API.G_MISS_CHAR THEN
3490 p_x_header_rec.partial_shipments_allowed := NULL;
3491 END IF;
3492
3493 IF p_x_header_rec.payment_term_id = FND_API.G_MISS_NUM THEN
3494 p_x_header_rec.payment_term_id := NULL;
3495 END IF;
3496
3497 IF p_x_header_rec.price_list_id = FND_API.G_MISS_NUM THEN
3498 p_x_header_rec.price_list_id := NULL;
3499 END IF;
3500
3501 IF p_x_header_rec.price_request_code = FND_API.G_MISS_CHAR THEN -- PROMOTIONS SEP/01
3502 p_x_header_rec.price_request_code := NULL;
3503 END IF;
3504
3505 IF p_x_header_rec.pricing_date = FND_API.G_MISS_DATE THEN
3506 p_x_header_rec.pricing_date := NULL;
3507 END IF;
3508
3509 IF p_x_header_rec.program_application_id = FND_API.G_MISS_NUM THEN
3510 p_x_header_rec.program_application_id := NULL;
3511 END IF;
3512
3513 IF p_x_header_rec.program_id = FND_API.G_MISS_NUM THEN
3514 p_x_header_rec.program_id := NULL;
3515 END IF;
3516
3517 IF p_x_header_rec.program_update_date = FND_API.G_MISS_DATE THEN
3518 p_x_header_rec.program_update_date := NULL;
3519 END IF;
3520
3521 IF p_x_header_rec.request_date = FND_API.G_MISS_DATE THEN
3522 p_x_header_rec.request_date := NULL;
3523 END IF;
3524
3525 IF p_x_header_rec.request_id = FND_API.G_MISS_NUM THEN
3526 p_x_header_rec.request_id := NULL;
3527 END IF;
3528
3529 IF p_x_header_rec.return_reason_code = FND_API.G_MISS_CHAR THEN
3530 p_x_header_rec.return_reason_code := NULL;
3531 END IF;
3532
3533 IF p_x_header_rec.salesrep_id = FND_API.G_MISS_NUM THEN
3534 p_x_header_rec.salesrep_id := NULL;
3535 END IF;
3536
3537 IF p_x_header_rec.sales_channel_code = FND_API.G_MISS_CHAR THEN
3538 p_x_header_rec.sales_channel_code := NULL;
3539 END IF;
3540
3541 IF p_x_header_rec.shipment_priority_code = FND_API.G_MISS_CHAR THEN
3542 p_x_header_rec.shipment_priority_code := NULL;
3543 END IF;
3544
3545 IF p_x_header_rec.shipping_method_code = FND_API.G_MISS_CHAR THEN
3546 p_x_header_rec.shipping_method_code := NULL;
3547 END IF;
3548
3549 IF p_x_header_rec.ship_from_org_id = FND_API.G_MISS_NUM THEN
3550 p_x_header_rec.ship_from_org_id := NULL;
3551 END IF;
3552
3553 IF p_x_header_rec.ship_tolerance_above = FND_API.G_MISS_NUM THEN
3554 p_x_header_rec.ship_tolerance_above := NULL;
3555 END IF;
3556
3557 IF p_x_header_rec.ship_tolerance_below = FND_API.G_MISS_NUM THEN
3558 p_x_header_rec.ship_tolerance_below := NULL;
3559 END IF;
3560
3561 IF p_x_header_rec.ship_to_contact_id = FND_API.G_MISS_NUM THEN
3562 p_x_header_rec.ship_to_contact_id := NULL;
3563 END IF;
3564
3565 IF p_x_header_rec.ship_to_org_id = FND_API.G_MISS_NUM THEN
3566 p_x_header_rec.ship_to_org_id := NULL;
3567 END IF;
3568
3569 IF p_x_header_rec.sold_from_org_id = FND_API.G_MISS_NUM THEN
3570 p_x_header_rec.sold_from_org_id := NULL;
3571 END IF;
3572
3573 IF p_x_header_rec.sold_to_contact_id = FND_API.G_MISS_NUM THEN
3574 p_x_header_rec.sold_to_contact_id := NULL;
3575 END IF;
3576
3577 IF p_x_header_rec.sold_to_org_id = FND_API.G_MISS_NUM THEN
3578 p_x_header_rec.sold_to_org_id := NULL;
3579 END IF;
3580
3581 IF p_x_header_rec.sold_to_phone_id = FND_API.G_MISS_NUM THEN
3582 p_x_header_rec.sold_to_phone_id := NULL;
3583 END IF;
3584
3585 IF p_x_header_rec.source_document_id = FND_API.G_MISS_NUM THEN
3586 p_x_header_rec.source_document_id := NULL;
3587 END IF;
3588
3589 IF p_x_header_rec.source_document_type_id = FND_API.G_MISS_NUM THEN
3590 p_x_header_rec.source_document_type_id := NULL;
3591 END IF;
3592
3593 IF p_x_header_rec.tax_exempt_flag = FND_API.G_MISS_CHAR THEN
3594 p_x_header_rec.tax_exempt_flag := NULL;
3595 END IF;
3596
3597 IF p_x_header_rec.tax_exempt_number = FND_API.G_MISS_CHAR THEN
3598 p_x_header_rec.tax_exempt_number := NULL;
3599 END IF;
3600
3601 IF p_x_header_rec.tax_exempt_reason_code = FND_API.G_MISS_CHAR THEN
3602 p_x_header_rec.tax_exempt_reason_code := NULL;
3603 END IF;
3604
3605 IF p_x_header_rec.tax_point_code = FND_API.G_MISS_CHAR THEN
3606 p_x_header_rec.tax_point_code := NULL;
3607 END IF;
3608
3609 IF p_x_header_rec.transactional_curr_code = FND_API.G_MISS_CHAR THEN
3610 p_x_header_rec.transactional_curr_code := NULL;
3611 END IF;
3612
3613 IF p_x_header_rec.version_number = FND_API.G_MISS_NUM THEN
3614 p_x_header_rec.version_number := NULL;
3615 END IF;
3616
3617 IF p_x_header_rec.payment_type_code = FND_API.G_MISS_CHAR THEN
3618 p_x_header_rec.payment_type_code := NULL;
3619 END IF;
3620
3621 IF p_x_header_rec.payment_amount = FND_API.G_MISS_NUM THEN
3622 p_x_header_rec.payment_amount := NULL;
3623 END IF;
3624
3625 IF p_x_header_rec.check_number = FND_API.G_MISS_CHAR THEN
3626 p_x_header_rec.check_number := NULL;
3627 END IF;
3628 --R12 CC Encryption
3629 --These details not stored in oe_payments table now and centrally stored in payments tables
3630 /*
3631 IF p_x_header_rec.credit_card_code = FND_API.G_MISS_CHAR THEN
3632 p_x_header_rec.credit_card_code := NULL;
3633 END IF;
3634
3635 IF p_x_header_rec.credit_card_holder_name = FND_API.G_MISS_CHAR THEN
3636 p_x_header_rec.credit_card_holder_name := NULL;
3637 END IF;
3638
3639 IF p_x_header_rec.credit_card_number = FND_API.G_MISS_CHAR THEN
3640 p_x_header_rec.credit_card_number := NULL;
3641 END IF;
3642
3643 IF p_x_header_rec.credit_card_expiration_date = FND_API.G_MISS_DATE THEN
3644 p_x_header_rec.credit_card_expiration_date := NULL;
3645 END IF;
3646
3647 IF p_x_header_rec.credit_card_approval_date = FND_API.G_MISS_DATE THEN
3648 p_x_header_rec.credit_card_approval_date := NULL;
3649 END IF;
3650
3651 IF p_x_header_rec.credit_card_approval_code = FND_API.G_MISS_CHAR THEN
3652 p_x_header_rec.credit_card_approval_code := NULL;
3653 END IF;*/
3654 --R12 CC Encryption
3655
3656 IF p_x_header_rec.first_ack_code = FND_API.G_MISS_CHAR THEN
3657 p_x_header_rec.first_ack_code := NULL;
3658 END IF;
3659
3660 IF p_x_header_rec.first_ack_date = FND_API.G_MISS_DATE THEN
3661 p_x_header_rec.first_ack_date := NULL;
3662 END IF;
3663
3664 IF p_x_header_rec.last_ack_code = FND_API.G_MISS_CHAR THEN
3665 p_x_header_rec.last_ack_code := NULL;
3666 END IF;
3667
3668 IF p_x_header_rec.last_ack_date = FND_API.G_MISS_DATE THEN
3669 p_x_header_rec.last_ack_date := NULL;
3670 END IF;
3671
3672 IF p_x_header_rec.shipping_instructions = FND_API.G_MISS_CHAR THEN
3673 p_x_header_rec.shipping_instructions := NULL;
3674 END IF;
3675
3676 IF p_x_header_rec.packing_instructions = FND_API.G_MISS_CHAR THEN
3677 p_x_header_rec.packing_instructions := NULL;
3678 END IF;
3679
3680 IF p_x_header_rec.flow_status_code = FND_API.G_MISS_CHAR THEN
3681 p_x_header_rec.flow_status_code := NULL;
3682 END IF;
3683
3684 IF p_x_header_rec.marketing_source_code_id = FND_API.G_MISS_NUM THEN
3685 p_x_header_rec.marketing_source_code_id := NULL;
3686 END IF;
3687
3688 IF p_x_header_rec.change_sequence = FND_API.G_MISS_CHAR THEN --2416561
3689 p_x_header_rec.change_sequence := NULL;
3690 END IF;
3691
3692 -- QUOTING changes
3693
3694 IF p_x_header_rec.quote_date = FND_API.G_MISS_DATE THEN
3695 p_x_header_rec.quote_date := NULL;
3696 END IF;
3697
3698 IF p_x_header_rec.quote_number = FND_API.G_MISS_NUM THEN
3699 p_x_header_rec.quote_number := NULL;
3700 END IF;
3701
3702 IF p_x_header_rec.sales_document_name = FND_API.G_MISS_CHAR THEN
3703 p_x_header_rec.sales_document_name := NULL;
3704 END IF;
3705
3706 IF p_x_header_rec.transaction_phase_code = FND_API.G_MISS_CHAR THEN
3707 p_x_header_rec.transaction_phase_code := NULL;
3708 END IF;
3709
3710 IF p_x_header_rec.user_status_code = FND_API.G_MISS_CHAR THEN
3711 p_x_header_rec.user_status_code := NULL;
3712 END IF;
3713
3714 IF p_x_header_rec.draft_submitted_flag = FND_API.G_MISS_CHAR THEN
3715 p_x_header_rec.draft_submitted_flag := NULL;
3716 END IF;
3717
3718 IF p_x_header_rec.source_document_version_number = FND_API.G_MISS_NUM THEN
3719 p_x_header_rec.source_document_version_number := NULL;
3720 END IF;
3721
3722 IF p_x_header_rec.sold_to_site_use_id = FND_API.G_MISS_NUM THEN
3723 p_x_header_rec.sold_to_site_use_id := NULL;
3724 END IF;
3725
3726 -- QUOTING changes END
3727
3728 IF p_x_header_rec.Minisite_id = FND_API.G_MISS_NUM THEN
3729 p_x_header_rec.Minisite_id := NULL;
3730 END IF;
3731
3732 IF p_x_header_rec.End_customer_id = FND_API.G_MISS_NUM THEN
3733 p_x_header_rec.End_customer_id := NULL;
3734 END IF;
3735
3736 IF p_x_header_rec.End_customer_contact_id = FND_API.G_MISS_NUM THEN
3737 p_x_header_rec.End_customer_contact_id := NULL;
3738 END IF;
3739
3740 IF p_x_header_rec.End_customer_site_use_id = FND_API.G_MISS_NUM THEN
3741 p_x_header_rec.End_customer_site_use_id := NULL;
3742 END IF;
3743
3744 IF p_x_header_rec.Ib_owner = FND_API.G_MISS_CHAR THEN
3745 p_x_header_rec.Ib_owner := NULL;
3746 END IF;
3747
3748 IF p_x_header_rec.Ib_installed_at_location = FND_API.G_MISS_CHAR THEN
3749 p_x_header_rec.Ib_installed_at_location := NULL;
3750 END IF;
3751
3752 IF p_x_header_rec.Ib_current_location = FND_API.G_MISS_CHAR THEN
3753 p_x_header_rec.Ib_current_location := NULL;
3754 END IF;
3755
3756 IF p_x_header_rec.supplier_signature = FND_API.G_MISS_CHAR THEN
3757 p_x_header_rec.supplier_signature := NULL;
3758 END IF;
3759
3760 IF p_x_header_rec.supplier_signature_date = FND_API.G_MISS_DATE THEN
3761 p_x_header_rec.supplier_signature_date := NULL;
3762 END IF;
3763
3764 IF p_x_header_rec.customer_signature = FND_API.G_MISS_CHAR THEN
3765 p_x_header_rec.customer_signature := NULL;
3766 END IF;
3767
3768 IF p_x_header_rec.customer_signature_date = FND_API.G_MISS_DATE THEN
3769 p_x_header_rec.customer_signature_date := NULL;
3770 END IF;
3771
3772 IF p_x_header_rec.contract_template_id = FND_API.G_MISS_NUM THEN
3773 p_x_header_rec.contract_template_id := NULL;
3774 END IF;
3775
3776 IF p_x_header_rec.contract_source_doc_type_code = FND_API.G_MISS_CHAR THEN
3777 p_x_header_rec.contract_source_doc_type_code := NULL;
3778 END IF;
3779
3780 IF p_x_header_rec.contract_source_document_id = FND_API.G_MISS_NUM THEN
3781 p_x_header_rec.contract_source_document_id := NULL;
3782 END IF;
3783
3784 --key Transaction dates
3785 IF p_x_header_rec.order_firmed_date = FND_API.G_MISS_DATE THEN
3786 p_x_header_rec.order_firmed_date := NULL;
3787 END IF;
3788
3789 oe_debug_pub.add('Exiting OE_HEADER_UTIL.CONVERT_MISS_TO_NULL', 1);
3790
3791
3792 END Convert_Miss_To_Null;
3793
3794 -- Procedure Update_Row
3795
3796 PROCEDURE Update_Row
3797 ( p_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
3798 )
3799 IS
3800 l_org_id NUMBER;
3801 l_lock_control NUMBER;
3802 -- added for notification framework
3803 l_index NUMBER;
3804 l_return_status VARCHAR2(1);
3805 BEGIN
3806
3807 oe_debug_pub.add('Entering OE_HEADER_UTIL.UPDATE_ROW', 1);
3808 --Commented for MOAC start
3809 /*l_org_id := OE_GLOBALS.G_ORG_ID;
3810
3811 IF l_org_id IS NULL THEN
3812 OE_GLOBALS.Set_Context;
3813 l_org_id := OE_GLOBALS.G_ORG_ID;
3814 END IF;*/
3815 --Commented for MOAC end
3816 -- we need to increment lock_control by 1,
3817 -- everytime there is an update on the record.
3818
3819 SELECT lock_control
3820 INTO l_lock_control
3821 FROM OE_ORDER_HEADERS
3822 WHERE header_id = p_header_rec.header_id;
3823
3824 l_lock_control := l_lock_control + 1;
3825
3826 -- calling notification framework to update global picture
3827 -- check code release level first. Notification framework is at Pack H level
3828 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110508' THEN
3829 OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists => True,
3830 p_Header_rec =>p_header_rec,
3831 p_header_id => p_header_rec.header_id,
3832 x_index => l_index,
3833 x_return_status => l_return_status);
3834
3835 OE_DEBUG_PUB.ADD('Update_Global Return Status from OE_HEADER_UTIL.update_row is: ' || l_return_status);
3836 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3837 OE_DEBUG_PUB.ADD('EVENT NOTIFY - Unexpected Error');
3838 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.Update_ROW', 1);
3839 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3840 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
3841 OE_DEBUG_PUB.ADD('Update_Global_Picture Error in OE_HEADER_UTIL.Update_row');
3842 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.Update_ROW', 1);
3843 RAISE FND_API.G_EXC_ERROR;
3844 END IF;
3845 END IF; /*code_release_level*/
3846 -- notification framework end
3847
3848 UPDATE OE_ORDER_HEADERS
3849 SET ACCOUNTING_RULE_ID = p_header_rec.accounting_rule_id
3850 , ACCOUNTING_RULE_DURATION = p_header_rec.accounting_rule_duration
3851 , AGREEMENT_ID = p_header_rec.agreement_id
3852 , ATTRIBUTE1 = p_header_rec.attribute1
3853 , ATTRIBUTE10 = p_header_rec.attribute10
3854 , ATTRIBUTE11 = p_header_rec.attribute11
3855 , ATTRIBUTE12 = p_header_rec.attribute12
3856 , ATTRIBUTE13 = p_header_rec.attribute13
3857 , ATTRIBUTE14 = p_header_rec.attribute14
3858 , ATTRIBUTE15 = p_header_rec.attribute15
3859 , ATTRIBUTE16 = p_header_rec.attribute16 --For bug 2184255
3860 , ATTRIBUTE17 = p_header_rec.attribute17
3861 , ATTRIBUTE18 = p_header_rec.attribute18
3862 , ATTRIBUTE19 = p_header_rec.attribute19
3863 , ATTRIBUTE2 = p_header_rec.attribute2
3864 , ATTRIBUTE20 = p_header_rec.attribute20
3865 , ATTRIBUTE3 = p_header_rec.attribute3
3866 , ATTRIBUTE4 = p_header_rec.attribute4
3867 , ATTRIBUTE5 = p_header_rec.attribute5
3868 , ATTRIBUTE6 = p_header_rec.attribute6
3869 , ATTRIBUTE7 = p_header_rec.attribute7
3870 , ATTRIBUTE8 = p_header_rec.attribute8
3871 , ATTRIBUTE9 = p_header_rec.attribute9
3872 , BLANKET_NUMBER = p_header_rec.Blanket_Number
3873 , BOOKED_FLAG = p_header_rec.booked_flag
3874 , BOOKED_DATE = p_header_rec.booked_date
3875 , CANCELLED_FLAG = p_header_rec.cancelled_flag
3876 , CONTEXT = p_header_rec.context
3877 , CONVERSION_RATE = p_header_rec.conversion_rate
3878 , CONVERSION_RATE_DATE = p_header_rec.conversion_rate_date
3879 , CONVERSION_TYPE_CODE = p_header_rec.conversion_type_code
3880 , CUSTOMER_PREFERENCE_SET_CODE = p_header_rec.CUSTOMER_PREFERENCE_SET_CODE
3881 , CREATED_BY = p_header_rec.created_by
3882 , CREATION_DATE = p_header_rec.creation_date
3883 , CUST_PO_NUMBER = p_header_rec.cust_po_number
3884 , DELIVER_TO_CONTACT_ID = p_header_rec.deliver_to_contact_id
3885 , DELIVER_TO_ORG_ID = p_header_rec.deliver_to_org_id
3886 , DEMAND_CLASS_CODE = p_header_rec.demand_class_code
3887 , EXPIRATION_DATE = p_header_rec.expiration_date
3888 , EARLIEST_SCHEDULE_LIMIT = p_header_rec.earliest_schedule_limit
3889 , FIRST_ACK_CODE = p_header_rec.first_ack_code
3890 , FIRST_ACK_DATE = p_header_rec.first_ack_date
3891 , FOB_POINT_CODE = p_header_rec.fob_point_code
3892 , FREIGHT_CARRIER_CODE = p_header_rec.freight_carrier_code
3893 , FREIGHT_TERMS_CODE = p_header_rec.freight_terms_code
3894 , GLOBAL_ATTRIBUTE1 = p_header_rec.global_attribute1
3895 , GLOBAL_ATTRIBUTE10 = p_header_rec.global_attribute10
3896 , GLOBAL_ATTRIBUTE11 = p_header_rec.global_attribute11
3897 , GLOBAL_ATTRIBUTE12 = p_header_rec.global_attribute12
3898 , GLOBAL_ATTRIBUTE13 = p_header_rec.global_attribute13
3899 , GLOBAL_ATTRIBUTE14 = p_header_rec.global_attribute14
3900 , GLOBAL_ATTRIBUTE15 = p_header_rec.global_attribute15
3901 , GLOBAL_ATTRIBUTE16 = p_header_rec.global_attribute16
3902 , GLOBAL_ATTRIBUTE17 = p_header_rec.global_attribute17
3903 , GLOBAL_ATTRIBUTE18 = p_header_rec.global_attribute18
3904 , GLOBAL_ATTRIBUTE19 = p_header_rec.global_attribute19
3905 , GLOBAL_ATTRIBUTE2 = p_header_rec.global_attribute2
3906 , GLOBAL_ATTRIBUTE20 = p_header_rec.global_attribute20
3907 , GLOBAL_ATTRIBUTE3 = p_header_rec.global_attribute3
3908 , GLOBAL_ATTRIBUTE4 = p_header_rec.global_attribute4
3909 , GLOBAL_ATTRIBUTE5 = p_header_rec.global_attribute5
3910 , GLOBAL_ATTRIBUTE6 = p_header_rec.global_attribute6
3911 , GLOBAL_ATTRIBUTE7 = p_header_rec.global_attribute7
3912 , GLOBAL_ATTRIBUTE8 = p_header_rec.global_attribute8
3913 , GLOBAL_ATTRIBUTE9 = p_header_rec.global_attribute9
3914 , GLOBAL_ATTRIBUTE_CATEGORY = p_header_rec.global_attribute_category
3915 --, HEADER_ID = p_header_rec.header_id
3916
3917 , INVOICE_TO_CONTACT_ID = p_header_rec.invoice_to_contact_id
3918 , INVOICE_TO_ORG_ID = p_header_rec.invoice_to_org_id
3919 , INVOICING_RULE_ID = p_header_rec.invoicing_rule_id
3920 , LAST_ACK_CODE = p_header_rec.last_ack_code
3921 , LAST_ACK_DATE = p_header_rec.last_ack_date
3922 , LAST_UPDATED_BY = p_header_rec.last_updated_by
3923 , LAST_UPDATE_DATE = p_header_rec.last_update_date
3924 , LAST_UPDATE_LOGIN = p_header_rec.last_update_login
3925 , LATEST_SCHEDULE_LIMIT = p_header_rec.latest_schedule_limit
3926 , OPEN_FLAG = p_header_rec.open_flag
3927 , ORDERED_DATE = p_header_rec.ordered_date
3928 , ORDER_DATE_TYPE_CODE = p_header_rec.order_date_type_code
3929 , ORDER_NUMBER = p_header_rec.order_number
3930 , ORDER_SOURCE_ID = p_header_rec.order_source_id
3931 , ORDER_TYPE_ID = p_header_rec.order_type_id
3932 , ORDER_CATEGORY_CODE = p_header_rec.order_category_code
3933 -- Org_id should not allowed to update
3934 -- , ORG_ID = p_header_rec.org_id
3935 , ORIG_SYS_DOCUMENT_REF = p_header_rec.orig_sys_document_ref
3936 , SOURCE_DOCUMENT_ID = p_header_rec.source_document_id
3937 , SOURCE_DOCUMENT_TYPE_ID = p_header_rec.source_document_type_id
3938 , PARTIAL_SHIPMENTS_ALLOWED = p_header_rec.partial_shipments_allowed
3939 , PAYMENT_TERM_ID = p_header_rec.payment_term_id
3940 , PRICE_LIST_ID = p_header_rec.price_list_id
3941 , PRICE_REQUEST_CODE = p_header_rec.price_request_code -- PROMOTIONS SEP/01
3942 , PRICING_DATE = p_header_rec.pricing_date
3943 , PROGRAM_APPLICATION_ID = p_header_rec.program_application_id
3944 , PROGRAM_ID = p_header_rec.program_id
3945 , PROGRAM_UPDATE_DATE = p_header_rec.program_update_date
3946
3947
3948 , REQUEST_DATE = p_header_rec.request_date
3949 , REQUEST_ID = p_header_rec.request_id
3950 , RETURN_REASON_CODE = p_header_rec.return_reason_code
3951 , salesrep_id = p_header_rec.salesrep_id
3952 , SALES_CHANNEL_CODE = p_header_rec.sales_channel_code
3953 , SHIPMENT_PRIORITY_CODE = p_header_rec.shipment_priority_code
3954 , SHIPPING_METHOD_CODE = p_header_rec.shipping_method_code
3955 , SHIP_FROM_ORG_ID = p_header_rec.ship_from_org_id
3956 , SHIP_TOLERANCE_ABOVE = p_header_rec.ship_tolerance_above
3957 , SHIP_TOLERANCE_BELOW = p_header_rec.ship_tolerance_below
3958 , SHIP_TO_CONTACT_ID = p_header_rec.ship_to_contact_id
3959 , SHIP_TO_ORG_ID = p_header_rec.ship_to_org_id
3960 --, SOLD_FROM_ORG_ID = p_header_rec.sold_from_org_id
3961 , SOLD_TO_CONTACT_ID = p_header_rec.sold_to_contact_id
3962 , SOLD_TO_ORG_ID = p_header_rec.sold_to_org_id
3963 , SOLD_TO_PHONE_ID = p_header_rec.sold_to_phone_id
3964 , TAX_EXEMPT_FLAG = p_header_rec.tax_exempt_flag
3965 , TAX_EXEMPT_NUMBER = p_header_rec.tax_exempt_number
3966 , TAX_EXEMPT_REASON_CODE = p_header_rec.tax_exempt_reason_code
3967 , TAX_POINT_CODE = p_header_rec.tax_point_code
3968 , TRANSACTIONAL_CURR_CODE = p_header_rec.transactional_curr_code
3969 , VERSION_NUMBER = p_header_rec.version_number
3970 , PAYMENT_TYPE_CODE = p_header_rec.payment_type_code
3971 , PAYMENT_AMOUNT = p_header_rec.payment_amount
3972 , CHECK_NUMBER = p_header_rec.check_number
3973 /*, CREDIT_CARD_CODE = p_header_rec.credit_card_code --R12 CC Encryption
3974 , CREDIT_CARD_HOLDER_NAME = p_header_rec.credit_card_holder_name
3975 , CREDIT_CARD_NUMBER = p_header_rec.credit_card_number
3976 , CREDIT_CARD_EXPIRATION_DATE = p_header_rec.credit_card_expiration_date
3977 , CREDIT_CARD_APPROVAL_DATE = p_header_rec.credit_card_approval_date
3978 , CREDIT_CARD_APPROVAL_CODE = p_header_rec.credit_card_approval_code*/ --R12 CC Encryption
3979 , CHANGE_SEQUENCE = p_header_rec.change_sequence
3980 --, DROP_SHIP_FLAG = p_header_rec.drop_ship_flag
3981 --, CUSTOMER_PAYMENT_TERM_ID = p_header_rec.customer_payment_term_id
3982 , SHIPPING_INSTRUCTIONS = p_header_rec.shipping_instructions
3983 , PACKING_INSTRUCTIONS = p_header_rec.packing_instructions
3984 , FLOW_STATUS_CODE = p_header_rec.flow_status_code
3985 , MARKETING_SOURCE_CODE_ID = p_header_rec.marketing_source_code_id
3986 , DEFAULT_FULFILLMENT_SET = p_header_rec.default_fulfillment_set
3987 , FULFILLMENT_SET_NAME = p_header_rec.fulfillment_set_name
3988 , LINE_SET_NAME = p_header_rec.line_set_name
3989 , LOCK_CONTROL = l_lock_control
3990 , TP_CONTEXT = p_header_rec.TP_context --added for bug 3977624
3991 , TP_ATTRIBUTE1 = p_header_rec.TP_attribute1
3992 , TP_ATTRIBUTE10 = p_header_rec.TP_attribute10
3993 , TP_ATTRIBUTE11 = p_header_rec.TP_attribute11
3994 , TP_ATTRIBUTE12 = p_header_rec.TP_attribute12
3995 , TP_ATTRIBUTE13 = p_header_rec.TP_attribute13
3996 , TP_ATTRIBUTE14 = p_header_rec.TP_attribute14
3997 , TP_ATTRIBUTE15 = p_header_rec.TP_attribute15
3998 , TP_ATTRIBUTE2 = p_header_rec.TP_attribute2
3999 , TP_ATTRIBUTE3 = p_header_rec.TP_attribute3
4000 , TP_ATTRIBUTE4 = p_header_rec.TP_attribute4
4001 , TP_ATTRIBUTE5 = p_header_rec.TP_attribute5
4002 , TP_ATTRIBUTE6 = p_header_rec.TP_attribute6
4003 , TP_ATTRIBUTE7 = p_header_rec.TP_attribute7
4004 , TP_ATTRIBUTE8 = p_header_rec.TP_attribute8
4005 , TP_ATTRIBUTE9 = p_header_rec.TP_attribute9
4006 , XML_MESSAGE_ID = p_header_rec.xml_message_id
4007
4008 -- QUOTING changes
4009 , quote_date = p_header_rec.quote_date
4010 , quote_number = p_header_rec.quote_number
4011 , sales_document_name = p_header_rec.sales_document_name
4012 , transaction_phase_code = p_header_rec.transaction_phase_code
4013 , user_status_code = p_header_rec.user_status_code
4014 , draft_submitted_flag = p_header_rec.draft_submitted_flag
4015 , source_document_version_number = p_header_rec.source_document_version_number
4016 , sold_to_site_use_id = p_header_rec.sold_to_site_use_id
4017 -- QUOTING changes END
4018
4019 , Minisite_Id = p_header_rec.minisite_id
4020 , End_customer_Id = p_header_rec.End_customer_id
4021 , End_customer_contact_Id = p_header_rec.End_customer_contact_id
4022 , End_customer_site_use_Id = p_header_rec.End_customer_site_use_id
4023 , Ib_owner = p_header_rec.Ib_owner
4024 , Ib_installed_at_location = p_header_rec.Ib_installed_at_location
4025 , Ib_current_location = p_header_rec.Ib_current_location
4026 , supplier_signature = p_header_rec.supplier_signature
4027 , supplier_signature_date = p_header_rec.supplier_signature_date
4028 , customer_signature = p_header_rec.customer_signature
4029 , customer_signature_date = p_header_rec.customer_signature_date
4030 , order_firmed_date = p_header_rec.order_firmed_date --key transaction dates
4031 WHERE HEADER_ID = p_header_rec.header_id;
4032 /* AND
4033 (NVL(ORG_ID,NVL(l_org_id,0))= NVL(l_org_id,0))
4034 ;*/
4035
4036 p_header_rec.lock_control := l_lock_control;
4037
4038 -- aksingh update the operation to NULL and update the cache with
4039 -- record
4040 oe_order_cache.g_header_rec := p_header_rec;
4041 oe_order_cache.g_header_rec.operation := null;
4042
4043 -- Below line commented because as g_header_rec is now global, no need
4044 -- to call below procedure to update, updated directly above
4045
4046 -- OE_Order_Cache.Set_Order_Header(p_header_rec);
4047
4048 oe_debug_pub.add('Exiting OE_HEADER_UTIL.UPDATE_ROW', 1);
4049
4050 EXCEPTION
4051
4052 WHEN OTHERS THEN
4053
4054 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4055 THEN
4056 OE_MSG_PUB.Add_Exc_Msg
4057 ( G_PKG_NAME
4058 , 'Update_Row'
4059 );
4060 END IF;
4061
4062 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4063
4064 END Update_Row;
4065
4066 -- Procedure Insert_Row
4067
4068 PROCEDURE Insert_Row
4069 ( p_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
4070 )
4071 IS
4072 l_org_id NUMBER;
4073 l_upgraded_flag varchar2(1) ;
4074 l_lock_control NUMBER := 1;
4075 l_index NUMBER;
4076 l_return_status VARCHAR2(1);
4077 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4078 BEGIN
4079
4080 oe_debug_pub.add('Entering OE_HEADER_UTIL.INSERT_ROW', 1);
4081
4082 --MOAC change
4083 OE_GLOBALS.Set_Context;
4084 l_org_id := OE_GLOBALS.G_ORG_ID;
4085 IF l_org_id IS NULL THEN
4086 -- org_id is null, don't do insert. raise an error
4087 If l_debug_level > 0 Then
4088 oe_debug_pub.add('Org_Id is NULL',1);
4089 End If;
4090 FND_MESSAGE.SET_NAME('FND','MO_ORG_REQUIRED');
4091 FND_MSG_PUB.ADD;
4092 RAISE FND_API.G_EXC_ERROR;
4093 END IF;
4094
4095
4096 INSERT INTO OE_ORDER_HEADERS
4097 ( ACCOUNTING_RULE_ID
4098 , ACCOUNTING_RULE_DURATION
4099 , AGREEMENT_ID
4100 , ATTRIBUTE1
4101 , ATTRIBUTE10
4102 , ATTRIBUTE11
4103 , ATTRIBUTE12
4104 , ATTRIBUTE13
4105 , ATTRIBUTE14
4106 , ATTRIBUTE15
4107 , ATTRIBUTE16 --For bug 2184255
4108 , ATTRIBUTE17
4109 , ATTRIBUTE18
4110 , ATTRIBUTE19
4111 , ATTRIBUTE2
4112 , ATTRIBUTE20
4113 , ATTRIBUTE3
4114 , ATTRIBUTE4
4115 , ATTRIBUTE5
4116 , ATTRIBUTE6
4117 , ATTRIBUTE7
4118 , ATTRIBUTE8
4119 , ATTRIBUTE9
4120 , BLANKET_NUMBER
4121 , BOOKED_FLAG
4122 , BOOKED_DATE
4123 , CANCELLED_FLAG
4124 , CONTEXT
4125 , CONVERSION_RATE
4126 , CONVERSION_RATE_DATE
4127 , CONVERSION_TYPE_CODE
4128 , CUSTOMER_PREFERENCE_SET_CODE
4129 , CREATED_BY
4130 , CREATION_DATE
4131 , CUST_PO_NUMBER
4132 , DELIVER_TO_CONTACT_ID
4133 , DELIVER_TO_ORG_ID
4134 , DEMAND_CLASS_CODE
4135 , FIRST_ACK_CODE
4136 , FIRST_ACK_DATE
4137 , EXPIRATION_DATE
4138 , EARLIEST_SCHEDULE_LIMIT
4139 , FOB_POINT_CODE
4140 , FREIGHT_CARRIER_CODE
4141 , FREIGHT_TERMS_CODE
4142 , GLOBAL_ATTRIBUTE1
4143 , GLOBAL_ATTRIBUTE10
4144 , GLOBAL_ATTRIBUTE11
4145 , GLOBAL_ATTRIBUTE12
4146 , GLOBAL_ATTRIBUTE13
4147 , GLOBAL_ATTRIBUTE14
4148 , GLOBAL_ATTRIBUTE15
4149 , GLOBAL_ATTRIBUTE16
4150 , GLOBAL_ATTRIBUTE17
4151 , GLOBAL_ATTRIBUTE18
4152 , GLOBAL_ATTRIBUTE19
4153 , GLOBAL_ATTRIBUTE2
4154 , GLOBAL_ATTRIBUTE20
4155 , GLOBAL_ATTRIBUTE3
4156 , GLOBAL_ATTRIBUTE4
4157 , GLOBAL_ATTRIBUTE5
4158 , GLOBAL_ATTRIBUTE6
4159 , GLOBAL_ATTRIBUTE7
4160 , GLOBAL_ATTRIBUTE8
4161 , GLOBAL_ATTRIBUTE9
4162 , GLOBAL_ATTRIBUTE_CATEGORY
4163 , HEADER_ID
4164
4165 , INVOICE_TO_CONTACT_ID
4166 , INVOICE_TO_ORG_ID
4167 , INVOICING_RULE_ID
4168 , LAST_ACK_CODE
4169 , LAST_ACK_DATE
4170 , LAST_UPDATED_BY
4171 , LAST_UPDATE_DATE
4172 , LAST_UPDATE_LOGIN
4173 , LATEST_SCHEDULE_LIMIT
4174 , OPEN_FLAG
4175 , ORDERED_DATE
4176 , ORDER_DATE_TYPE_CODE
4177 , ORDER_NUMBER
4178 , ORDER_SOURCE_ID
4179 , ORDER_TYPE_ID
4180 , ORDER_CATEGORY_CODE
4181 , ORG_ID --MOAC change. Remove the comment out
4182 , ORIG_SYS_DOCUMENT_REF
4183 , PARTIAL_SHIPMENTS_ALLOWED
4184 , PAYMENT_TERM_ID
4185 , PRICE_LIST_ID
4186 , PRICE_REQUEST_CODE -- PROMOTIONS SEP/01
4187 , PRICING_DATE
4188 , PROGRAM_APPLICATION_ID
4189 , PROGRAM_ID
4190 , PROGRAM_UPDATE_DATE
4191 , REQUEST_DATE
4192 , REQUEST_ID
4193 , RETURN_REASON_CODE
4194 , SALESREP_ID
4195 , SALES_CHANNEL_CODE
4196 , SHIPMENT_PRIORITY_CODE
4197 , SHIPPING_METHOD_CODE
4198 , SHIP_FROM_ORG_ID
4199 , SHIP_TOLERANCE_ABOVE
4200 , SHIP_TOLERANCE_BELOW
4201 , SHIP_TO_CONTACT_ID
4202 , SHIP_TO_ORG_ID
4203 , SOLD_FROM_ORG_ID
4204 , SOLD_TO_CONTACT_ID
4205 , SOLD_TO_ORG_ID
4206 , SOLD_TO_PHONE_ID
4207 , SOURCE_DOCUMENT_ID
4208 , SOURCE_DOCUMENT_TYPE_ID
4209 , TAX_EXEMPT_FLAG
4210 , TAX_EXEMPT_NUMBER
4211 , TAX_EXEMPT_REASON_CODE
4212 , TAX_POINT_CODE
4213 , TRANSACTIONAL_CURR_CODE
4214 , VERSION_NUMBER
4215 , PAYMENT_TYPE_CODE
4216 , PAYMENT_AMOUNT
4217 , CHECK_NUMBER
4218 /*, CREDIT_CARD_CODE --R12 CC Encryption
4219 , CREDIT_CARD_HOLDER_NAME
4220 , CREDIT_CARD_NUMBER
4221 , CREDIT_CARD_EXPIRATION_DATE
4222 , CREDIT_CARD_APPROVAL_DATE
4223 , CREDIT_CARD_APPROVAL_CODE*/ --R12 CC Encryption
4224 , CHANGE_SEQUENCE
4225 -- , DROP_SHIP_FLAG
4226 -- , CUSTOMER_PAYMENT_TERM_ID
4227 , SHIPPING_INSTRUCTIONS
4228 , PACKING_INSTRUCTIONS
4229 , FLOW_STATUS_CODE
4230 , MARKETING_SOURCE_CODE_ID
4231 , DEFAULT_FULFILLMENT_SET
4232 , FULFILLMENT_SET_NAME
4233 , LINE_SET_NAME
4234 , TP_ATTRIBUTE1
4235 , TP_ATTRIBUTE10
4236 , TP_ATTRIBUTE11
4237 , TP_ATTRIBUTE12
4238 , TP_ATTRIBUTE13
4239 , TP_ATTRIBUTE14
4240 , TP_ATTRIBUTE15
4241 , TP_ATTRIBUTE2
4242 , TP_ATTRIBUTE3
4243 , TP_ATTRIBUTE4
4244 , TP_ATTRIBUTE5
4245 , TP_ATTRIBUTE6
4246 , TP_ATTRIBUTE7
4247 , TP_ATTRIBUTE8
4248 , TP_ATTRIBUTE9
4249 , TP_CONTEXT
4250 , XML_MESSAGE_ID
4251 , upgraded_flag
4252 , LOCK_CONTROL
4253
4254 -- QUOTING changes
4255 , quote_date
4256 , quote_number
4257 , sales_document_name
4258 , transaction_phase_code
4259 , user_status_code
4260 , draft_submitted_flag
4261 , source_document_version_number
4262 , sold_to_site_use_id
4263 -- QUOTING changes END
4264
4265 , Minisite_Id
4266 , Ib_owner
4267 , Ib_installed_at_location
4268 , Ib_current_location
4269 , End_customer_id
4270 , End_customer_contact_id
4271 , End_customer_site_use_id
4272 , Supplier_signature
4273 , Supplier_signature_date
4274 , customer_signature
4275 , customer_signature_date
4276 --key transaction dates
4277 , order_firmed_date
4278 )
4279 VALUES
4280 ( p_header_rec.accounting_rule_id
4281 , p_header_rec.accounting_rule_duration
4282 , p_header_rec.agreement_id
4283 , p_header_rec.attribute1
4284 , p_header_rec.attribute10
4285 , p_header_rec.attribute11
4286 , p_header_rec.attribute12
4287 , p_header_rec.attribute13
4288 , p_header_rec.attribute14
4289 , p_header_rec.attribute15
4290 , p_header_rec.attribute16 --For bug 2184255
4291 , p_header_rec.attribute17
4292 , p_header_rec.attribute18
4293 , p_header_rec.attribute19
4294 , p_header_rec.attribute2
4295 , p_header_rec.attribute20
4296 , p_header_rec.attribute3
4297 , p_header_rec.attribute4
4298 , p_header_rec.attribute5
4299 , p_header_rec.attribute6
4300 , p_header_rec.attribute7
4301 , p_header_rec.attribute8
4302 , p_header_rec.attribute9
4303 , p_header_rec.Blanket_Number
4304 , p_header_rec.booked_flag
4305 , p_header_rec.booked_date
4306 , p_header_rec.cancelled_flag
4307 , p_header_rec.context
4308 , p_header_rec.conversion_rate
4309 , p_header_rec.conversion_rate_date
4310 , p_header_rec.conversion_type_code
4311 , p_header_rec.CUSTOMER_PREFERENCE_SET_CODE
4312 , p_header_rec.created_by
4313 , p_header_rec.creation_date
4314 , p_header_rec.cust_po_number
4315 , p_header_rec.deliver_to_contact_id
4316 , p_header_rec.deliver_to_org_id
4317 , p_header_rec.demand_class_code
4318 , p_header_rec.first_ack_code
4319 , p_header_rec.first_ack_date
4320 , p_header_rec.expiration_date
4321 , p_header_rec.earliest_schedule_limit
4322 , p_header_rec.fob_point_code
4323 , p_header_rec.freight_carrier_code
4324 , p_header_rec.freight_terms_code
4325 , p_header_rec.global_attribute1
4326 , p_header_rec.global_attribute10
4327 , p_header_rec.global_attribute11
4328 , p_header_rec.global_attribute12
4329 , p_header_rec.global_attribute13
4330 , p_header_rec.global_attribute14
4331 , p_header_rec.global_attribute15
4332 , p_header_rec.global_attribute16
4333 , p_header_rec.global_attribute17
4334 , p_header_rec.global_attribute18
4335 , p_header_rec.global_attribute19
4336 , p_header_rec.global_attribute2
4337 , p_header_rec.global_attribute20
4338 , p_header_rec.global_attribute3
4339 , p_header_rec.global_attribute4
4340 , p_header_rec.global_attribute5
4341 , p_header_rec.global_attribute6
4342 , p_header_rec.global_attribute7
4343 , p_header_rec.global_attribute8
4344 , p_header_rec.global_attribute9
4345 , p_header_rec.global_attribute_category
4346 , p_header_rec.header_id
4347 , p_header_rec.invoice_to_contact_id
4348 , p_header_rec.invoice_to_org_id
4349 , p_header_rec.invoicing_rule_id
4350 , p_header_rec.last_ack_code
4351 , p_header_rec.last_ack_date
4352 , p_header_rec.last_updated_by
4353 , p_header_rec.last_update_date
4354 , p_header_rec.last_update_login
4355 , p_header_rec.latest_schedule_limit
4356 , p_header_rec.open_flag
4357 , p_header_rec.ordered_date
4358 , p_header_rec.order_date_type_code
4359 , p_header_rec.order_number
4360 , p_header_rec.order_source_id
4361 , p_header_rec.order_type_id
4362 , p_header_rec.order_category_code
4363 , l_org_id --MOAC change. Remove the comment
4364 , p_header_rec.orig_sys_document_ref
4365 , p_header_rec.partial_shipments_allowed
4366 , p_header_rec.payment_term_id
4367 , p_header_rec.price_list_id
4368 , p_header_rec.price_request_code -- PROMOTIONS SEP/01
4369 , p_header_rec.pricing_date
4370 , p_header_rec.program_application_id
4371 , p_header_rec.program_id
4372 , p_header_rec.program_update_date
4373 , p_header_rec.request_date
4374 , p_header_rec.request_id
4375 , p_header_rec.return_reason_code
4376 , p_header_rec.salesrep_id
4377 , p_header_rec.sales_channel_code
4378 , p_header_rec.shipment_priority_code
4379 , p_header_rec.shipping_method_code
4380 , p_header_rec.ship_from_org_id
4381 , p_header_rec.ship_tolerance_above
4382 , p_header_rec.ship_tolerance_below
4383 , p_header_rec.ship_to_contact_id
4384 , p_header_rec.ship_to_org_id
4385 , l_org_id
4386 , p_header_rec.sold_to_contact_id
4387 , p_header_rec.sold_to_org_id
4388 , p_header_rec.sold_to_phone_id
4389 , p_header_rec.source_document_id
4390 , p_header_rec.source_document_type_id
4391 , p_header_rec.tax_exempt_flag
4392 , p_header_rec.tax_exempt_number
4393 , p_header_rec.tax_exempt_reason_code
4394 , p_header_rec.tax_point_code
4395 , p_header_rec.transactional_curr_code
4396 , p_header_rec.version_number
4397 , p_header_rec.payment_type_code
4398 , p_header_rec.payment_amount
4399 , p_header_rec.check_number
4400 /*, p_header_rec.credit_card_code --R12 CC Encryption
4401 , p_header_rec.credit_card_holder_name
4402 , p_header_rec.credit_card_number
4403 , p_header_rec.credit_card_expiration_date
4404 , p_header_rec.credit_card_approval_date
4405 , p_header_rec.credit_card_approval_code*/ --R12 CC Encryption
4406 , p_header_rec.change_sequence
4407 -- , p_header_rec.drop_ship_flag
4408 -- , p_header_rec.customer_payment_term_id
4409 , p_header_rec.shipping_instructions
4410 , p_header_rec.packing_instructions
4411 , p_header_rec.flow_status_code
4412 , p_header_rec.marketing_source_code_id
4413 , p_header_rec.default_fulfillment_set
4414 , p_header_rec.fulfillment_set_name
4415 , p_header_rec.line_set_name
4416 , p_header_rec.tp_attribute1
4417 , p_header_rec.tp_attribute10
4418 , p_header_rec.tp_attribute11
4419 , p_header_rec.tp_attribute12
4420 , p_header_rec.tp_attribute13
4421 , p_header_rec.tp_attribute14
4422 , p_header_rec.tp_attribute15
4423 , p_header_rec.tp_attribute2
4424 , p_header_rec.tp_attribute3
4425 , p_header_rec.tp_attribute4
4426 , p_header_rec.tp_attribute5
4427 , p_header_rec.tp_attribute6
4428 , p_header_rec.tp_attribute7
4429 , p_header_rec.tp_attribute8
4430 , p_header_rec.tp_attribute9
4431 , p_header_rec.tp_context
4432 , p_header_rec.xml_message_id
4433 , l_upgraded_flag
4434 , l_lock_control
4435
4436 -- QUOTING changes
4437 , p_header_rec.quote_date
4438 , p_header_rec.quote_number
4439 , p_header_rec.sales_document_name
4440 , p_header_rec.transaction_phase_code
4441 , p_header_rec.user_status_code
4442 , p_header_rec.draft_submitted_flag
4443 , p_header_rec.source_document_version_number
4444 , p_header_rec.sold_to_site_use_id
4445 -- QUOTING changes END
4446
4447 , p_header_rec.minisite_id
4448 , p_header_rec.Ib_owner
4449 , p_header_rec.Ib_installed_at_location
4450 , p_header_rec.Ib_current_location
4451 , p_header_rec.end_customer_id
4452 , p_header_rec.end_customer_contact_id
4453 , p_header_rec.end_customer_site_use_id
4454 , p_header_rec.supplier_signature
4455 , p_header_rec.supplier_signature_date
4456 , p_header_rec.customer_signature
4457 , p_header_rec.customer_signature_date
4458 --key transaction dates
4459 , p_header_rec.order_firmed_date
4460 );
4461
4462 p_header_rec.lock_control := l_lock_control;
4463
4464 -- aksingh update the operation to NULL and update the cache with
4465 -- record
4466 oe_order_cache.g_header_rec := p_header_rec;
4467 oe_order_cache.g_header_rec.operation := null;
4468 OE_GLOBALS.G_HEADER_CREATED := TRUE;
4469
4470 -- calling notification framework to update global picture
4471 -- check code release level first. Notification framework is at Pack H level
4472 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110508' THEN
4473 OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists => True,
4474 p_old_header_rec => NULL,
4475 p_Header_rec =>p_header_rec,
4476 p_header_id => p_header_rec.header_id,
4477 x_index => l_index,
4478 x_return_status => l_return_status);
4479 OE_DEBUG_PUB.ADD('Update_Global Return Status from OE_HEADER_UTIL.insert_row is: ' || l_return_status);
4480 OE_DEBUG_PUB.ADD('returned index is: ' || l_index ,1);
4481 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4482 OE_DEBUG_PUB.ADD('EVENT NOTIFY - Unexpected Error');
4483 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.INSERT_ROW', 1);
4484 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4485 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4486 OE_DEBUG_PUB.ADD('Update_Global_Picture Error in OE_HEADER_UTIL.Insert_row');
4487 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.INSERT_ROW', 1);
4488 RAISE FND_API.G_EXC_ERROR;
4489 END IF;
4490 END IF; /*code_release_level*/
4491 -- notification framework end
4492
4493 oe_debug_pub.add('Exiting OE_HEADER_UTIL.INSERT_ROW', 1);
4494
4495 EXCEPTION
4496
4497 WHEN OTHERS THEN
4498
4499 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4500 THEN
4501 OE_MSG_PUB.Add_Exc_Msg
4502 ( G_PKG_NAME
4503 , 'Insert_Row'
4504 );
4505 END IF;
4506
4507 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4508
4509 END Insert_Row;
4510
4511 -- Procedure Delete_row
4512
4513 PROCEDURE Delete_Row
4514 ( p_header_id IN NUMBER
4515 )
4516 IS
4517 l_return_status VARCHAR2(30);
4518 l_org_id NUMBER;
4519 -- added for notification framework
4520 l_new_header_rec OE_Order_PUB.Header_Rec_Type;
4521 l_index NUMBER;
4522 l_price_request_code VARCHAR2(240); -- BUG 2670775
4523 l_transaction_phase_code VARCHAR2(30);
4524
4525 --takintoy added for delete articles
4526 l_msg_count NUMBER;
4527 l_msg_data VARCHAR2(2000);
4528 BEGIN
4529
4530 oe_debug_pub.add('Entering OE_HEADER_UTIL.DELETE_ROW', 1);
4531 --Commented for MOAC start
4532 /*l_org_id := OE_GLOBALS.G_ORG_ID;
4533 IF l_org_id IS NULL THEN
4534 OE_GLOBALS.Set_Context;
4535 l_org_id := OE_GLOBALS.G_ORG_ID;
4536 END IF;*/
4537 --Commented for MOAC end
4538 -- added for notification framework
4539 --check code release level first. Notification framework is at Pack H level
4540 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110508' THEN
4541 /* Set the operation on the record so that globals are updated as well */
4542 l_new_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;
4543 l_new_header_rec.header_id := p_header_id;
4544 OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists => True,
4545 p_Header_rec =>l_new_header_rec,
4546 p_header_id => p_header_id,
4547 x_index => l_index,
4548 x_return_status => l_return_status);
4549 OE_DEBUG_PUB.ADD('Update_Global Return Status from OE_HEADER_UTIL.delete_row is: ' || l_return_status);
4550
4551 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4552 OE_DEBUG_PUB.ADD('EVENT NOTIFY - Unexpected Error');
4553 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.DELETE_ROW', 1);
4554 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4555 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4556 OE_DEBUG_PUB.ADD('Update_Global_Picture Error in OE_HEADER_UTIL.Delete_row');
4557 OE_DEBUG_PUB.ADD('Exiting OE_HEADER_UTIL.DELETE_ROW', 1);
4558 RAISE FND_API.G_EXC_ERROR;
4559 END IF;
4560 END IF; /* code_release_level*/
4561 -- notification framework end
4562
4563 -- BUG 2670775 Reverse Limits Begin
4564 oe_debug_pub.add('log request to Reverse_Limits for HEADER level DELETE',1);
4565 OE_Order_Cache.Load_Order_Header(p_header_id);
4566 l_price_request_code := OE_ORDER_CACHE.g_header_rec.price_request_code;
4567 l_transaction_phase_code := OE_ORDER_CACHE.g_header_rec.transaction_phase_code;
4568
4569 -- If price_request_code is not cached, retrieve it
4570 IF l_price_request_code = FND_API.G_MISS_CHAR
4571 OR l_price_request_code is NULL THEN
4572 oe_debug_pub.add('Select price_request_code from HEADER',1);
4573 SELECT price_request_code
4574 INTO l_price_request_code
4575 FROM OE_ORDER_HEADERS
4576 WHERE HEADER_ID = p_header_id;
4577 END IF;
4578
4579 OE_DELAYED_REQUESTS_UTIL.REVERSE_LIMITS
4580 ( x_return_status => l_return_status
4581 , p_action_code => 'CANCEL'
4582 , p_cons_price_request_code => l_price_request_code
4583 , p_orig_ordered_qty => NULL
4584 , p_amended_qty => NULL
4585 , p_ret_price_request_code => NULL
4586 , p_returned_qty => NULL
4587 , p_line_id => NULL
4588 );
4589 oe_debug_pub.add('Request to Reverse_Limits in OE_HEADER_UTIL.Delete_Row is done',1);
4590 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4591 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4592 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4593 RAISE FND_API.G_EXC_ERROR;
4594 END IF;
4595 -- BUG 2670775 Reverse Limits End
4596 OE_Atchmt_Util.Delete_Attachments
4597 ( p_entity_code => OE_GLOBALS.G_ENTITY_HEADER
4598 , p_entity_id => p_header_id
4599 , x_return_status => l_return_status
4600 );
4601 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4602 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4603 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4604 RAISE FND_API.G_EXC_ERROR;
4605 END IF;
4606
4607 OE_Header_Adj_Util.delete_row(p_header_id => p_header_id);
4608 OE_Header_Scredit_Util.delete_row(p_header_id => p_header_id);
4609 OE_Line_Util.delete_row(p_header_id => p_header_id);
4610 -- Bug 3315531
4611 -- Pass appropriate value for p_type depending on transaction phase
4612 IF nvl(l_transaction_phase_code,'F') = 'F' THEN
4613 OE_Order_WF_Util.delete_row(p_type=>'HEADER', p_id => p_header_id);
4614 ELSIF l_transaction_phase_code = 'N' THEN
4615 OE_Order_WF_Util.delete_row(p_type=>'NEGOTIATE', p_id => p_header_id);
4616 END IF;
4617 OE_Holds_PUB.Delete_Holds(p_header_id => p_header_id);
4618
4619 OE_Delayed_Requests_Pvt.Delete_Reqs_for_deleted_entity(
4620 p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
4621 p_entity_id => p_header_id,
4622 x_return_status => l_return_status
4623 );
4624 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4625 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4626 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4627 RAISE FND_API.G_EXC_ERROR;
4628 END IF;
4629
4630 /* Start Audit Trail */
4631 DELETE FROM OE_ORDER_HEADER_HISTORY
4632 WHERE HEADER_ID = p_header_id;
4633 /* End Audit Trail */
4634
4635 /* takintoy delete Contracts*/
4636 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
4637 OE_CONTRACTS_UTIL.delete_articles
4638 (
4639 p_api_version =>1,
4640 p_doc_type => OE_CONTRACTS_UTIL.G_SO_DOC_TYPE,
4641 p_doc_id =>p_header_id,
4642 x_return_status =>l_return_status,
4643 x_msg_count =>l_msg_count,
4644 x_msg_data =>l_msg_data);
4645 END IF;
4646 /*End contract deletion*/
4647
4648 DELETE FROM OE_ORDER_HEADERS
4649 WHERE HEADER_ID = p_header_id;
4650 /* AND
4651 (NVL(ORG_ID,NVL(l_org_id,0))= NVL(l_org_id,0))
4652 ;*/
4653
4654 oe_debug_pub.add('Exiting OE_HEADER_UTIL.DELETE_ROW', 1);
4655
4656 EXCEPTION
4657 WHEN FND_API.G_EXC_ERROR THEN
4658 --takintoy, added for delete articles
4659 OE_MSG_PUB.Count_And_Get
4660 (
4661 p_count => l_msg_count,
4662 p_data => l_msg_data
4663 );
4664 RAISE FND_API.G_EXC_ERROR;
4665 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4666 --takintoy, added for delete articles
4667 OE_MSG_PUB.Count_And_Get
4668 (
4669 p_count => l_msg_count,
4670 p_data => l_msg_data
4671 );
4672 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4673 WHEN OTHERS THEN
4674 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4675 THEN
4676 OE_MSG_PUB.Add_Exc_Msg
4677 ( G_PKG_NAME
4678 , 'Delete_Row'
4679 );
4680 END IF;
4681 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4682 END Delete_Row;
4683
4684 --R12 CC Encryption
4685 PROCEDURE Query_card_Details
4686 ( p_header_id IN NUMBER,
4687 p_credit_card_code OUT NOCOPY VARCHAR2,
4688 p_credit_card_holder_name OUT NOCOPY VARCHAR2,
4689 p_credit_card_number OUT NOCOPY VARCHAR2,
4690 p_credit_Card_expiration_date OUT NOCOPY VARCHAR2,
4691 p_credit_card_approval_code OUT NOCOPY VARCHAR2,
4692 p_credit_card_approval_Date OUT NOCOPY VARCHAR2,
4693 p_instrument_security_code OUT NOCOPY VARCHAR2,
4694 p_instrument_id OUT NOCOPY NUMBER,
4695 p_instrument_assignment_id OUT NOCOPY NUMBER
4696 )
4697 IS
4698 l_exists VARCHAR2(1);
4699 l_trxn_extension_id NUMBER;
4700 x_bank_account_number number;
4701 x_check_number varchar2(100);
4702 l_payment_type_code VARCHAR2(40) := 'CREDIT_CARD';
4703 l_return_status VARCHAR2(30) := NULL ;
4704 l_msg_count NUMBER := 0 ;
4705 l_msg_data VARCHAR2(2000) := NULL ;
4706 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4707
4708 BEGIN
4709 IF l_debug_level >0 THEN
4710 oe_debug_pub.add('Entering Query Card Details....');
4711 l_return_status := FND_API.G_RET_STS_SUCCESS;
4712 END IF;
4713
4714 BEGIN
4715 SELECT 'Y',trxn_extension_id
4716 into l_exists,l_trxn_extension_id
4717 FROM OE_PAYMENTS
4718 WHERE header_id = p_header_id
4719 and line_id is null and
4720 nvl(payment_collection_event,'PREPAY') = 'INVOICE';
4721 EXCEPTION
4722 WHEN NO_DATA_FOUND THEN
4723 l_exists := 'N';
4724 IF l_debug_level >0 THEN
4725 oe_debug_pub.add('No record in oe_payments ...in query card details');
4726 oe_debug_pub.add('Header id passed...'||p_header_id);
4727 END IF;
4728 END;
4729
4730 IF l_exists = 'Y' and l_trxn_extension_id is not null then
4731 BEGIN
4732 OE_Payment_Trxn_Util.Get_Payment_Trxn_Info(p_header_id => p_header_id,
4733 P_trxn_extension_id => l_trxn_extension_id,
4734 P_payment_type_code => l_payment_type_code,
4735 X_credit_card_number => p_credit_card_number,
4736 X_credit_card_holder_name => p_credit_card_holder_name,
4737 X_credit_card_expiration_date => p_credit_card_expiration_date,
4738 X_credit_card_code => p_credit_card_code,
4739 X_credit_card_approval_code => p_credit_card_approval_code,
4740 X_credit_card_approval_date => p_credit_card_approval_date,
4741 X_bank_account_number => X_bank_account_number,
4742 --X_check_number => X_check_number ,
4743 X_instrument_security_code => p_instrument_security_code,
4744 X_instrument_id => p_instrument_id,
4745 X_instrument_assignment_id => p_instrument_assignment_id,
4746 X_return_status => l_return_status,
4747 X_msg_count => l_msg_count,
4748 X_msg_data => l_msg_data);
4749
4750 IF l_return_status = FND_API.G_RET_STS_ERROR OR
4751 l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4752 OE_DEBUG_PUB.add('Error in get payment trxn info...');
4753 ELSIF l_return_status =FND_API.G_RET_STS_SUCCESS THEN
4754 OE_DEBUG_PUB.add('Success in get payment trxn info...');
4755 oe_debug_pub.add('Card holder name...'||p_credit_card_holder_name);
4756 END IF;
4757
4758 EXCEPTION
4759 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4760 l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4761 IF l_debug_level>0 THEN
4762 oe_debug_pub.add('Exception in Query card details....'||sqlerrm);
4763 oe_debug_pub.add('Return status'||l_return_status);
4764 oe_debug_pub.add('Msg data'||l_msg_data);
4765 END IF;
4766 WHEN OTHERS THEN
4767 l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4768 IF l_debug_level>0 THEN
4769 oe_debug_pub.add('Exception in Query card details....'||sqlerrm);
4770 oe_debug_pub.add('Return status'||l_return_status);
4771 oe_debug_pub.add('Msg data'||l_msg_data);
4772 END IF;
4773 END;
4774 ELSIF l_exists = 'Y' and l_trxn_extension_id is null then
4775 BEGIN
4776 select credit_card_number,
4777 credit_card_holder_name,
4778 credit_card_expiration_date,
4779 credit_card_code,
4780 credit_card_approval_code,
4781 credit_card_approval_date
4782 into p_credit_card_number,
4783 p_credit_card_holder_name,
4784 p_credit_card_expiration_date,
4785 p_credit_card_code,
4786 p_credit_card_approval_code,
4787 p_credit_card_approval_date
4788 from oe_payments where
4789 header_id = p_header_id and line_id is null
4790 and nvl(payment_collection_event,'PREPAY') = 'INVOICE';
4791 --Set the new attributes value to null as this record was created before R12
4792 p_instrument_security_code := NULL;
4793 p_instrument_id := null;
4794 p_instrument_assignment_id := null;
4795 EXCEPTION
4796 WHEN NO_DATA_FOUND THEN
4797 null;
4798 END;
4799 ELSIF l_exists = 'N' THEN
4800 p_credit_card_number := null;
4801 p_credit_card_holder_name := null;
4802 p_credit_card_expiration_date := null;
4803 p_credit_card_code := null;
4804 p_credit_card_approval_code := null;
4805 p_credit_card_approval_date := null;
4806 p_instrument_security_code := NULL;
4807 p_instrument_id := null;
4808 p_instrument_assignment_id := null;
4809 END IF;
4810
4811
4812 EXCEPTION
4813 WHEN OTHERS THEN
4814 IF l_debug_level>0 THEN
4815 oe_debug_pub.add('Exception in Query card details....'||sqlerrm);
4816 oe_debug_pub.add('Return status'||l_return_status);
4817 oe_debug_pub.add('Msg data'||l_msg_data);
4818 END IF;
4819 END Query_card_Details;
4820 --R12 CC Encryption
4821
4822 -- FUNCTION Query_Row
4823 -- IMPORTANT: DO NOT CHANGE THE SPEC OF THIS FUNCTION
4824 -- IT IS PUBLIC AND BEING CALLED BY OTHER PRODUCTS
4825 -- Private OM callers should call the procedure query_row instead
4826 -- as it has the nocopy option which would improve the performance
4827
4828 FUNCTION Query_Row
4829 ( p_header_id IN NUMBER
4830 ) RETURN OE_Order_PUB.Header_Rec_Type
4831 IS
4832 l_header_rec OE_Order_PUB.Header_Rec_Type;
4833 BEGIN
4834
4835 Query_Row
4836 ( p_header_id => p_header_id
4837 , x_header_rec => l_header_rec
4838 );
4839
4840 RETURN l_header_rec;
4841
4842 END Query_Row;
4843
4844 -- Function Query_Row
4845
4846 PROCEDURE Query_Row
4847 ( p_header_id IN NUMBER,
4848 x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
4849 )
4850 IS
4851 l_org_id NUMBER;
4852 l_x_header_rec_oper VARCHAR2(30);
4853 l_trxn_extension_id NUMBER;
4854 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4855 l_return_status VARCHAR2(1);
4856 BEGIN
4857
4858 if l_debug_level > 0 then
4859 oe_debug_pub.add('Entering OE_HEADER_UTIL.QUERY_ROW', 1);
4860 end if;
4861 --Commented for MOAC start
4862 /*l_org_id := OE_GLOBALS.G_ORG_ID;
4863 IF l_org_id IS NULL THEN
4864 OE_GLOBALS.Set_Context;
4865 l_org_id := OE_GLOBALS.G_ORG_ID;
4866 END IF;*/
4867 --Commented for MOAC end
4868 -- aksingh use global record if exists for header_id
4869 IF oe_order_cache.g_header_rec.header_id = p_header_id
4870 -- { Start of the fix 2436046
4871 AND x_header_rec.lock_control <> -1
4872 -- End of the fix 2436046 }
4873 THEN
4874 l_x_header_rec_oper := x_header_rec.operation;
4875 x_header_rec := oe_order_cache.g_header_rec;
4876 x_header_rec.operation := l_x_header_rec_oper;
4877 return;
4878 END IF;
4879
4880 -- bug 3588660
4881 /*
4882 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110508' THEN
4883 OE_ORDER_UTIL.Clear_Global_Picture(l_return_status);
4884 END IF;
4885 */
4886 SELECT ACCOUNTING_RULE_ID
4887 , ACCOUNTING_RULE_DURATION
4888 , AGREEMENT_ID
4889 , ATTRIBUTE1
4890 , ATTRIBUTE10
4891 , ATTRIBUTE11
4892 , ATTRIBUTE12
4893 , ATTRIBUTE13
4894 , ATTRIBUTE14
4895 , ATTRIBUTE15
4896 , ATTRIBUTE16 --For bug 2184255
4897 , ATTRIBUTE17
4898 , ATTRIBUTE18
4899 , ATTRIBUTE19
4900 , ATTRIBUTE2
4901 , ATTRIBUTE20
4902 , ATTRIBUTE3
4903 , ATTRIBUTE4
4904 , ATTRIBUTE5
4905 , ATTRIBUTE6
4906 , ATTRIBUTE7
4907 , ATTRIBUTE8
4908 , ATTRIBUTE9
4909 , BLANKET_NUMBER
4910 , BOOKED_FLAG
4911 , BOOKED_DATE
4912 , CANCELLED_FLAG
4913 , CONTEXT
4914 , CONVERSION_RATE
4915 , CONVERSION_RATE_DATE
4916 , CONVERSION_TYPE_CODE
4917 , CUSTOMER_PREFERENCE_SET_CODE
4918 , CREATED_BY
4919 , CREATION_DATE
4920 , CUST_PO_NUMBER
4921 , DELIVER_TO_CONTACT_ID
4922 , DELIVER_TO_ORG_ID
4923 , DEMAND_CLASS_CODE
4924 , FIRST_ACK_CODE
4925 , FIRST_ACK_DATE
4926 , EXPIRATION_DATE
4927 , EARLIEST_SCHEDULE_LIMIT
4928 , FOB_POINT_CODE
4929 , FREIGHT_CARRIER_CODE
4930 , FREIGHT_TERMS_CODE
4931 , GLOBAL_ATTRIBUTE1
4932 , GLOBAL_ATTRIBUTE10
4933 , GLOBAL_ATTRIBUTE11
4934 , GLOBAL_ATTRIBUTE12
4935 , GLOBAL_ATTRIBUTE13
4936 , GLOBAL_ATTRIBUTE14
4937 , GLOBAL_ATTRIBUTE15
4938 , GLOBAL_ATTRIBUTE16
4939 , GLOBAL_ATTRIBUTE17
4940 , GLOBAL_ATTRIBUTE18
4941 , GLOBAL_ATTRIBUTE19
4942 , GLOBAL_ATTRIBUTE2
4943 , GLOBAL_ATTRIBUTE20
4944 , GLOBAL_ATTRIBUTE3
4945 , GLOBAL_ATTRIBUTE4
4946 , GLOBAL_ATTRIBUTE5
4947 , GLOBAL_ATTRIBUTE6
4948 , GLOBAL_ATTRIBUTE7
4949 , GLOBAL_ATTRIBUTE8
4950 , GLOBAL_ATTRIBUTE9
4951 , GLOBAL_ATTRIBUTE_CATEGORY
4952 , HEADER_ID
4953 , INVOICE_TO_CONTACT_ID
4954 , INVOICE_TO_ORG_ID
4955 , INVOICING_RULE_ID
4956 , LAST_ACK_CODE
4957 , LAST_ACK_DATE
4958 , LAST_UPDATED_BY
4959 , LAST_UPDATE_DATE
4960 , LAST_UPDATE_LOGIN
4961 , LATEST_SCHEDULE_LIMIT
4962 , OPEN_FLAG
4963 , ORDERED_DATE
4964 , ORDER_DATE_TYPE_CODE
4965 , ORDER_NUMBER
4966 , ORDER_SOURCE_ID
4967 , ORDER_TYPE_ID
4968 , ORDER_CATEGORY_CODE
4969 , ORG_ID
4970 , ORIG_SYS_DOCUMENT_REF
4971 , PARTIAL_SHIPMENTS_ALLOWED
4972 , PAYMENT_TERM_ID
4973 , PRICE_LIST_ID
4974 , PRICE_REQUEST_CODE -- PROMOTIONS SEP/01
4975 , PRICING_DATE
4976 , PROGRAM_APPLICATION_ID
4977 , PROGRAM_ID
4978 , PROGRAM_UPDATE_DATE
4979 , REQUEST_DATE
4980 , REQUEST_ID
4981 , RETURN_REASON_CODE
4982 , SALESREP_ID
4983 , SALES_CHANNEL_CODe
4984 , SHIPMENT_PRIORITY_CODE
4985 , SHIPPING_METHOD_CODE
4986 , SHIP_FROM_ORG_ID
4987 , SHIP_TOLERANCE_ABOVE
4988 , SHIP_TOLERANCE_BELOW
4989 , SHIP_TO_CONTACT_ID
4990 , SHIP_TO_ORG_ID
4991 , SOLD_FROM_ORG_ID
4992 , SOLD_TO_CONTACT_ID
4993 , SOLD_TO_ORG_ID
4994 , SOLD_TO_PHONE_ID
4995 , SOURCE_DOCUMENT_ID
4996 , SOURCE_DOCUMENT_TYPE_ID
4997 , TAX_EXEMPT_FLAG
4998 , TAX_EXEMPT_NUMBER
4999 , TAX_EXEMPT_REASON_CODE
5000 , TAX_POINT_CODE
5001 , TRANSACTIONAL_CURR_CODE
5002 , VERSION_NUMBER
5003 , PAYMENT_TYPE_CODE
5004 , PAYMENT_AMOUNT
5005 , CHECK_NUMBER
5006 , CREDIT_CARD_CODE
5007 , CREDIT_CARD_HOLDER_NAME
5008 , CREDIT_CARD_NUMBER
5009 , CREDIT_CARD_EXPIRATION_DATE
5010 , CREDIT_CARD_APPROVAL_DATE
5011 , CREDIT_CARD_APPROVAL_CODE
5012 , SHIPPING_INSTRUCTIONS
5013 , PACKING_INSTRUCTIONS
5014 , FLOW_STATUS_CODE
5015 , MARKETING_SOURCE_CODE_ID
5016 , DEFAULT_FULFILLMENT_SET
5017 , FULFILLMENT_SET_NAME
5018 , LINE_SET_NAME
5019 , TP_ATTRIBUTE1
5020 , TP_ATTRIBUTE10
5021 , TP_ATTRIBUTE11
5022 , TP_ATTRIBUTE12
5023 , TP_ATTRIBUTE13
5024 , TP_ATTRIBUTE14
5025 , TP_ATTRIBUTE15
5026 , TP_ATTRIBUTE2
5027 , TP_ATTRIBUTE3
5028 , TP_ATTRIBUTE4
5029 , TP_ATTRIBUTE5
5030 , TP_ATTRIBUTE6
5031 , TP_ATTRIBUTE7
5032 , TP_ATTRIBUTE8
5033 , TP_ATTRIBUTE9
5034 , TP_CONTEXT
5035 , XML_MESSAGE_ID
5036 , upgraded_flag
5037 , LOCK_CONTROL
5038 , CHANGE_SEQUENCE
5039 , quote_date
5040 , quote_number
5041 , sales_document_name
5042 , transaction_phase_code
5043 , user_status_code
5044 , draft_submitted_flag
5045 , source_document_version_number
5046 , sold_to_site_use_id
5047 , MINISITE_ID
5048 , IB_OWNER
5049 , IB_INSTALLED_AT_LOCATION
5050 , IB_CURRENT_LOCATION
5051 , END_CUSTOMER_ID
5052 , END_CUSTOMER_CONTACT_ID
5053 , END_CUSTOMER_SITE_USE_ID
5054 , SUPPLIER_SIGNATURE
5055 , SUPPLIER_SIGNATURE_DATE
5056 , CUSTOMER_SIGNATURE
5057 , CUSTOMER_SIGNATURE_DATE
5058 --key Transaction Dates
5059 , order_firmed_date
5060 INTO x_header_rec.accounting_rule_id
5061 , x_header_rec.accounting_rule_duration
5062 , x_header_rec.agreement_id
5063 , x_header_rec.attribute1
5064 , x_header_rec.attribute10
5065 , x_header_rec.attribute11
5066 , x_header_rec.attribute12
5067 , x_header_rec.attribute13
5068 , x_header_rec.attribute14
5069 , x_header_rec.attribute15
5070 , x_header_rec.attribute16 --For bug 2184255
5071 , x_header_rec.attribute17
5072 , x_header_rec.attribute18
5073 , x_header_rec.attribute19
5074 , x_header_rec.attribute2
5075 , x_header_rec.attribute20
5076 , x_header_rec.attribute3
5077 , x_header_rec.attribute4
5078 , x_header_rec.attribute5
5079 , x_header_rec.attribute6
5080 , x_header_rec.attribute7
5081 , x_header_rec.attribute8
5082 , x_header_rec.attribute9
5083 , x_header_rec.Blanket_Number
5084 , x_header_rec.booked_flag
5085 , x_header_rec.booked_date
5086 , x_header_rec.cancelled_flag
5087 , x_header_rec.context
5088 , x_header_rec.conversion_rate
5089 , x_header_rec.conversion_rate_date
5090 , x_header_rec.conversion_type_code
5091 , x_header_rec.CUSTOMER_PREFERENCE_SET_CODE
5092 , x_header_rec.created_by
5093 , x_header_rec.creation_date
5094 , x_header_rec.cust_po_number
5095 , x_header_rec.deliver_to_contact_id
5096 , x_header_rec.deliver_to_org_id
5097 , x_header_rec.demand_class_code
5098 , x_header_rec.first_ack_code
5099 , x_header_rec.first_ack_date
5100 , x_header_rec.expiration_date
5101 , x_header_rec.earliest_schedule_limit
5102 , x_header_rec.fob_point_code
5103 , x_header_rec.freight_carrier_code
5104 , x_header_rec.freight_terms_code
5105 , x_header_rec.global_attribute1
5106 , x_header_rec.global_attribute10
5107 , x_header_rec.global_attribute11
5108 , x_header_rec.global_attribute12
5109 , x_header_rec.global_attribute13
5110 , x_header_rec.global_attribute14
5111 , x_header_rec.global_attribute15
5112 , x_header_rec.global_attribute16
5113 , x_header_rec.global_attribute17
5114 , x_header_rec.global_attribute18
5115 , x_header_rec.global_attribute19
5116 , x_header_rec.global_attribute2
5117 , x_header_rec.global_attribute20
5118 , x_header_rec.global_attribute3
5119 , x_header_rec.global_attribute4
5120 , x_header_rec.global_attribute5
5121 , x_header_rec.global_attribute6
5122 , x_header_rec.global_attribute7
5123 , x_header_rec.global_attribute8
5124 , x_header_rec.global_attribute9
5125 , x_header_rec.global_attribute_category
5126 , x_header_rec.header_id
5127 , x_header_rec.invoice_to_contact_id
5128 , x_header_rec.invoice_to_org_id
5129 , x_header_rec.invoicing_rule_id
5130 , x_header_rec.last_ack_code
5131 , x_header_rec.last_ack_date
5132 , x_header_rec.last_updated_by
5133 , x_header_rec.last_update_date
5134 , x_header_rec.last_update_login
5135 , x_header_rec.latest_schedule_limit
5136 , x_header_rec.open_flag
5137 , x_header_rec.ordered_date
5138 , x_header_rec.order_date_type_code
5139 , x_header_rec.order_number
5140 , x_header_rec.order_source_id
5141 , x_header_rec.order_type_id
5142 , x_header_rec.order_category_code
5143 , x_header_rec.org_id
5144 , x_header_rec.orig_sys_document_ref
5145 , x_header_rec.partial_shipments_allowed
5146 , x_header_rec.payment_term_id
5147 , x_header_rec.price_list_id
5148 , x_header_rec.price_request_code -- PROMOTIONS SEP/01
5149 , x_header_rec.pricing_date
5150 , x_header_rec.program_application_id
5151 , x_header_rec.program_id
5152 , x_header_rec.program_update_date
5153 , x_header_rec.request_date
5154 , x_header_rec.request_id
5155 , x_header_rec.return_reason_code
5156 , x_header_rec.salesrep_id
5157 , x_header_rec.sales_channel_code
5158 , x_header_rec.shipment_priority_code
5159 , x_header_rec.shipping_method_code
5160 , x_header_rec.ship_from_org_id
5161 , x_header_rec.ship_tolerance_above
5162 , x_header_rec.ship_tolerance_below
5163 , x_header_rec.ship_to_contact_id
5164 , x_header_rec.ship_to_org_id
5165 , x_header_rec.sold_from_org_id
5166 , x_header_rec.sold_to_contact_id
5167 , x_header_rec.sold_to_org_id
5168 , x_header_rec.sold_to_phone_id
5169 , x_header_rec.source_document_id
5170 , x_header_rec.source_document_type_id
5171 , x_header_rec.tax_exempt_flag
5172 , x_header_rec.tax_exempt_number
5173 , x_header_rec.tax_exempt_reason_code
5174 , x_header_rec.tax_point_code
5175 , x_header_rec.transactional_curr_code
5176 , x_header_rec.version_number
5177 , x_header_rec.payment_type_code
5178 , x_header_rec.payment_amount
5179 , x_header_rec.check_number
5180 , x_header_rec.credit_card_code
5181 , x_header_rec.credit_card_holder_name
5182 , x_header_rec.credit_card_number
5183 , x_header_rec.credit_card_expiration_date
5184 , x_header_rec.credit_card_approval_date
5185 , x_header_rec.credit_card_approval_code
5186 , x_header_rec.shipping_instructions
5187 , x_header_rec.packing_instructions
5188 , x_header_rec.flow_status_code
5189 , x_header_rec.marketing_source_code_id
5190 , x_header_rec.default_fulfillment_set
5191 , x_header_rec.fulfillment_set_name
5192 , x_header_rec.line_set_name
5193 , x_header_rec.tp_attribute1
5194 , x_header_rec.tp_attribute10
5195 , x_header_rec.tp_attribute11
5196 , x_header_rec.tp_attribute12
5197 , x_header_rec.tp_attribute13
5198 , x_header_rec.tp_attribute14
5199 , x_header_rec.tp_attribute15
5200 , x_header_rec.tp_attribute2
5201 , x_header_rec.tp_attribute3
5202 , x_header_rec.tp_attribute4
5203 , x_header_rec.tp_attribute5
5204 , x_header_rec.tp_attribute6
5205 , x_header_rec.tp_attribute7
5206 , x_header_rec.tp_attribute8
5207 , x_header_rec.tp_attribute9
5208 , x_header_rec.tp_context
5209 , x_header_rec.xml_message_id
5210 , x_header_rec.upgraded_flag
5211 , x_header_rec.lock_control
5212 , x_header_rec.change_sequence
5213 , x_header_rec.quote_date
5214 , x_header_rec.quote_number
5215 , x_header_rec.sales_document_name
5216 , x_header_rec.transaction_phase_code
5217 , x_header_rec.user_status_code
5218 , x_header_rec.draft_submitted_flag
5219 , x_header_rec.source_document_version_number
5220 , x_header_rec.sold_to_site_use_id
5221 , x_header_rec.minisite_id
5222 , x_header_rec.ib_owner
5223 , x_header_rec.ib_installed_at_location
5224 , x_header_rec.ib_current_location
5225 , x_header_rec.end_customer_id
5226 , x_header_rec.end_customer_contact_id
5227 , x_header_rec.end_customer_site_use_id
5228 , x_header_rec.supplier_signature
5229 , x_header_rec.supplier_signature_date
5230 , x_header_rec.customer_signature
5231 , x_header_rec.customer_signature_date
5232 --key Transaction Dates
5233 , x_header_rec.order_firmed_date
5234 FROM OE_ORDER_HEADERS_ALL
5235 WHERE HEADER_ID = p_header_id;
5236 /* AND
5237 (NVL(ORG_ID,NVL(l_org_id,0))= NVL(l_org_id,0))
5238 ;*/
5239
5240 --R12 CC Encryption
5241
5242 --Need to call query card details procedure to get the credit card
5243 --details as the OM tables would not have these values in R12
5244 IF x_header_rec.payment_type_code IS NOT NULL AND
5245 x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
5246
5247 BEGIN
5248 SELECT trxn_extension_id
5249 INTO l_trxn_extension_id
5250 FROM oe_payments
5251 WHERE header_id = p_header_id
5252 AND nvl(payment_collection_event,'PREPAY') = 'INVOICE'
5253 AND payment_type_code = 'CREDIT_CARD'
5254 AND line_id is null;
5255 EXCEPTION WHEN NO_DATA_FOUND THEN
5256 null;
5257 END;
5258
5259 IF l_trxn_extension_id is not null THEN
5260 if l_debug_level > 0 then
5261 oe_debug_pub.add('Calling query card details...');
5262 end if;
5263 Query_card_details
5264 ( p_header_id => x_header_rec.header_id,
5265 p_credit_card_code => x_header_rec.credit_card_code,
5266 p_credit_card_holder_name => x_header_rec.credit_card_holder_name,
5267 p_credit_card_number => x_header_rec.credit_card_number,
5268 p_credit_Card_expiration_date => x_header_rec.credit_card_expiration_date,
5269 p_credit_card_approval_code => x_header_rec.credit_card_approval_code,
5270 p_credit_card_approval_Date => x_header_rec.credit_card_approval_date,
5271 p_instrument_security_code => x_header_rec.instrument_security_code,
5272 p_instrument_id => x_header_rec.cc_instrument_id,
5273 p_instrument_assignment_id => x_header_rec.cc_instrument_assignment_id
5274 );
5275 END IF;
5276 END IF;
5277 --R12 CC Encryption
5278
5279 -- aksingh assigning the global record, so later the cached record
5280 -- will be used instead of querying again
5281 if l_debug_level > 0 then
5282 oe_debug_pub.add('Before caching OE_HEADER_UTIL.QUERY_ROW', 1);
5283 end if;
5284
5285 oe_order_cache.g_header_rec := x_header_rec;
5286 oe_order_cache.g_header_rec.operation := null;
5287
5288 if l_debug_level > 0 then
5289 oe_debug_pub.add('Exiting OE_HEADER_UTIL.QUERY_ROW', 1);
5290 end if;
5291
5292
5293 EXCEPTION
5294
5295 WHEN NO_DATA_FOUND THEN
5296
5297 RAISE NO_DATA_FOUND;
5298
5299 WHEN OTHERS THEN
5300
5301 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5302 THEN
5303 OE_MSG_PUB.Add_Exc_Msg
5304 ( G_PKG_NAME
5305 , 'Query_Row'
5306 );
5307 END IF;
5308
5309 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5310
5311 END Query_Row;
5312
5313 -- Procedure lock_Row
5314 --
5315
5316 PROCEDURE Lock_Row
5317 ( x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
5318 , p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
5319 , p_header_id IN NUMBER
5320 := FND_API.G_MISS_NUM
5321 )
5322 IS
5323 l_header_id NUMBER;
5324 l_lock_control NUMBER;
5325 l_db_lock_control NUMBER;
5326 BEGIN
5327
5328 oe_debug_pub.add('Entering OE_HEADER_UTIL.LOCK_ROW', 1);
5329
5330 SAVEPOINT Lock_Row;
5331
5332 l_lock_control := NULL;
5333
5334 -- Retrieve the primary key.
5335 IF p_header_id <> FND_API.G_MISS_NUM THEN
5336 l_header_id := p_header_id;
5337 ELSE
5338 l_header_id := p_x_header_rec.header_id;
5339 l_lock_control := p_x_header_rec.lock_control;
5340 END IF;
5341
5342 SELECT header_id, lock_control
5343 INTO l_header_id, l_db_lock_control
5344 FROM OE_ORDER_HEADERS_ALL
5345 WHERE HEADER_ID = l_header_id
5346 FOR UPDATE NOWAIT;
5347
5348 -- { Start of the fix 2436046, query part is old
5349 IF l_db_lock_control is not null and
5350 nvl(l_lock_control, FND_API.G_MISS_NUM) <> l_db_lock_control
5351 THEN
5352 p_x_header_rec.lock_control := -1;
5353 END IF;
5354 -- End of the fix 2436046 }
5355
5356 OE_Header_Util.Query_Row(p_header_id => l_header_id,
5357 x_header_rec => p_x_header_rec);
5358
5359 oe_debug_pub.add('selected for update, now compare', 3);
5360
5361
5362 -- If lock_control is not passed(is null or missing), then return the locked record.
5363
5364 IF l_lock_control is null OR
5365 l_lock_control = FND_API.G_MISS_NUM
5366 THEN
5367
5368 -- Set out parameter, out rec is already set by query row.
5369
5370 -- Set return status
5371 x_return_status := FND_API.G_RET_STS_SUCCESS;
5372 p_x_header_rec.return_status := FND_API.G_RET_STS_SUCCESS;
5373
5374 RETURN;
5375
5376 END IF;
5377
5378 -- Row locked. If the whole record is passed, then
5379 -- Compare the value of lock_control column to DB value.
5380
5381 -- following constants are used to debug lock_order,
5382 -- please do not use them for any other purpose.
5383 -- set G_LOCK_TEST := 'Y', for debugging.
5384
5385 OE_GLOBALS.G_LOCK_CONST := 0;
5386 --OE_GLOBALS.G_LOCK_TEST := 'Y';
5387 OE_GLOBALS.G_LOCK_TEST := 'N';
5388
5389 IF OE_GLOBALS.Equal(p_x_header_rec.lock_control,
5390 l_lock_control)
5391 THEN
5392
5393 oe_debug_pub.add('done comparison, success', 1);
5394 -- Row has not changed. Set out parameter.
5395
5396 -- Set return status
5397
5398 x_return_status := FND_API.G_RET_STS_SUCCESS;
5399 p_x_header_rec.return_status := FND_API.G_RET_STS_SUCCESS;
5400
5401 ELSE
5402
5403 oe_debug_pub.add('row changed by other user', 1);
5404
5405 -- Row has changed by another user.
5406
5407 x_return_status := FND_API.G_RET_STS_ERROR;
5408 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
5409
5410 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
5411 THEN
5412
5413 -- Release the lock
5414 ROLLBACK TO Lock_Row;
5415
5416 fnd_message.set_name('ONT','OE_LOCK_ROW_CHANGED');
5417 OE_MSG_PUB.Add;
5418
5419 END IF;
5420
5421 END IF;
5422
5423 oe_debug_pub.add('Exiting OE_HEADER_UTIL.LOCK_ROW', 1);
5424
5425 OE_GLOBALS.G_LOCK_TEST := 'N';
5426 EXCEPTION
5427
5428 WHEN NO_DATA_FOUND THEN
5429
5430 x_return_status := FND_API.G_RET_STS_ERROR;
5431 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
5432
5433 oe_debug_pub.add('no data found in lock_header', 1);
5434
5435 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
5436 THEN
5437
5438 fnd_message.set_name('ONT','OE_LOCK_ROW_DELETED');
5439 OE_MSG_PUB.Add;
5440
5441 END IF;
5442
5443 OE_GLOBALS.G_LOCK_TEST := 'N';
5444
5445 WHEN APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION THEN
5446
5447 x_return_status := FND_API.G_RET_STS_ERROR;
5448 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
5449
5450 oe_debug_pub.add('record_lock in lock_header', 1);
5451
5452 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
5453 THEN
5454
5455 fnd_message.set_name('ONT','OE_LOCK_ROW_ALREADY_LOCKED');
5456 OE_MSG_PUB.Add;
5457
5458 END IF;
5459 OE_GLOBALS.G_LOCK_TEST := 'N';
5460 WHEN OTHERS THEN
5461
5462 oe_debug_pub.add('others in lock_header', 1);
5463 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5464 p_x_header_rec.return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5465
5466 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5467 THEN
5468 OE_MSG_PUB.Add_Exc_Msg
5469 ( G_PKG_NAME
5470 , 'Lock_Row'
5471 );
5472 END IF;
5473 OE_GLOBALS.G_LOCK_TEST := 'N';
5474 END Lock_Row;
5475
5476 -- Function Get_Values
5477
5478 FUNCTION Get_Values
5479 ( p_header_rec IN OE_Order_PUB.Header_Rec_Type
5480 , p_old_header_rec IN OE_Order_PUB.Header_Rec_Type :=
5481 OE_Order_PUB.G_MISS_HEADER_REC
5482 ) RETURN OE_Order_PUB.Header_Val_Rec_Type
5483 IS
5484 l_header_val_rec OE_Order_PUB.Header_Val_Rec_Type;
5485 -- FP contracts word integration
5486 l_return_status VARCHAR2(30);
5487 l_msg_count NUMBER;
5488 l_msg_data VARCHAR2(2000);
5489 BEGIN
5490
5491 oe_debug_pub.add('Entering OE_HEADER_UTIL.GET_VALUES', 1);
5492
5493 l_header_val_rec := OE_Order_PUB.G_MISS_HEADER_VAL_REC;
5494
5495 IF (p_header_rec.accounting_rule_id IS NULL OR
5496 p_header_rec.accounting_rule_id <> FND_API.G_MISS_NUM) AND
5497 NOT OE_GLOBALS.Equal(p_header_rec.accounting_rule_id,
5498 p_old_header_rec.accounting_rule_id)
5499 THEN
5500 l_header_val_rec.accounting_rule := OE_Id_To_Value.Accounting_Rule
5501 ( p_accounting_rule_id => p_header_rec.accounting_rule_id
5502 );
5503 END IF;
5504
5505 IF (p_header_rec.agreement_id IS NULL OR
5506 p_header_rec.agreement_id <> FND_API.G_MISS_NUM) AND
5507 NOT OE_GLOBALS.Equal(p_header_rec.agreement_id,
5508 p_old_header_rec.agreement_id)
5509 THEN
5510 l_header_val_rec.agreement := OE_Id_To_Value.Agreement
5511 ( p_agreement_id => p_header_rec.agreement_id
5512 );
5513 END IF;
5514
5515 IF (p_header_rec.conversion_type_code IS NULL OR
5516 p_header_rec.conversion_type_code <> FND_API.G_MISS_CHAR) AND
5517 NOT OE_GLOBALS.Equal(p_header_rec.conversion_type_code,
5518 p_old_header_rec.conversion_type_code)
5519 THEN
5520 l_header_val_rec.conversion_type := OE_Id_To_Value.Conversion_Type
5521 ( p_conversion_type_code => p_header_rec.conversion_type_code
5522 );
5523 END IF;
5524
5525 IF (p_header_rec.deliver_to_contact_id IS NULL OR
5526 p_header_rec.deliver_to_contact_id <> FND_API.G_MISS_NUM) AND
5527 NOT OE_GLOBALS.Equal(p_header_rec.deliver_to_contact_id,
5528 p_old_header_rec.deliver_to_contact_id)
5529 THEN
5530 l_header_val_rec.deliver_to_contact := OE_Id_To_Value.Deliver_To_Contact
5531 ( p_deliver_to_contact_id => p_header_rec.deliver_to_contact_id
5532 );
5533 END IF;
5534
5535 IF (p_header_rec.deliver_to_org_id IS NULL OR
5536 p_header_rec.deliver_to_org_id <> FND_API.G_MISS_NUM) AND
5537 NOT OE_GLOBALS.Equal(p_header_rec.deliver_to_org_id,
5538 p_old_header_rec.deliver_to_org_id)
5539 THEN
5540 get_customer_details
5541 ( p_org_id => p_header_rec.deliver_to_org_id
5542 , p_site_use_code =>'DELIVER_TO'
5543 , x_customer_name => l_header_val_rec.deliver_to_customer_name
5544 , x_customer_number => l_header_val_rec.deliver_to_customer_number
5545 , x_customer_id => l_header_val_rec.deliver_to_customer_id
5546 , x_location => l_header_val_rec.deliver_to_location
5547 , x_address1 => l_header_val_rec.deliver_to_address1
5548 , x_address2 => l_header_val_rec.deliver_to_address2
5549 , x_address3 => l_header_val_rec.deliver_to_address3
5550 , x_address4 => l_header_val_rec.deliver_to_address4
5551 , x_city => l_header_val_rec.deliver_to_city
5552 , x_state => l_header_val_rec.deliver_to_state
5553 , x_zip => l_header_val_rec.deliver_to_zip
5554 , x_country => l_header_val_rec.deliver_to_country
5555 );
5556 l_header_val_rec.deliver_to_org :=l_header_val_rec.deliver_to_location;
5557
5558 END IF;
5559
5560 IF (p_header_rec.fob_point_code IS NULL OR
5561 p_header_rec.fob_point_code <> FND_API.G_MISS_CHAR) AND
5562 NOT OE_GLOBALS.Equal(p_header_rec.fob_point_code,
5563 p_old_header_rec.fob_point_code)
5564 THEN
5565 l_header_val_rec.fob_point := OE_Id_To_Value.Fob_Point
5566 ( p_fob_point_code => p_header_rec.fob_point_code
5567 );
5568 END IF;
5569
5570 IF (p_header_rec.freight_terms_code IS NULL OR
5571 p_header_rec.freight_terms_code <> FND_API.G_MISS_CHAR) AND
5572 NOT OE_GLOBALS.Equal(p_header_rec.freight_terms_code,
5573 p_old_header_rec.freight_terms_code)
5574 THEN
5575 l_header_val_rec.freight_terms := OE_Id_To_Value.Freight_Terms
5576 ( p_freight_terms_code => p_header_rec.freight_terms_code
5577 );
5578 END IF;
5579
5580 IF (p_header_rec.freight_carrier_code IS NULL OR
5581 p_header_rec.freight_carrier_code <> FND_API.G_MISS_CHAR) AND
5582 NOT OE_GLOBALS.Equal(p_header_rec.freight_carrier_code,
5583 p_old_header_rec.freight_carrier_code)
5584 THEN
5585 l_header_val_rec.freight_carrier := OE_Id_To_Value.Freight_Carrier
5586 ( p_freight_carrier_code => p_header_rec.freight_carrier_code
5587 , p_ship_from_org_id => p_header_rec.ship_from_org_id
5588 );
5589 END IF;
5590 IF (p_header_rec.shipping_method_code IS NULL OR
5591 p_header_rec.shipping_method_code <> FND_API.G_MISS_CHAR) AND
5592 NOT OE_GLOBALS.Equal(p_header_rec.shipping_method_code,
5593 p_old_header_rec.shipping_method_code)
5594 THEN
5595 l_header_val_rec.shipping_method := OE_Id_To_Value.ship_method
5596 ( p_ship_method_code => p_header_rec.shipping_method_code
5597 );
5598 END IF;
5599
5600 IF (p_header_rec.invoice_to_contact_id IS NULL OR
5601 p_header_rec.invoice_to_contact_id <> FND_API.G_MISS_NUM) AND
5602 NOT OE_GLOBALS.Equal(p_header_rec.invoice_to_contact_id,
5603 p_old_header_rec.invoice_to_contact_id)
5604 THEN
5605 l_header_val_rec.invoice_to_contact := OE_Id_To_Value.Invoice_To_Contact
5606 ( p_invoice_to_contact_id => p_header_rec.invoice_to_contact_id
5607 );
5608 END IF;
5609
5610 IF (p_header_rec.invoice_to_org_id IS NULL OR
5611 p_header_rec.invoice_to_org_id <> FND_API.G_MISS_NUM) AND
5612 NOT OE_GLOBALS.Equal(p_header_rec.invoice_to_org_id,
5613 p_old_header_rec.invoice_to_org_id)
5614 THEN
5615
5616 get_customer_details
5617 ( p_org_id => p_header_rec.invoice_to_org_id
5618 , p_site_use_code =>'BILL_TO'
5619 , x_customer_name => l_header_val_rec.invoice_to_customer_name
5620 , x_customer_number => l_header_val_rec.invoice_to_customer_number
5621 , x_customer_id => l_header_val_rec.invoice_to_customer_id
5622 , x_location => l_header_val_rec.invoice_to_location
5623 , x_address1 => l_header_val_rec.invoice_to_address1
5624 , x_address2 => l_header_val_rec.invoice_to_address2
5625 , x_address3 => l_header_val_rec.invoice_to_address3
5626 , x_address4 => l_header_val_rec.invoice_to_address4
5627 , x_city => l_header_val_rec.invoice_to_city
5628 , x_state => l_header_val_rec.invoice_to_state
5629 , x_zip => l_header_val_rec.invoice_to_zip
5630 , x_country => l_header_val_rec.invoice_to_country
5631 );
5632 l_header_val_rec.invoice_to_org :=l_header_val_rec.invoice_to_location;
5633
5634 END IF;
5635
5636 IF (p_header_rec.invoicing_rule_id IS NULL OR
5637 p_header_rec.invoicing_rule_id <> FND_API.G_MISS_NUM) AND
5638 NOT OE_GLOBALS.Equal(p_header_rec.invoicing_rule_id,
5639 p_old_header_rec.invoicing_rule_id)
5640 THEN
5641 l_header_val_rec.invoicing_rule := OE_Id_To_Value.Invoicing_Rule
5642 ( p_invoicing_rule_id => p_header_rec.invoicing_rule_id
5643 );
5644 END IF;
5645
5646 IF (p_header_rec.order_source_id IS NULL OR
5647 p_header_rec.order_source_id <> FND_API.G_MISS_NUM) AND
5648 NOT OE_GLOBALS.Equal(p_header_rec.order_source_id,
5649 p_old_header_rec.order_source_id)
5650 THEN
5651 l_header_val_rec.order_source := OE_Id_To_Value.Order_Source
5652 ( p_order_source_id => p_header_rec.order_source_id
5653 );
5654 END IF;
5655
5656 IF (p_header_rec.order_date_type_code IS NULL OR
5657 p_header_rec.order_date_type_code <> FND_API.G_MISS_CHAR) AND
5658 NOT OE_GLOBALS.Equal(p_header_rec.order_date_type_code,
5659 p_old_header_rec.order_date_type_code)
5660 THEN
5661 l_header_val_rec.order_date_type := OE_Id_To_Value.Order_Date_Type
5662 ( p_order_date_type_code => p_header_rec.order_date_type_code
5663 );
5664 END IF;
5665
5666 IF (p_header_rec.order_type_id IS NULL OR
5667 p_header_rec.order_type_id <> FND_API.G_MISS_NUM) AND
5668 NOT OE_GLOBALS.Equal(p_header_rec.order_type_id,
5669 p_old_header_rec.order_type_id)
5670 THEN
5671 l_header_val_rec.order_type := OE_Id_To_Value.Order_Type
5672 ( p_order_type_id => p_header_rec.order_type_id
5673 );
5674 END IF;
5675
5676 IF (p_header_rec.payment_term_id IS NULL OR
5677 p_header_rec.payment_term_id <> FND_API.G_MISS_NUM) AND
5678 NOT OE_GLOBALS.Equal(p_header_rec.payment_term_id,
5679 p_old_header_rec.payment_term_id)
5680 THEN
5681 l_header_val_rec.payment_term := OE_Id_To_Value.Payment_Term
5682 ( p_payment_term_id => p_header_rec.payment_term_id
5683 );
5684 END IF;
5685
5686 IF (p_header_rec.price_list_id IS NULL OR
5687 p_header_rec.price_list_id <> FND_API.G_MISS_NUM) AND
5688 NOT OE_GLOBALS.Equal(p_header_rec.price_list_id,
5689 p_old_header_rec.price_list_id)
5690 THEN
5691 l_header_val_rec.price_list := OE_Id_To_Value.Price_List
5692 ( p_price_list_id => p_header_rec.price_list_id
5693 );
5694 END IF;
5695
5696 IF (p_header_rec.return_reason_code IS NULL OR
5697 p_header_rec.return_reason_code <> FND_API.G_MISS_CHAR) AND
5698 NOT OE_GLOBALS.Equal(p_header_rec.return_reason_code,
5699 p_old_header_rec.return_reason_code)
5700 THEN
5701 l_header_val_rec.return_reason := OE_Id_To_Value.return_reason
5702 ( p_return_reason_code => p_header_rec.return_reason_code
5703 );
5704 END IF;
5705
5706 IF (p_header_rec.salesrep_id IS NULL OR
5707 p_header_rec.salesrep_id <> FND_API.G_MISS_NUM) AND
5708 NOT OE_GLOBALS.Equal(p_header_rec.salesrep_id,
5709 p_old_header_rec.salesrep_id)
5710 THEN
5711 l_header_val_rec.salesrep := OE_Id_To_Value.salesrep
5712 ( p_salesrep_id => p_header_rec.salesrep_id
5713 );
5714 END IF;
5715
5716 IF (p_header_rec.sales_channel_code IS NULL OR
5717 p_header_rec.sales_channel_code <> FND_API.G_MISS_CHAR) AND
5718 NOT OE_GLOBALS.Equal(p_header_rec.sales_channel_code,
5719 p_old_header_rec.sales_channel_code)
5720 THEN
5721 l_header_val_rec.sales_channel:= OE_Id_To_Value.sales_channel
5722 ( p_sales_channel_code => p_header_rec.sales_channel_code
5723 );
5724 END IF;
5725
5726 IF (p_header_rec.shipment_priority_code IS NULL OR
5727 p_header_rec.shipment_priority_code <> FND_API.G_MISS_CHAR) AND
5728 NOT OE_GLOBALS.Equal(p_header_rec.shipment_priority_code,
5729 p_old_header_rec.shipment_priority_code)
5730 THEN
5731 l_header_val_rec.shipment_priority := OE_Id_To_Value.Shipment_Priority
5732 ( p_shipment_priority_code => p_header_rec.shipment_priority_code
5733 );
5734 END IF;
5735
5736 IF (p_header_rec.demand_class_code IS NULL OR
5737 p_header_rec.demand_class_code <> FND_API.G_MISS_CHAR) AND
5738 NOT OE_GLOBALS.Equal(p_header_rec.demand_class_code,
5739 p_old_header_rec.demand_class_code)
5740 THEN
5741 l_header_val_rec.Demand_Class := OE_Id_To_Value.Demand_Class
5742 ( p_demand_class_code => p_header_rec.demand_class_code
5743 );
5744 END IF;
5745
5746 IF (p_header_rec.ship_from_org_id IS NULL OR
5747 p_header_rec.ship_from_org_id <> FND_API.G_MISS_NUM) AND
5748 NOT OE_GLOBALS.Equal(p_header_rec.ship_from_org_id,
5749 p_old_header_rec.ship_from_org_id)
5750 THEN
5751 OE_Id_To_Value.Ship_From_Org
5752 ( p_ship_from_org_id => p_header_rec.ship_from_org_id
5753 , x_ship_from_address1 => l_header_val_rec.ship_from_address1
5754 , x_ship_from_address2 => l_header_val_rec.ship_from_address2
5755 , x_ship_from_address3 => l_header_val_rec.ship_from_address3
5756 , x_ship_from_address4 => l_header_val_rec.ship_from_address4
5757 , x_ship_from_location => l_header_val_rec.ship_from_location
5758 , x_ship_from_org => l_header_val_rec.ship_from_org
5759 );
5760 END IF;
5761
5762 IF (p_header_rec.ship_to_contact_id IS NULL OR
5763 p_header_rec.ship_to_contact_id <> FND_API.G_MISS_NUM) AND
5764 NOT OE_GLOBALS.Equal(p_header_rec.ship_to_contact_id,
5765 p_old_header_rec.ship_to_contact_id)
5766 THEN
5767 l_header_val_rec.ship_to_contact := OE_Id_To_Value.Ship_To_Contact
5768 ( p_ship_to_contact_id => p_header_rec.ship_to_contact_id
5769 );
5770 END IF;
5771
5772 IF (p_header_rec.ship_to_org_id IS NULL OR
5773 p_header_rec.ship_to_org_id <> FND_API.G_MISS_NUM) AND
5774 NOT OE_GLOBALS.Equal(p_header_rec.ship_to_org_id,
5775 p_old_header_rec.ship_to_org_id)
5776 THEN
5777 get_customer_details
5778 ( p_org_id => p_header_rec.ship_to_org_id
5779 , p_site_use_code =>'SHIP_TO'
5780 , x_customer_name => l_header_val_rec.ship_to_customer_name
5781 , x_customer_number => l_header_val_rec.ship_to_customer_number
5782 , x_customer_id => l_header_val_rec.ship_to_customer_id
5783 , x_location => l_header_val_rec.ship_to_location
5784 , x_address1 => l_header_val_rec.ship_to_address1
5785 , x_address2 => l_header_val_rec.ship_to_address2
5786 , x_address3 => l_header_val_rec.ship_to_address3
5787 , x_address4 => l_header_val_rec.ship_to_address4
5788 , x_city => l_header_val_rec.ship_to_city
5789 , x_state => l_header_val_rec.ship_to_state
5790 , x_zip => l_header_val_rec.ship_to_zip
5791 , x_country => l_header_val_rec.ship_to_country
5792 );
5793 l_header_val_rec.ship_to_org :=l_header_val_rec.ship_to_location;
5794
5795 END IF;
5796
5797
5798 IF (p_header_rec.sold_to_contact_id IS NULL OR
5799 p_header_rec.sold_to_contact_id <> FND_API.G_MISS_NUM) AND
5800 NOT OE_GLOBALS.Equal(p_header_rec.sold_to_contact_id,
5801 p_old_header_rec.sold_to_contact_id)
5802 THEN
5803 l_header_val_rec.sold_to_contact := OE_Id_To_Value.Sold_To_Contact
5804 ( p_sold_to_contact_id => p_header_rec.sold_to_contact_id
5805 );
5806 END IF;
5807
5808 IF (p_header_rec.sold_to_org_id IS NULL OR
5809 p_header_rec.sold_to_org_id <> FND_API.G_MISS_NUM) AND
5810 NOT OE_GLOBALS.Equal(p_header_rec.sold_to_org_id,
5811 p_old_header_rec.sold_to_org_id)
5812 THEN
5813 OE_Id_To_Value.Sold_To_Org
5814 ( p_sold_to_org_id => p_header_rec.sold_to_org_id
5815 , x_org => l_header_val_rec.sold_to_org
5816 , x_customer_number => l_header_val_rec.customer_number
5817 --added for Ac. Desc, Registry ID Project
5818 , x_account_description => l_header_val_rec.account_description
5819 , x_registry_id => l_header_val_rec.registry_id
5820 );
5821 END IF;
5822
5823 IF (p_header_rec.tax_exempt_flag IS NULL OR
5824 p_header_rec.tax_exempt_flag <> FND_API.G_MISS_CHAR) AND
5825 NOT OE_GLOBALS.Equal(p_header_rec.tax_exempt_flag,
5826 p_old_header_rec.tax_exempt_flag)
5827 THEN
5828 l_header_val_rec.tax_exempt := OE_Id_To_Value.Tax_Exempt
5829 ( p_tax_exempt_flag => p_header_rec.tax_exempt_flag
5830 );
5831 END IF;
5832
5833 IF (p_header_rec.tax_exempt_reason_code IS NULL OR
5834 p_header_rec.tax_exempt_reason_code <> FND_API.G_MISS_CHAR) AND
5835 NOT OE_GLOBALS.Equal(p_header_rec.tax_exempt_reason_code,
5836 p_old_header_rec.tax_exempt_reason_code)
5837 THEN
5838 l_header_val_rec.tax_exempt_reason := OE_Id_To_Value.Tax_Exempt_Reason
5839 ( p_tax_exempt_reason_code => p_header_rec.tax_exempt_reason_code
5840 );
5841 END IF;
5842
5843 IF (p_header_rec.tax_point_code IS NULL OR
5844 p_header_rec.tax_point_code <> FND_API.G_MISS_CHAR) AND
5845 NOT OE_GLOBALS.Equal(p_header_rec.tax_point_code,
5846 p_old_header_rec.tax_point_code)
5847 THEN
5848 l_header_val_rec.tax_point := OE_Id_To_Value.Tax_Point
5849 ( p_tax_point_code => p_header_rec.tax_point_code
5850 );
5851 END IF;
5852
5853 IF (p_header_rec.payment_type_code IS NULL OR
5854 p_header_rec.payment_type_code <> FND_API.G_MISS_CHAR) AND
5855 NOT OE_GLOBALS.Equal(p_header_rec.payment_type_code,
5856 p_old_header_rec.payment_type_code)
5857 THEN
5858 l_header_val_rec.payment_type := OE_Id_To_Value.Payment_Type
5859 ( p_payment_type_code => p_header_rec.payment_type_code
5860 );
5861 END IF;
5862 --R12 CC Encryption
5863 IF (p_header_rec.credit_card_code IS NULL OR
5864 p_header_rec.credit_card_code <> FND_API.G_MISS_CHAR) AND
5865 NOT OE_GLOBALS.Equal(p_header_rec.credit_card_code,
5866 p_old_header_rec.credit_card_code)
5867 THEN
5868 l_header_val_rec.credit_card := OE_Id_To_Value.Credit_Card
5869 ( p_credit_card_code => p_header_rec.credit_card_code
5870 );
5871 END IF;
5872 -- QUOTING changes
5873
5874 IF (p_header_rec.sold_to_site_use_id IS NULL OR
5875 p_header_rec.sold_to_site_use_id <> FND_API.G_MISS_NUM) AND
5876 NOT OE_GLOBALS.Equal(p_header_rec.sold_to_site_use_id,
5877 p_old_header_rec.sold_to_site_use_id)
5878 THEN
5879
5880 OE_ID_TO_VALUE.CUSTOMER_LOCATION
5881 ( p_sold_to_site_use_id => p_header_rec.sold_to_site_use_id
5882 , x_sold_to_location_address1 => l_header_val_rec.sold_to_location_address1
5883 , x_sold_to_location_address2 => l_header_val_rec.sold_to_location_address2
5884 , x_sold_to_location_address3 => l_header_val_rec.sold_to_location_address3
5885 , x_sold_to_location_address4 => l_header_val_rec.sold_to_location_address4
5886 , x_sold_to_location => l_header_val_rec.sold_to_location
5887 , x_sold_to_location_city => l_header_val_rec.sold_to_location_city
5888 , x_sold_to_location_state => l_header_val_rec.sold_to_location_state
5889 , x_sold_to_location_postal => l_header_val_rec.sold_to_location_postal
5890 , x_sold_to_location_country => l_header_val_rec.sold_to_location_country
5891 );
5892
5893 END IF;
5894
5895 IF (p_header_rec.transaction_phase_code IS NULL OR
5896 p_header_rec.transaction_phase_code <> FND_API.G_MISS_CHAR) AND
5897 NOT OE_GLOBALS.Equal(p_header_rec.transaction_phase_code,
5898 p_old_header_rec.transaction_phase_code)
5899 THEN
5900 l_header_val_rec.transaction_phase := OE_Id_To_Value.Transaction_Phase
5901 ( p_transaction_phase_code => p_header_rec.transaction_phase_code
5902 );
5903 END IF;
5904
5905 IF (p_header_rec.user_status_code IS NULL OR
5906 p_header_rec.user_status_code <> FND_API.G_MISS_CHAR) AND
5907 NOT OE_GLOBALS.Equal(p_header_rec.user_status_code,
5908 p_old_header_rec.user_status_code)
5909 THEN
5910 l_header_val_rec.user_status := OE_Id_To_Value.User_Status
5911 ( p_user_status_code => p_header_rec.user_status_code
5912 );
5913 END IF;
5914
5915 -- END QUOTING changes
5916
5917 --distributed orders
5918 IF (p_header_rec.end_customer_id IS NOT NULL AND
5919 p_header_rec.end_customer_id <> FND_API.G_MISS_NUM)
5920 THEN
5921 OE_ID_TO_VALUE.End_Customer(
5922 p_end_customer_id => p_header_rec.end_customer_id
5923 ,x_end_customer_name => l_header_val_rec.end_customer_name
5924 ,x_end_customer_number => l_header_val_rec.end_customer_number);
5925 END IF;
5926
5927 IF (p_header_rec.end_customer_contact_id IS NOT NULL AND
5928 p_header_rec.end_customer_contact_id <> FND_API.G_MISS_NUM)
5929 THEN
5930 l_header_val_rec.end_customer_contact :=
5931 OE_ID_TO_VALUE.end_customer_Contact(p_end_customer_contact_id => p_header_rec.end_customer_contact_id);
5932 END IF;
5933
5934 IF (p_header_rec.end_customer_site_use_id IS NOT NULL AND
5935 p_header_rec.end_customer_site_use_id <> FND_API.G_MISS_NUM)
5936 THEN
5937 OE_ID_TO_VALUE.end_customer_site_use(
5938 p_end_customer_site_use_id => p_header_rec.end_customer_site_use_id
5939 ,x_end_customer_address1 => l_header_val_rec.end_customer_site_address1
5940 ,x_end_customer_address2 => l_header_val_rec.end_customer_site_address2
5941 ,x_end_customer_address3 => l_header_val_rec.end_customer_site_address3
5942 ,x_end_customer_address4 => l_header_val_rec.end_customer_site_address4
5943 ,x_end_customer_location => l_header_val_rec.end_customer_site_location
5944 ,x_end_customer_city => l_header_val_rec.end_customer_site_city
5945 ,x_end_customer_state => l_header_val_rec.end_customer_site_state
5946 ,x_end_customer_postal_code => l_header_val_rec.end_customer_site_postal_code
5947 ,x_end_customer_country => l_header_val_rec.end_customer_site_country );
5948 END IF;
5949
5950 -- Start BSA pricing
5951 IF (p_header_rec.blanket_number IS NOT NULL OR
5952 p_header_rec.blanket_number <> FND_API.G_MISS_NUM)
5953 THEN
5954 oe_blanket_util_misc.get_blanketAgrName
5955 (p_blanket_number => p_header_rec.blanket_number,
5956 x_blanket_agr_name => l_header_val_rec.blanket_agreement_name);
5957 END if;
5958 -- END BSA pricing
5959
5960 IF (p_header_rec.ib_owner IS NULL OR
5961 p_header_rec.ib_owner <> FND_API.G_MISS_CHAR) AND
5962 NOT OE_GLOBALS.Equal(p_header_rec.ib_owner,
5963 p_old_header_rec.ib_owner)
5964 THEN
5965 l_header_val_rec.ib_owner_dsp := OE_Id_To_Value.ib_owner
5966 ( p_ib_owner => p_header_rec.ib_owner
5967 );
5968 END IF;
5969
5970 IF (p_header_rec.ib_current_location IS NULL OR
5971 p_header_rec.ib_current_location <> FND_API.G_MISS_CHAR) AND
5972 NOT OE_GLOBALS.Equal(p_header_rec.ib_current_location,
5973 p_old_header_rec.ib_current_location)
5974 THEN
5975 l_header_val_rec.ib_current_location_dsp := OE_Id_To_Value.ib_current_location(
5976 p_ib_current_location=>p_header_rec.ib_current_location
5977 );
5978 END IF;
5979
5980 IF (p_header_rec.ib_installed_at_location IS NULL OR
5981 p_header_rec.ib_installed_at_location <> FND_API.G_MISS_CHAR) AND
5982 NOT OE_GLOBALS.Equal(p_header_rec.ib_installed_at_location,
5983 p_old_header_rec.ib_installed_at_location)
5984 THEN
5985 l_header_val_rec.ib_installed_at_location_dsp := OE_Id_To_Value.ib_installed_at_location(
5986 p_ib_installed_at_location=>p_header_rec.ib_installed_at_location
5987 );
5988 END IF;
5989
5990 -- FP contracts word integration
5991 IF p_header_rec.order_type_id IS NOT NULL
5992 AND p_header_rec.order_type_id <> FND_API.G_MISS_NUM
5993 AND OE_Contracts_util.check_license = 'Y'
5994 THEN
5995
5996 OE_CONTRACTS_UTIL.GET_CONTRACT_DEFAULTS(
5997 p_api_version => 1.0,
5998 p_init_msg_list => FND_API.G_FALSE,
5999 p_doc_type => 'O',
6000 p_template_id => p_header_rec.contract_template_id,
6001 x_authoring_party => l_header_val_rec.authoring_party,
6002 x_contract_source => l_header_val_rec.contract_source,
6003 x_template_name => l_header_val_rec.contract_template,
6004 x_return_status => l_return_status,
6005 x_msg_count => l_msg_count,
6006 x_msg_data => l_msg_data
6007 );
6008
6009 END IF;
6010
6011 oe_debug_pub.add('Exiting OE_HEADER_UTIL.GET_VALUES', 1);
6012
6013 RETURN l_header_val_rec;
6014
6015 END Get_Values;
6016
6017 -- Function Get_Ids
6018
6019 PROCEDURE Get_Ids
6020 ( p_x_header_rec IN OUT NOCOPY OE_Order_PUB.Header_Rec_Type
6021 , p_header_val_rec IN OE_Order_PUB.Header_Val_Rec_Type
6022 )
6023 IS
6024 l_sold_to_org_id NUMBER;
6025 l_ship_to_org_id NUMBER;
6026 l_invoice_to_org_id NUMBER;
6027 l_deliver_to_org_id NUMBER;
6028 BEGIN
6029
6030 oe_debug_pub.add('Entering OE_HEADER_UTIL.GET_IDS', 1);
6031
6032
6033 IF p_header_val_rec.accounting_rule <> FND_API.G_MISS_CHAR
6034 THEN
6035
6036 IF p_x_header_rec.accounting_rule_id <> FND_API.G_MISS_NUM THEN
6037
6038
6039 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6040 THEN
6041
6042 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6043 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','accounting_rule');
6044 OE_MSG_PUB.Add;
6045
6046 END IF;
6047
6048 ELSE
6049
6050 p_x_header_rec.accounting_rule_id := OE_Value_To_Id.accounting_rule
6051 ( p_accounting_rule => p_header_val_rec.accounting_rule
6052 );
6053
6054 IF p_x_header_rec.accounting_rule_id = FND_API.G_MISS_NUM THEN
6055 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6056 END IF;
6057
6058 END IF;
6059
6060 END IF;
6061
6062 IF p_header_val_rec.agreement <> FND_API.G_MISS_CHAR
6063 THEN
6064
6065 IF p_x_header_rec.agreement_id <> FND_API.G_MISS_NUM THEN
6066
6067
6068
6069 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6070 THEN
6071
6072 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6073 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','agreement');
6074 OE_MSG_PUB.Add;
6075
6076 END IF;
6077
6078 ELSE
6079
6080 p_x_header_rec.agreement_id := OE_Value_To_Id.agreement
6081 ( p_agreement => p_header_val_rec.agreement
6082 );
6083
6084 IF p_x_header_rec.agreement_id = FND_API.G_MISS_NUM THEN
6085 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6086 END IF;
6087
6088 END IF;
6089
6090 END IF;
6091
6092 IF p_header_val_rec.conversion_type <> FND_API.G_MISS_CHAR
6093 THEN
6094
6095 IF p_x_header_rec.conversion_type_code <> FND_API.G_MISS_CHAR THEN
6096
6097
6098 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6099 THEN
6100
6101 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6102 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','conversion_type');
6103 OE_MSG_PUB.Add;
6104
6105 END IF;
6106
6107 ELSE
6108
6109 p_x_header_rec.conversion_type_code := OE_Value_To_Id.conversion_type
6110 ( p_conversion_type => p_header_val_rec.conversion_type
6111 );
6112
6113 IF p_x_header_rec.conversion_type_code = FND_API.G_MISS_CHAR THEN
6114 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6115 END IF;
6116
6117 END IF;
6118
6119 END IF;
6120
6121 IF p_header_val_rec.fob_point <> FND_API.G_MISS_CHAR
6122 THEN
6123
6124 IF p_x_header_rec.fob_point_code <> FND_API.G_MISS_CHAR THEN
6125
6126
6127 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6128 THEN
6129
6130 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6131 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','fob_point');
6132 OE_MSG_PUB.Add;
6133
6134 END IF;
6135
6136 ELSE
6137
6138 p_x_header_rec.fob_point_code := OE_Value_To_Id.fob_point
6139 ( p_fob_point => p_header_val_rec.fob_point
6140 );
6141
6142 IF p_x_header_rec.fob_point_code = FND_API.G_MISS_CHAR THEN
6143 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6144 END IF;
6145
6146 END IF;
6147
6148 END IF;
6149
6150 IF p_header_val_rec.freight_terms <> FND_API.G_MISS_CHAR
6151 THEN
6152
6153 IF p_x_header_rec.freight_terms_code <> FND_API.G_MISS_CHAR THEN
6154
6155
6156 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6157 THEN
6158
6159 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6160 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','freight_terms');
6161 OE_MSG_PUB.Add;
6162
6163 END IF;
6164
6165 ELSE
6166
6167 p_x_header_rec.freight_terms_code := OE_Value_To_Id.freight_terms
6168 ( p_freight_terms => p_header_val_rec.freight_terms
6169 );
6170
6171 IF p_x_header_rec.freight_terms_code = FND_API.G_MISS_CHAR THEN
6172 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6173 END IF;
6174
6175 END IF;
6176
6177 END IF;
6178 IF p_header_val_rec.shipping_method <> FND_API.G_MISS_CHAR
6179 THEN
6180
6181 IF p_x_header_rec.shipping_method_code <> FND_API.G_MISS_CHAR THEN
6182
6183
6184 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6185 THEN
6186
6187 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6188 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','shipping_method');
6189 OE_MSG_PUB.Add;
6190
6191 END IF;
6192
6193 ELSE
6194
6195 p_x_header_rec.shipping_method_code := OE_Value_To_Id.ship_method
6196 ( p_ship_method => p_header_val_rec.shipping_method
6197 );
6198
6199 IF p_x_header_rec.shipping_method_code = FND_API.G_MISS_CHAR THEN
6200 oe_debug_pub.add('Ship Method Conversion Error');
6201 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6202 END IF;
6203
6204 END IF;
6205
6206 END IF;
6207
6208
6209 IF p_header_val_rec.freight_carrier <> FND_API.G_MISS_CHAR
6210 THEN
6211
6212 IF p_x_header_rec.freight_carrier_code <> FND_API.G_MISS_CHAR THEN
6213
6214
6215 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6216 THEN
6217
6218 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6219 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','freight_carrier');
6220 OE_MSG_PUB.Add;
6221
6222 END IF;
6223
6224 ELSE
6225
6226 p_x_header_rec.freight_carrier_code := OE_Value_To_Id.freight_carrier
6227 ( p_freight_carrier => p_header_val_rec.freight_carrier
6228 , p_ship_from_org_id => p_x_header_rec.ship_from_org_id
6229 );
6230
6231 IF p_x_header_rec.freight_carrier_code = FND_API.G_MISS_CHAR THEN
6232 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6233 END IF;
6234
6235 END IF;
6236
6237 END IF;
6238
6239 IF p_header_val_rec.invoicing_rule <> FND_API.G_MISS_CHAR
6240 THEN
6241
6242 IF p_x_header_rec.invoicing_rule_id <> FND_API.G_MISS_NUM THEN
6243
6244
6245 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6246 THEN
6247
6248 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6249 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','invoicing_rule');
6250 OE_MSG_PUB.Add;
6251
6252 END IF;
6253
6254 ELSE
6255
6256 p_x_header_rec.invoicing_rule_id := OE_Value_To_Id.invoicing_rule
6257 ( p_invoicing_rule => p_header_val_rec.invoicing_rule
6258 );
6259
6260 IF p_x_header_rec.invoicing_rule_id = FND_API.G_MISS_NUM THEN
6261 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6262 END IF;
6263
6264 END IF;
6265
6266 END IF;
6267
6268 IF p_header_val_rec.order_source <> FND_API.G_MISS_CHAR
6269 THEN
6270
6271 IF p_x_header_rec.order_source_id <> FND_API.G_MISS_NUM THEN
6272
6273
6274 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6275 THEN
6276
6277 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6278 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','order_source');
6279 OE_MSG_PUB.Add;
6280
6281 END IF;
6282
6283 ELSE
6284
6285 p_x_header_rec.order_source_id := OE_Value_To_Id.order_source
6286 ( p_order_source => p_header_val_rec.order_source
6287 );
6288
6289 IF p_x_header_rec.order_source_id = FND_API.G_MISS_NUM THEN
6290 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6291 END IF;
6292
6293 END IF;
6294
6295 END IF;
6296
6297 IF p_header_val_rec.order_type <> FND_API.G_MISS_CHAR
6298 THEN
6299
6300 IF p_x_header_rec.order_type_id <> FND_API.G_MISS_NUM THEN
6301
6302
6303 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6304 THEN
6305
6306 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6307 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','order_type');
6308 OE_MSG_PUB.Add;
6309
6310 END IF;
6311
6312 ELSE
6313
6314 p_x_header_rec.order_type_id := OE_Value_To_Id.order_type
6315 ( p_order_type => p_header_val_rec.order_type
6316 );
6317
6318 IF p_x_header_rec.order_type_id = FND_API.G_MISS_NUM THEN
6319 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6320 END IF;
6321
6322 END IF;
6323
6324 END IF;
6325
6326 IF p_header_val_rec.payment_term <> FND_API.G_MISS_CHAR
6327 THEN
6328
6329 IF p_x_header_rec.payment_term_id <> FND_API.G_MISS_NUM THEN
6330
6331
6332 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6333 THEN
6334
6335 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6336 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','payment_term');
6337 OE_MSG_PUB.Add;
6338
6339 END IF;
6340
6341 ELSE
6342
6343 p_x_header_rec.payment_term_id := OE_Value_To_Id.payment_term
6344 ( p_payment_term => p_header_val_rec.payment_term
6345 );
6346
6347 IF p_x_header_rec.payment_term_id = FND_API.G_MISS_NUM THEN
6348 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6349 END IF;
6350
6351 END IF;
6352
6353 END IF;
6354
6355 IF p_header_val_rec.price_list <> FND_API.G_MISS_CHAR
6356 THEN
6357
6358 IF p_x_header_rec.price_list_id <> FND_API.G_MISS_NUM THEN
6359
6360
6361 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6362 THEN
6363
6364 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6365 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','price_list');
6366 OE_MSG_PUB.Add;
6367
6368 END IF;
6369
6370 ELSE
6371
6372 p_x_header_rec.price_list_id := OE_Value_To_Id.price_list
6373 ( p_price_list => p_header_val_rec.price_list
6374 );
6375
6376 IF p_x_header_rec.price_list_id = FND_API.G_MISS_NUM THEN
6377 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6378 END IF;
6379
6380 END IF;
6381
6382 END IF;
6383
6384 IF p_header_val_rec.return_reason <> FND_API.G_MISS_CHAR
6385 THEN
6386
6387 IF p_x_header_rec.return_reason_code <> FND_API.G_MISS_CHAR THEN
6388
6389
6390 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6391 THEN
6392
6393 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6394 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','return_reason');
6395 OE_MSG_PUB.Add;
6396
6397 END IF;
6398
6399 ELSE
6400
6401 p_x_header_rec.return_reason_code := OE_Value_To_Id.return_reason
6402 ( p_return_reason => p_header_val_rec.return_reason
6403 );
6404
6405 IF p_x_header_rec.return_reason_code = FND_API.G_MISS_CHAR THEN
6406 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6407 END IF;
6408
6409 END IF;
6410
6411 END IF;
6412
6413 IF p_header_val_rec.salesrep <> FND_API.G_MISS_CHAR
6414 THEN
6415
6416 IF p_x_header_rec.salesrep_id <> FND_API.G_MISS_NUM THEN
6417
6418
6419 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6420 THEN
6421
6422 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6423 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','salesrep');
6424 OE_MSG_PUB.Add;
6425
6426 END IF;
6427
6428 ELSE
6429
6430 p_x_header_rec.salesrep_id := OE_Value_To_Id.salesrep
6431 ( p_salesrep => p_header_val_rec.salesrep
6432 );
6433 IF p_x_header_rec.salesrep_id = FND_API.G_MISS_NUM THEN
6434 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6435 END IF;
6436
6437 END IF;
6438
6439 END IF;
6440
6441
6442 IF p_header_val_rec.sales_channel <> FND_API.G_MISS_CHAR
6443 THEN
6444
6445 IF p_x_header_rec.sales_channel_code <> FND_API.G_MISS_CHAR THEN
6446
6447
6448 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6449 THEN
6450
6451 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6452 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sales_channel');
6453 OE_MSG_PUB.Add;
6454
6455 END IF;
6456
6457 ELSE
6458
6459 p_x_header_rec.sales_channel_code := OE_Value_To_Id.sales_channel
6460 ( p_sales_channel => p_header_val_rec.sales_channel
6461 );
6462 IF p_x_header_rec.sales_channel_code = FND_API.G_MISS_CHAR THEN
6463 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6464 END IF;
6465
6466 END IF;
6467
6468 END IF;
6469
6470
6471 IF p_header_val_rec.shipment_priority <> FND_API.G_MISS_CHAR
6472 THEN
6473
6474 IF p_x_header_rec.shipment_priority_code <> FND_API.G_MISS_CHAR THEN
6475
6476
6477 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6478 THEN
6479
6480 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6481 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','shipment_priority');
6482 OE_MSG_PUB.Add;
6483
6484 END IF;
6485
6486 ELSE
6487
6488 p_x_header_rec.shipment_priority_code := OE_Value_To_Id.shipment_priority
6489 ( p_shipment_priority => p_header_val_rec.shipment_priority
6490 );
6491
6492 IF p_x_header_rec.shipment_priority_code = FND_API.G_MISS_CHAR THEN
6493 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6494 END IF;
6495
6496 END IF;
6497
6498 END IF;
6499
6500 IF p_header_val_rec.ship_from_address1 <> FND_API.G_MISS_CHAR
6501 OR p_header_val_rec.ship_from_address2 <> FND_API.G_MISS_CHAR
6502 OR p_header_val_rec.ship_from_address3 <> FND_API.G_MISS_CHAR
6503 OR p_header_val_rec.ship_from_address4 <> FND_API.G_MISS_CHAR
6504 OR p_header_val_rec.ship_from_location <> FND_API.G_MISS_CHAR
6505 OR p_header_val_rec.ship_from_org <> FND_API.G_MISS_CHAR
6506 THEN
6507
6508 IF p_x_header_rec.ship_from_org_id <> FND_API.G_MISS_NUM THEN
6509
6510
6511 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6512 THEN
6513
6514 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6515 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ship_from_org');
6516 OE_MSG_PUB.Add;
6517
6518 END IF;
6519
6520 ELSE
6521
6522 p_x_header_rec.ship_from_org_id := OE_Value_To_Id.ship_from_org
6523 ( p_ship_from_address1 => p_header_val_rec.ship_from_address1
6524 , p_ship_from_address2 => p_header_val_rec.ship_from_address2
6525 , p_ship_from_address3 => p_header_val_rec.ship_from_address3
6526 , p_ship_from_address4 => p_header_val_rec.ship_from_address4
6527 , p_ship_from_location => p_header_val_rec.ship_from_location
6528 , p_ship_from_org => p_header_val_rec.ship_from_org
6529 );
6530
6531 IF p_x_header_rec.ship_from_org_id = FND_API.G_MISS_NUM THEN
6532 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6533 END IF;
6534
6535 END IF;
6536
6537 END IF;
6538
6539 IF p_header_val_rec.tax_exempt <> FND_API.G_MISS_CHAR
6540 THEN
6541
6542 IF p_x_header_rec.tax_exempt_flag <> FND_API.G_MISS_CHAR THEN
6543
6544
6545 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6546 THEN
6547
6548 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6549 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','tax_exempt');
6550 OE_MSG_PUB.Add;
6551
6552 END IF;
6553
6554 ELSE
6555
6556 p_x_header_rec.tax_exempt_flag := OE_Value_To_Id.tax_exempt
6557 ( p_tax_exempt => p_header_val_rec.tax_exempt
6558 );
6559
6560 IF p_x_header_rec.tax_exempt_flag = FND_API.G_MISS_CHAR THEN
6561 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6562 END IF;
6563
6564 END IF;
6565
6566 END IF;
6567
6568 IF p_header_val_rec.tax_exempt_reason <> FND_API.G_MISS_CHAR
6569 THEN
6570
6571 IF p_x_header_rec.tax_exempt_reason_code <> FND_API.G_MISS_CHAR THEN
6572
6573
6574 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6575 THEN
6576
6577 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6578 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','tax_exempt_reason');
6579 OE_MSG_PUB.Add;
6580
6581 END IF;
6582
6583 ELSE
6584
6585 p_x_header_rec.tax_exempt_reason_code := OE_Value_To_Id.tax_exempt_reason
6586 ( p_tax_exempt_reason => p_header_val_rec.tax_exempt_reason
6587 );
6588
6589 IF p_x_header_rec.tax_exempt_reason_code = FND_API.G_MISS_CHAR THEN
6590 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6591 END IF;
6592
6593 END IF;
6594
6595 END IF;
6596
6597 IF p_header_val_rec.tax_point <> FND_API.G_MISS_CHAR
6598 THEN
6599
6600 IF p_x_header_rec.tax_point_code <> FND_API.G_MISS_CHAR THEN
6601
6602
6603 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6604 THEN
6605
6606 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6607 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','tax_point');
6608 OE_MSG_PUB.Add;
6609
6610 END IF;
6611
6612 ELSE
6613
6614 p_x_header_rec.tax_point_code := OE_Value_To_Id.tax_point
6615 ( p_tax_point => p_header_val_rec.tax_point
6616 );
6617
6618 IF p_x_header_rec.tax_point_code = FND_API.G_MISS_CHAR THEN
6619 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6620 END IF;
6621
6622 END IF;
6623
6624 END IF;
6625
6626 IF p_header_val_rec.payment_type <> FND_API.G_MISS_CHAR
6627 THEN
6628
6629 IF p_x_header_rec.payment_type_code <> FND_API.G_MISS_CHAR THEN
6630
6631
6632 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6633 THEN
6634
6635 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6636 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','payment_type');
6637 OE_MSG_PUB.Add;
6638
6639 END IF;
6640
6641 ELSE
6642
6643 p_x_header_rec.payment_type_code := OE_Value_To_Id.payment_type
6644 ( p_payment_type => p_header_val_rec.payment_type
6645 );
6646
6647 IF p_x_header_rec.payment_type_code = FND_API.G_MISS_CHAR THEN
6648 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6649 END IF;
6650
6651 END IF;
6652
6653 END IF;
6654
6655 IF p_header_val_rec.credit_card <> FND_API.G_MISS_CHAR
6656 THEN
6657
6658 IF p_x_header_rec.credit_card_code <> FND_API.G_MISS_CHAR THEN
6659
6660
6661 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6662 THEN
6663
6664 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6665 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','credit_card');
6666 OE_MSG_PUB.Add;
6667
6668 END IF;
6669
6670 ELSE
6671
6672 p_x_header_rec.credit_card_code := OE_Value_To_Id.credit_card
6673 ( p_credit_card => p_header_val_rec.credit_card
6674 );
6675
6676 IF p_x_header_rec.credit_card_code = FND_API.G_MISS_CHAR THEN
6677 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6678 END IF;
6679
6680 END IF;
6681
6682 END IF;
6683
6684
6685 ----------------------------------------------------------------------
6686 -- Retreiving ids for invoice_to_customer
6687 ----------------------------------------------------------------------
6688
6689 oe_debug_pub.add('hdr Invoice_to_cust_id='||p_x_header_rec.invoice_to_customer_id);
6690 IF p_header_val_rec.invoice_to_customer_name_oi <> FND_API.G_MISS_CHAR
6691 OR p_header_val_rec.invoice_to_customer_number_oi <> FND_API.G_MISS_CHAR
6692 THEN
6693
6694 IF p_x_header_rec.invoice_to_customer_id <> FND_API.G_MISS_NUM THEN
6695
6696
6697 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6698 THEN
6699
6700 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6701 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','invoice_to_customer');
6702 OE_MSG_PUB.Add;
6703
6704 END IF;
6705
6706 ELSE
6707 IF p_x_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM then -- 4231603
6708 p_x_header_rec.invoice_to_customer_id:=OE_Value_To_Id.site_customer
6709 ( p_site_customer => p_header_val_rec.invoice_to_customer_name_oi
6710 ,p_site_customer_number=> p_header_val_rec.invoice_to_customer_number_oi
6711 ,p_type =>'INVOICE_TO'
6712 );
6713
6714 IF p_x_header_rec.invoice_to_customer_id = FND_API.G_MISS_NUM THEN
6715 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6716 END IF;
6717 END IF;
6718 END IF;
6719
6720 END IF;
6721
6722 ----------------------------------------------------------------------
6723 -- Retreiving ids for ship_to_customer
6724 ----------------------------------------------------------------------
6725
6726 IF p_header_val_rec.ship_to_customer_name_oi <> FND_API.G_MISS_CHAR
6727 OR p_header_val_rec.ship_to_customer_number_oi <> FND_API.G_MISS_CHAR
6728 THEN
6729
6730 IF p_x_header_rec.ship_to_customer_id <> FND_API.G_MISS_NUM THEN
6731
6732
6733 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6734 THEN
6735
6736 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6737 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ship_to_customer');
6738 OE_MSG_PUB.Add;
6739
6740 END IF;
6741
6742 ELSE
6743 IF p_x_header_rec.ship_to_org_id = FND_API.G_MISS_NUM then -- 4231603
6744 p_x_header_rec.ship_to_customer_id:=OE_Value_To_Id.site_customer
6745 ( p_site_customer => p_header_val_rec.ship_to_customer_name_oi
6746 ,p_site_customer_number=> p_header_val_rec.ship_to_customer_number_oi
6747 ,p_type =>'SHIP_TO'
6748 );
6749
6750 IF p_x_header_rec.ship_to_customer_id = FND_API.G_MISS_NUM THEN
6751 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6752 END IF;
6753 END IF;
6754 END IF;
6755
6756 END IF;
6757
6758
6759 ----------------------------------------------------------------------
6760 -- Retreiving ids for deliver_to_customer
6761 ----------------------------------------------------------------------
6762
6763 IF p_header_val_rec.deliver_to_customer_name_oi <> FND_API.G_MISS_CHAR
6764 OR p_header_val_rec.deliver_to_customer_number_oi <> FND_API.G_MISS_CHAR
6765 THEN
6766
6767 IF p_x_header_rec.deliver_to_customer_id <> FND_API.G_MISS_NUM THEN
6768
6769
6770 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6771 THEN
6772
6773 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6774 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','deliver_to_customer');
6775 OE_MSG_PUB.Add;
6776
6777 END IF;
6778
6779 ELSE
6780 IF p_x_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM then -- 4231603
6781 p_x_header_rec.deliver_to_customer_id:=OE_Value_To_Id.site_customer
6782 ( p_site_customer => p_header_val_rec.ship_to_customer_name_oi
6783 ,p_site_customer_number=> p_header_val_rec.ship_to_customer_number_oi
6784 ,p_type =>'DELIVER_TO'
6785 );
6786
6787 IF p_x_header_rec.deliver_to_customer_id = FND_API.G_MISS_NUM THEN
6788 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6789 END IF;
6790 END IF;
6791 END IF;
6792
6793 END IF;
6794
6795 ----------------------------------------------------------------------
6796 -- For customer related fields, IDs should be retrieved in the
6797 -- following order.
6798 ----------------------------------------------------------------------
6799
6800 IF p_header_val_rec.sold_to_org <> FND_API.G_MISS_CHAR
6801 OR p_header_val_rec.customer_number <> FND_API.G_MISS_CHAR
6802 THEN
6803
6804 IF p_x_header_rec.sold_to_org_id <> FND_API.G_MISS_NUM THEN
6805
6806
6807 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6808 THEN
6809
6810 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6811 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sold_to_org');
6812 OE_MSG_PUB.Add;
6813
6814 END IF;
6815
6816 ELSE
6817
6818 p_x_header_rec.sold_to_org_id := OE_Value_To_Id.sold_to_org
6819 ( p_sold_to_org => p_header_val_rec.sold_to_org
6820 , p_customer_number => p_header_val_rec.customer_number
6821 );
6822
6823 IF p_x_header_rec.sold_to_org_id = FND_API.G_MISS_NUM THEN
6824 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6825 END IF;
6826
6827 END IF;
6828
6829 END IF;
6830
6831 -- Retrieve the sold_to_org_id if not passed on the header record. This
6832 -- will be needed by the value_to_id functions for related fields.
6833 -- For e.g. oe_value_to_id.ship_to_org_id requires sold_to_org_id
6834
6835 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
6836 AND p_x_header_rec.sold_to_org_id = FND_API.G_MISS_NUM
6837 THEN
6838
6839 SELECT SOLD_TO_ORG_ID
6840 INTO l_sold_to_org_id
6841 FROM OE_ORDER_HEADERS
6842 WHERE HEADER_ID = p_x_header_rec.header_id;
6843
6844 ELSE
6845
6846 l_sold_to_org_id := p_x_header_rec.sold_to_org_id;
6847
6848 END IF;
6849
6850 IF p_header_val_rec.sold_to_contact <> FND_API.G_MISS_CHAR
6851 THEN
6852
6853 IF p_x_header_rec.sold_to_contact_id <> FND_API.G_MISS_NUM THEN
6854
6855
6856 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6857 THEN
6858
6859 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6860 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sold_to_contact');
6861 OE_MSG_PUB.Add;
6862
6863 END IF;
6864
6865 ELSE
6866
6867 p_x_header_rec.sold_to_contact_id := OE_Value_To_Id.sold_to_contact
6868 ( p_sold_to_contact => p_header_val_rec.sold_to_contact
6869 , p_sold_to_org_id => l_sold_to_org_id
6870 );
6871
6872 IF p_x_header_rec.sold_to_contact_id = FND_API.G_MISS_NUM THEN
6873 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6874 END IF;
6875
6876 END IF;
6877
6878 END IF;
6879
6880 IF p_header_val_rec.deliver_to_address1 <> FND_API.G_MISS_CHAR
6881 OR p_header_val_rec.deliver_to_address2 <> FND_API.G_MISS_CHAR
6882 OR p_header_val_rec.deliver_to_address3 <> FND_API.G_MISS_CHAR
6883 OR p_header_val_rec.deliver_to_address4 <> FND_API.G_MISS_CHAR
6884 OR p_header_val_rec.deliver_to_location <> FND_API.G_MISS_CHAR
6885 OR p_header_val_rec.deliver_to_org <> FND_API.G_MISS_CHAR
6886 THEN
6887
6888 IF p_x_header_rec.deliver_to_org_id <> FND_API.G_MISS_NUM THEN
6889
6890
6891 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6892 THEN
6893
6894 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6895 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','deliver_to_org');
6896 OE_MSG_PUB.Add;
6897
6898 END IF;
6899
6900 ELSE
6901 /*1621182*/
6902 p_x_header_rec.deliver_to_org_id := OE_Value_To_Id.deliver_to_org
6903 ( p_deliver_to_address1 => p_header_val_rec.deliver_to_address1
6904 , p_deliver_to_address2 => p_header_val_rec.deliver_to_address2
6905 , p_deliver_to_address3 => p_header_val_rec.deliver_to_address3
6906 , p_deliver_to_address4 => p_header_val_rec.deliver_to_address4
6907 , p_deliver_to_location => p_header_val_rec.deliver_to_location
6908 , p_deliver_to_org => p_header_val_rec.deliver_to_org
6909 , p_deliver_to_city => p_header_val_rec.deliver_to_city
6910 , p_deliver_to_state => p_header_val_rec.deliver_to_state
6911 , p_deliver_to_postal_code => p_header_val_rec.deliver_to_zip
6912 , p_deliver_to_country => p_header_val_rec.deliver_to_country
6913 , p_sold_to_org_id => l_sold_to_org_id
6914 , p_deliver_to_customer_id => p_x_header_rec.deliver_to_customer_id
6915 );
6916 /*1621182*/
6917
6918 IF p_x_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM THEN
6919 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6920 END IF;
6921
6922 END IF;
6923
6924 END IF;
6925
6926 IF p_header_val_rec.invoice_to_address1 <> FND_API.G_MISS_CHAR
6927 OR p_header_val_rec.invoice_to_address2 <> FND_API.G_MISS_CHAR
6928 OR p_header_val_rec.invoice_to_address3 <> FND_API.G_MISS_CHAR
6929 OR p_header_val_rec.invoice_to_address4 <> FND_API.G_MISS_CHAR
6930 OR p_header_val_rec.invoice_to_location <> FND_API.G_MISS_CHAR
6931 OR p_header_val_rec.invoice_to_org <> FND_API.G_MISS_CHAR
6932 THEN
6933
6934 IF p_x_header_rec.invoice_to_org_id <> FND_API.G_MISS_NUM THEN
6935
6936
6937 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6938 THEN
6939
6940 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6941 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','invoice_to_org');
6942 OE_MSG_PUB.Add;
6943
6944 END IF;
6945
6946 ELSE
6947 /*1621182*/
6948 p_x_header_rec.invoice_to_org_id := OE_Value_To_Id.invoice_to_org
6949 ( p_invoice_to_address1 => p_header_val_rec.invoice_to_address1
6950 , p_invoice_to_address2 => p_header_val_rec.invoice_to_address2
6951 , p_invoice_to_address3 => p_header_val_rec.invoice_to_address3
6952 , p_invoice_to_address4 => p_header_val_rec.invoice_to_address4
6953 , p_invoice_to_location => p_header_val_rec.invoice_to_location
6954 , p_invoice_to_org => p_header_val_rec.invoice_to_org
6955 , p_invoice_to_city => p_header_val_rec.invoice_to_city
6956 , p_invoice_to_state => p_header_val_rec.invoice_to_state
6957 , p_invoice_to_postal_code => p_header_val_rec.invoice_to_zip
6958 , p_invoice_to_country => p_header_val_rec.invoice_to_country
6959 , p_sold_to_org_id => l_sold_to_org_id
6960 , p_invoice_to_customer_id => p_x_header_rec.invoice_to_customer_id
6961 );
6962 /*1621182*/
6963
6964 IF p_x_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM THEN
6965 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
6966 END IF;
6967
6968 END IF;
6969
6970 END IF;
6971
6972 IF p_header_val_rec.ship_to_address1 <> FND_API.G_MISS_CHAR
6973 OR p_header_val_rec.ship_to_address2 <> FND_API.G_MISS_CHAR
6974 OR p_header_val_rec.ship_to_address3 <> FND_API.G_MISS_CHAR
6975 OR p_header_val_rec.ship_to_address4 <> FND_API.G_MISS_CHAR
6976 OR p_header_val_rec.ship_to_location <> FND_API.G_MISS_CHAR
6977 OR p_header_val_rec.ship_to_org <> FND_API.G_MISS_CHAR
6978 THEN
6979
6980 IF p_x_header_rec.ship_to_org_id <> FND_API.G_MISS_NUM THEN
6981
6982
6983 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
6984 THEN
6985
6986 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
6987 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ship_to_org');
6988 OE_MSG_PUB.Add;
6989
6990 END IF;
6991
6992 ELSE
6993 /*1621182*/
6994 p_x_header_rec.ship_to_org_id := OE_Value_To_Id.ship_to_org
6995 ( p_ship_to_address1 => p_header_val_rec.ship_to_address1
6996 , p_ship_to_address2 => p_header_val_rec.ship_to_address2
6997 , p_ship_to_address3 => p_header_val_rec.ship_to_address3
6998 , p_ship_to_address4 => p_header_val_rec.ship_to_address4
6999 , p_ship_to_location => p_header_val_rec.ship_to_location
7000 , p_ship_to_city => p_header_val_rec.ship_to_city
7001 , p_ship_to_state => p_header_val_rec.ship_to_state
7002 , p_ship_to_postal_code => p_header_val_rec.ship_to_zip
7003 , p_ship_to_country => p_header_val_rec.ship_to_country
7004 , p_ship_to_org => p_header_val_rec.ship_to_org
7005 , p_sold_to_org_id => l_sold_to_org_id
7006 , p_ship_to_customer_id => p_x_header_rec.ship_to_customer_id
7007 );
7008 /*1621182*/
7009
7010 IF p_x_header_rec.ship_to_org_id = FND_API.G_MISS_NUM THEN
7011 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7012 END IF;
7013
7014 END IF;
7015
7016 END IF;
7017
7018 -- QUOTING changes
7019 IF p_header_val_rec.sold_to_location_address1 <> FND_API.G_MISS_CHAR
7020 OR p_header_val_rec.sold_to_location_address2 <> FND_API.G_MISS_CHAR
7021 OR p_header_val_rec.sold_to_location_address3 <> FND_API.G_MISS_CHAR
7022 OR p_header_val_rec.sold_to_location_address4 <> FND_API.G_MISS_CHAR
7023 OR p_header_val_rec.sold_to_location <> FND_API.G_MISS_CHAR
7024 OR p_header_val_rec.sold_to_location <> FND_API.G_MISS_CHAR
7025 THEN
7026
7027 IF p_x_header_rec.sold_to_site_use_id <> FND_API.G_MISS_NUM THEN
7028
7029
7030 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7031 THEN
7032
7033 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7034 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Customer_Location');
7035 OE_MSG_PUB.Add;
7036
7037 END IF;
7038
7039 ELSE
7040 p_x_header_rec.sold_to_site_use_id := OE_Value_To_Id.Customer_Location
7041 ( p_sold_to_location_address1 => p_header_val_rec.sold_to_location_address1
7042 , p_sold_to_location_address2 => p_header_val_rec.sold_to_location_address2
7043 , p_sold_to_location_address3 => p_header_val_rec.sold_to_location_address3
7044 , p_sold_to_location_address4 => p_header_val_rec.sold_to_location_address4
7045 , p_sold_to_location => p_header_val_rec.sold_to_location
7046 , p_sold_to_org_id => l_sold_to_org_id
7047 , p_sold_to_location_city => p_header_val_rec.sold_to_location_city
7048 , p_sold_to_location_state => p_header_val_rec.sold_to_location_state
7049 , p_sold_to_location_postal_code => p_header_val_rec.sold_to_location_postal
7050 , p_sold_to_location_country => p_header_val_rec.sold_to_location_country
7051 );
7052
7053
7054 oe_debug_pub.add('after hdr sold_to_site_use_id='||p_x_header_rec.sold_to_site_use_id);
7055
7056 IF p_x_header_rec.sold_to_site_use_id = FND_API.G_MISS_NUM THEN
7057 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7058 END IF;
7059
7060 END IF;
7061
7062 END IF;
7063 -- QUOTING changes
7064
7065 -- Retrieve the org_ids if not passed on the header record. These
7066 -- IDs will be needed by the value_to_id functions for CONTACT fields.
7067 -- For e.g. oe_value_to_id.ship_to_contact_id requires ship_to_org_id
7068
7069 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
7070 AND ( p_x_header_rec.ship_to_org_id = FND_API.G_MISS_NUM
7071 OR p_x_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM
7072 OR p_x_header_rec.deliver_to_org_id = FND_API.G_MISS_NUM )
7073 THEN
7074
7075 SELECT SHIP_TO_ORG_ID, INVOICE_TO_ORG_ID, DELIVER_TO_ORG_ID
7076 INTO l_sold_to_org_id, l_invoice_to_org_id, l_deliver_to_org_id
7077 FROM OE_ORDER_HEADERS
7078 WHERE HEADER_ID = p_x_header_rec.header_id;
7079
7080 IF p_x_header_rec.ship_to_org_id <> FND_API.G_MISS_NUM THEN
7081 l_ship_to_org_id := p_x_header_rec.ship_to_org_id;
7082 END IF;
7083
7084 IF p_x_header_rec.invoice_to_org_id <> FND_API.G_MISS_NUM THEN
7085 l_invoice_to_org_id := p_x_header_rec.invoice_to_org_id;
7086 END IF;
7087
7088 IF p_x_header_rec.deliver_to_org_id <> FND_API.G_MISS_NUM THEN
7089 l_deliver_to_org_id := p_x_header_rec.deliver_to_org_id;
7090 END IF;
7091
7092 ELSE
7093
7094 l_sold_to_org_id := p_x_header_rec.sold_to_org_id;
7095 l_invoice_to_org_id := p_x_header_rec.invoice_to_org_id;
7096 l_deliver_to_org_id := p_x_header_rec.deliver_to_org_id;
7097
7098 END IF;
7099
7100 IF p_header_val_rec.deliver_to_contact <> FND_API.G_MISS_CHAR
7101 THEN
7102
7103 IF p_x_header_rec.deliver_to_contact_id <> FND_API.G_MISS_NUM THEN
7104
7105
7106 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7107 THEN
7108
7109 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7110 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','deliver_to_contact');
7111 OE_MSG_PUB.Add;
7112
7113 END IF;
7114
7115 ELSE
7116
7117 p_x_header_rec.deliver_to_contact_id := OE_Value_To_Id.deliver_to_contact
7118 ( p_deliver_to_contact => p_header_val_rec.deliver_to_contact
7119 , p_deliver_to_org_id => l_deliver_to_org_id
7120 );
7121
7122 IF p_x_header_rec.deliver_to_contact_id = FND_API.G_MISS_NUM THEN
7123 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7124 END IF;
7125
7126 END IF;
7127
7128 END IF;
7129
7130 IF p_header_val_rec.invoice_to_contact <> FND_API.G_MISS_CHAR
7131 THEN
7132
7133 IF p_x_header_rec.invoice_to_contact_id <> FND_API.G_MISS_NUM THEN
7134
7135
7136 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7137 THEN
7138
7139 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7140 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','invoice_to_contact');
7141 OE_MSG_PUB.Add;
7142
7143 END IF;
7144
7145 ELSE
7146
7147 p_x_header_rec.invoice_to_contact_id := OE_Value_To_Id.invoice_to_contact
7148 ( p_invoice_to_contact => p_header_val_rec.invoice_to_contact
7149 , p_invoice_to_org_id => l_invoice_to_org_id
7150 );
7151
7152 IF p_x_header_rec.invoice_to_contact_id = FND_API.G_MISS_NUM THEN
7153 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7154 END IF;
7155
7156 END IF;
7157
7158 END IF;
7159
7160 IF p_header_val_rec.ship_to_contact <> FND_API.G_MISS_CHAR
7161 THEN
7162
7163 IF p_x_header_rec.ship_to_contact_id <> FND_API.G_MISS_NUM THEN
7164
7165
7166 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7167 THEN
7168
7169 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7170 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ship_to_contact');
7171 OE_MSG_PUB.Add;
7172
7173 END IF;
7174
7175 ELSE
7176
7177 p_x_header_rec.ship_to_contact_id := OE_Value_To_Id.ship_to_contact
7178 ( p_ship_to_contact => p_header_val_rec.ship_to_contact
7179 , p_ship_to_org_id => l_ship_to_org_id
7180 );
7181
7182 IF p_x_header_rec.ship_to_contact_id = FND_API.G_MISS_NUM THEN
7183 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7184 END IF;
7185
7186 END IF;
7187
7188 END IF;
7189
7190 /* mvijayku */
7191 IF p_header_val_rec.end_customer_name <> FND_API.G_MISS_CHAR
7192 OR p_header_val_rec.end_customer_number <> FND_API.G_MISS_CHAR
7193 THEN
7194
7195 IF p_x_header_rec.end_customer_id <> FND_API.G_MISS_NUM THEN
7196
7197
7198 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7199 THEN
7200
7201 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7202 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','end_customer');
7203 OE_MSG_PUB.Add;
7204
7205 END IF;
7206
7207 ELSE
7208 IF p_x_header_rec.end_customer_site_use_id = FND_API.G_MISS_NUM THEN -- 4231603
7209 p_x_header_rec.end_customer_id:=OE_Value_To_Id.end_customer
7210 ( p_end_customer => p_header_val_rec.end_customer_name
7211 ,p_end_customer_number=> p_header_val_rec.end_customer_number
7212 );
7213
7214 IF p_x_header_rec.end_customer_id = FND_API.G_MISS_NUM THEN
7215 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7216 END IF;
7217 END IF;
7218 END IF;
7219
7220 END IF;
7221
7222 IF p_header_val_rec.end_customer_contact <> FND_API.G_MISS_CHAR
7223 THEN
7224
7225 IF p_x_header_rec.end_customer_id <>FND_API.G_MISS_NUM and
7226 p_x_header_rec.end_customer_contact_id <> FND_API.G_MISS_NUM THEN
7227
7228
7229 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7230 THEN
7231
7232 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7233 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','end_customer__contact');
7234 OE_MSG_PUB.Add;
7235
7236 END IF;
7237
7238 ELSE
7239 oe_debug_pub.add('before calling aend customer contact value to id');
7240 p_x_header_rec.end_customer_contact_id := OE_Value_To_Id.end_customer_contact
7241 ( p_end_customer_contact => p_header_val_rec.end_customer_contact
7242 ,p_end_customer_id =>p_x_header_rec.end_customer_id
7243 );
7244 oe_debug_pub.add('End customer contact id is '||p_x_header_rec.end_customer_contact_id);
7245
7246 IF p_x_header_rec.end_customer_contact_id = FND_API.G_MISS_NUM THEN
7247 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7248 END IF;
7249
7250 END IF;
7251
7252 END IF;
7253
7254 IF (p_header_val_rec.end_customer_name <> FND_API.G_MISS_CHAR
7255 OR p_header_val_rec.end_customer_number <> FND_API.G_MISS_CHAR
7256 OR p_x_header_rec.end_customer_id <> FND_API.G_MISS_NUM)
7257 AND
7258 (p_header_val_rec.end_customer_site_address1 <> FND_API.G_MISS_CHAR
7259 OR p_header_val_rec.end_customer_site_address2 <> FND_API.G_MISS_CHAR
7260 OR p_header_val_rec.end_customer_site_address3 <> FND_API.G_MISS_CHAR
7261 OR p_header_val_rec.end_customer_site_address4 <> FND_API.G_MISS_CHAR
7262 OR p_header_val_rec.end_customer_site_location <> FND_API.G_MISS_CHAR)
7263
7264 THEN
7265
7266 IF p_x_header_rec.end_customer_site_use_id <> FND_API.G_MISS_NUM THEN
7267
7268
7269 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7270 THEN
7271
7272 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7273 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','end_Customer_Location');
7274 OE_MSG_PUB.Add;
7275
7276 END IF;
7277
7278 ELSE
7279 oe_debug_pub.add('Before calling End custoemr site use value to id');
7280 p_x_header_rec.end_customer_site_use_id := OE_Value_To_Id.end_customer_site
7281 ( p_end_customer_site_address1 => p_header_val_rec.end_customer_site_address1
7282 , p_end_customer_site_address2 => p_header_val_rec.end_customer_site_address2
7283 , p_end_customer_site_address3 => p_header_val_rec.end_customer_site_address3
7284 , p_end_customer_site_address4 => p_header_val_rec.end_customer_site_address4
7285 , p_end_customer_site_location => p_header_val_rec.end_customer_site_location
7286 , p_end_customer_site_org => NULL
7287 , p_end_customer_id => p_x_header_rec.end_customer_id
7288 , p_end_customer_site_city => p_header_val_rec.end_customer_site_city
7289 , p_end_customer_site_state => p_header_val_rec.end_customer_site_state
7290 , p_end_customer_site_postalcode => p_header_val_rec.end_customer_site_postal_code
7291 , p_end_customer_site_country => p_header_val_rec.end_customer_site_country
7292 , p_end_customer_site_use_code => NULL
7293 );
7294
7295
7296 oe_debug_pub.add('after hdr sold_to_site_use_id='||p_x_header_rec.end_customer_site_use_id);
7297
7298 IF p_x_header_rec.end_customer_site_use_id = FND_API.G_MISS_NUM THEN
7299 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7300 END IF;
7301
7302 END IF;
7303
7304 END IF;
7305
7306 -- {added for bug 4240715
7307 IF p_header_val_rec.ib_owner_dsp <> FND_API.G_MISS_CHAR
7308 THEN
7309
7310 IF p_x_header_rec.ib_owner <> FND_API.G_MISS_CHAR THEN
7311
7312 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7313 THEN
7314
7315 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7316 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','IB_Owner');
7317 OE_MSG_PUB.Add;
7318
7319 END IF;
7320
7321 ELSE
7322
7323 p_x_header_rec.ib_owner:=OE_Value_To_Id.ib_owner
7324 ( p_ib_owner => p_header_val_rec.ib_owner_dsp
7325 );
7326
7327 oe_Debug_pub.add('ib owner id is '||p_x_header_rec.ib_owner);
7328 IF p_x_header_rec.ib_owner = FND_API.G_MISS_CHAR THEN
7329 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7330 END IF;
7331
7332 END IF;
7333
7334 END IF;
7335
7336 IF p_header_val_rec.ib_installed_at_location_dsp <> FND_API.G_MISS_CHAR
7337 THEN
7338
7339 IF p_x_header_rec.ib_installed_at_location <> FND_API.G_MISS_CHAR THEN
7340
7341 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7342 THEN
7343
7344 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7345 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','IB_Installed_at_location');
7346 OE_MSG_PUB.Add;
7347
7348 END IF;
7349
7350 ELSE
7351
7352 p_x_header_rec.ib_installed_at_location:=OE_Value_To_Id.ib_installed_at_location
7353 ( p_ib_installed_at_location => p_header_val_rec.ib_installed_at_location_dsp
7354 );
7355 oe_Debug_pub.add('installed at location'||p_x_header_rec.ib_installed_at_location);
7356
7357 IF p_x_header_rec.ib_installed_at_location = FND_API.G_MISS_CHAR THEN
7358 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7359 END IF;
7360
7361 END IF;
7362
7363 END IF;
7364
7365 IF p_header_val_rec.ib_current_location_dsp <> FND_API.G_MISS_CHAR
7366 THEN
7367 IF p_x_header_rec.ib_current_location <> FND_API.G_MISS_CHAR THEN
7368
7369 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
7370 THEN
7371
7372 fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
7373 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','IB_current_location');
7374 OE_MSG_PUB.Add;
7375
7376 END IF;
7377
7378 ELSE
7379
7380 p_x_header_rec.ib_current_location:=OE_Value_To_Id.ib_current_location
7381 ( p_ib_current_location => p_header_val_rec.ib_current_location_dsp
7382 );
7383
7384 IF p_x_header_rec.ib_current_location = FND_API.G_MISS_CHAR THEN
7385 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
7386 END IF;
7387
7388 END IF;
7389
7390 END IF;
7391
7392 --bug 4240715}
7393
7394 ----------------------------------------------------------------------
7395 -- End of get IDs for customer related fields
7396 ----------------------------------------------------------------------
7397
7398 oe_debug_pub.add('Exiting OE_HEADER_UTIL.GET_IDS', 1);
7399
7400 END Get_Ids;
7401
7402
7403 FUNCTION Get_ord_seq_type
7404 ( p_order_type_id IN NUMBER
7405 , p_transaction_phase_code IN VARCHAR2 DEFAULT 'F'
7406 ) RETURN VARCHAR2 IS
7407 x_doc_sequence_value NUMBER;
7408 x_doc_category_code VARCHAR(30);
7409 X_doc_sequence_id NUMBER;
7410 X_set_Of_Books_id NUMBER;
7411 seqassid INTEGER;
7412 x_Trx_Date DATE;
7413 l_set_of_books_rec OE_Order_Cache.Set_Of_Books_Rec_Type;
7414 l_dummy VARCHAR2(10);
7415 t VARCHAR2(1);
7416 X_db_sequence_name VARCHAR2(50);
7417 x_doc_sequence_type CHAR(1);
7418 X_doc_sequence_name VARCHAR2(240);
7419 X_Prd_Tbl_Name VARCHAR2(240) ;
7420 X_Aud_Tbl_Name VARCHAR2(240);
7421 X_Msg_Flag VARCHAR2(240);
7422 x_result NUMBER;
7423
7424 BEGIN
7425
7426 oe_debug_pub.add('Entering OE_HEADER_UTIL.Get_Ord_Seq_Type',1);
7427
7428 IF p_order_type_id IS NULL OR
7429 p_order_type_id = FND_API.G_MISS_NUM
7430 THEN
7431 OE_MSG_PUB.Update_Msg_Context(p_attribute_code => null);
7432 RETURN NULL;
7433 END IF;
7434
7435 l_set_of_books_rec :=
7436 OE_Order_Cache.Load_Set_Of_Books;
7437
7438 x_Set_Of_Books_Id := l_set_of_books_rec.set_of_books_id;
7439
7440 -- X_Doc_Category_Code := to_char(p_order_type_id);
7441
7442 -- QUOTING changes
7443 IF nvl(p_transaction_phase_code,'F') = 'F' THEN
7444 X_Doc_Category_Code := to_char(p_order_type_id);
7445 ELSIF p_transaction_phase_code = 'N' THEN
7446 X_Doc_Category_Code := to_char(p_order_type_id)||'-Quote';
7447 END IF;
7448
7449 x_result := fnd_seqnum.get_seq_info(
7450 660,
7451 x_doc_category_code,
7452 x_set_of_books_id,
7453 null,
7454 sysdate,
7455 X_doc_sequence_id,
7456 x_doc_sequence_type,
7457 x_doc_sequence_name,
7458 X_db_sequence_name,
7459 seqassid,
7460 X_Prd_Tbl_Name,
7461 X_Aud_Tbl_Name,
7462 X_Msg_Flag
7463 );
7464 IF x_result <> 0 THEN
7465 RAISE FND_API.G_EXC_ERROR;
7466 END IF;
7467
7468 oe_debug_pub.add('Exiting OE_HEADER_UTIL.Get_Ord_Seq_Type',1);
7469
7470 RETURN x_doc_sequence_type;
7471
7472 EXCEPTION
7473
7474 WHEN OTHERS THEN
7475 RETURN NULL;
7476
7477 END Get_ord_seq_type ;
7478
7479 FUNCTION Get_Mtl_Sales_Order_Id(p_header_id IN NUMBER
7480 ,p_order_number IN NUMBER := FND_API.G_MISS_NUM)
7481 RETURN NUMBER
7482 IS
7483 BEGIN
7484 return inv_salesorder.get_salesorder_for_oeheader
7485 (p_oe_header_id => p_header_id);
7486 END Get_Mtl_Sales_Order_Id;
7487
7488 PROCEDURE Get_Order_Info(p_header_id IN NUMBER,
7489 x_order_number OUT NOCOPY /* file.sql.39 change */ NUMBER,
7490 x_order_type OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
7491 x_order_source OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
7492 IS
7493 l_order_number NUMBER;
7494 l_order_type_id NUMBER := 0;
7495 BEGIN
7496
7497 --Commenting the oe_debug_pub call to fix bug 2105266.
7498
7499 -- oe_debug_pub.add('Entering OE_HEADER_UTIL.Get_Order_Info',1);
7500
7501 BEGIN
7502 SELECT order_number,order_type_id
7503 INTO l_order_number,l_order_type_id
7504 FROM oe_order_headers_all
7505 WHERE header_id = p_header_id;
7506
7507 x_order_source := FND_PROFILE.VALUE('ONT_SOURCE_CODE');
7508 x_order_number := l_order_number;
7509 EXCEPTION
7510 WHEN NO_DATA_FOUND THEN
7511 x_order_number := NULL;
7512 END;
7513
7514 BEGIN
7515 -- Fix for bug#1078323: the order type name should be selected in
7516 -- the base language
7517 SELECT name
7518 INTO x_order_type
7519 FROM OE_TRANSACTION_TYPES_TL
7520 WHERE TRANSACTION_TYPE_ID = l_order_type_id
7521 AND language = (select language_code from
7522 fnd_languages
7523 where installed_flag = 'B');
7524 EXCEPTION
7525 WHEN NO_DATA_FOUND THEN
7526 x_order_type := NULL;
7527 END;
7528
7529 -- oe_debug_pub.add('Exiting OE_HEADER_UTIL.Get_Order_Info',1);
7530
7531 END Get_Order_Info;
7532
7533 FUNCTION Get_Header_Id (p_order_number IN NUMBER,
7534 p_order_type IN VARCHAR2,
7535 p_order_source IN VARCHAR2)
7536 RETURN NUMBER
7537 IS
7538 l_order_type_id NUMBER;
7539 l_order_type VARCHAR2(240);
7540 l_header_id NUMBER;
7541 BEGIN
7542
7543 Select header_id
7544 into l_header_id
7545 from oe_order_headers
7546 where order_number = p_order_number AND
7547 order_type_id = (select tl.transaction_type_id
7548 from oe_transaction_types_tl tl,
7549 oe_transaction_types_all ta
7550 where ta.transaction_type_id =
7551 tl.transaction_type_id and
7552 tl.name = p_order_type and
7553 ta.transaction_type_code = 'ORDER'
7554 and LANGUAGE = (
7555 select language_code
7556 from fnd_languages
7557 where installed_flag = 'B'));
7558
7559 RETURN l_header_id;
7560
7561 EXCEPTION
7562 WHEN NO_DATA_FOUND THEN
7563 RETURN -1;
7564 WHEN OTHERS THEN
7565 RETURN -1;
7566
7567 END Get_Header_Id;
7568
7569 FUNCTION Get_Order_Type
7570 ( p_order_type_id IN NUMBER)
7571 RETURN VARCHAR2
7572 IS
7573 l_order_type_id NUMBER;
7574 l_order_type VARCHAR2(240);
7575 BEGIN
7576
7577 oe_debug_pub.add('Entering OR_HEADER_UTIL.Get_Order_Type',1);
7578
7579 Select name
7580 into l_order_type
7581 from oe_order_types_v
7582 where transaction_type_id = p_order_type_id;
7583
7584 oe_debug_pub.add('Exiting OR_HEADER_UTIL.Get_Order_Type',1);
7585
7586 RETURN l_order_type;
7587
7588 EXCEPTION
7589 WHEN NO_DATA_FOUND THEN
7590 RETURN null;
7591 WHEN OTHERS THEN
7592 RETURN null;
7593
7594 END Get_Order_Type;
7595
7596 PROCEDURE Get_Order_Number
7597 ( p_x_header_rec IN OUT NOCOPY oe_order_pub.header_rec_type,
7598 p_old_header_rec IN oe_order_pub.header_rec_type )
7599 IS
7600 l_order_number VARCHAR2(30):= NULL;
7601 x_doc_sequence_value NUMBER;
7602 x_doc_category_code VARCHAR(30);
7603 X_doc_sequence_id NUMBER;
7604 X_db_sequence_name VARCHAR2(50);
7605 x_doc_sequence_type CHAR(1);
7606 X_doc_sequence_name VARCHAR2(240);
7607 X_Prd_Tbl_Name VARCHAR2(240) ;
7608 X_Aud_Tbl_Name VARCHAR2(240);
7609 X_Msg_Flag VARCHAR2(240);
7610 X_set_Of_Books_id NUMBER;
7611 seqassid INTEGER;
7612 l_ord_num_src_id NUMBER := NULL;
7613 l_order_type_rec OE_Order_Cache.Order_Type_Rec_Type;
7614 l_set_of_books_rec OE_Order_Cache.Set_Of_Books_Rec_Type;
7615 l_order_number_csr INTEGER;
7616 l_result INTEGER;
7617 l_select_stmt VARCHAR2(240);
7618 l_column_name VARCHAR2(80);
7619 l_doc_seq_type VARCHAR2(240);
7620 l_return_status VARCHAR2(30);
7621 X_trx_date DATE;
7622 lcount NUMBER;
7623 x_result NUMBER;
7624
7625 BEGIN
7626 oe_debug_pub.add('Entering OE_HEADER_UTIL.Get_Order_Number',1);
7627 oe_debug_pub.add('Entering OE_HEADER_UTIL.Get_Order_Number',1);
7628 -- Check if Order Number can be updated or not???? bug 4146258
7629 -- Fixed by Srini
7630 IF NOT OE_GLOBALS.EQUAL(p_x_header_rec.order_number,
7631 p_old_header_rec.order_number)
7632 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
7633 AND p_old_header_rec.order_number is not null
7634 AND p_old_header_rec.order_number <> FND_API.G_MISS_NUM
7635 THEN
7636 if p_x_header_rec.booked_flag = 'Y' and
7637 nvl(p_x_header_rec.open_flag,'Y') = 'Y' then
7638 FND_MESSAGE.SET_NAME('ONT','ONT_INVALID_ORD_NUM_BOOKING');
7639 OE_MSG_PUB.Add;
7640 RAISE FND_API.G_EXC_ERROR;
7641 end if;
7642 l_set_of_books_rec := OE_Order_Cache.Load_Set_Of_Books;
7643 x_Set_Of_Books_Id := l_set_of_books_rec.set_of_books_id;
7644 l_order_type_rec := OE_Order_Cache.Load_Order_Type (p_x_header_rec.order_type_id);
7645 oe_debug_pub.add('When Order Number has been changed :'||p_x_header_rec.transaction_phase_code);
7646 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
7647 X_Doc_Category_Code := to_char(p_x_header_rec.order_type_id);
7648 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
7649 X_Doc_Category_Code := to_char(p_x_header_rec.order_type_id)||'-Quote';
7650 END IF;
7651 x_result := fnd_seqnum.get_seq_info(
7652 660,
7653 x_doc_category_code,
7654 x_set_of_books_id,
7655 null,
7656 sysdate,
7657 X_doc_sequence_id,
7658 x_doc_sequence_type,
7659 x_doc_sequence_name,
7660 X_db_sequence_name,
7661 seqassid,
7662 X_Prd_Tbl_Name,
7663 X_Aud_Tbl_Name,
7664 X_Msg_Flag);
7665
7666 if p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE and
7667 x_doc_sequence_type = 'A'
7668 then
7669 FND_MESSAGE.SET_NAME('ONT','ONT_ORD_NUM_MISMATCH');
7670 OE_MSG_PUB.Add;
7671 RAISE FND_API.G_EXC_ERROR;
7672 end if;
7673
7674 END IF;
7675
7676 -- QUOTING changes
7677 IF NOT OE_GLOBALS.EQUAL(p_x_header_rec.order_type_id,
7678 p_old_header_rec.order_type_id)
7679 OR (OE_Quote_Util.G_COMPLETE_NEG = 'Y'
7680 AND NOT OE_GLOBALS.EQUAL(p_x_header_rec.transaction_phase_code,
7681 p_old_header_rec.transaction_phase_code)
7682 )
7683 THEN
7684
7685 oe_debug_pub.ADD('Ordertype is :' || to_char(p_x_header_rec.order_type_id),3);
7686
7687 l_set_of_books_rec := OE_Order_Cache.Load_Set_Of_Books;
7688 x_Set_Of_Books_Id := l_set_of_books_rec.set_of_books_id;
7689
7690 IF p_x_header_rec.order_type_id IS NOT NULL AND
7691 p_x_header_rec.order_type_id <> FND_API.G_MISS_NUM
7692 THEN
7693
7694 l_order_type_rec := OE_Order_Cache.Load_Order_Type (p_x_header_rec.order_type_id);
7695
7696 oe_debug_pub.add('transaction phase :'||p_x_header_rec.transaction_phase_code);
7697 -- Quoting Changes
7698 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
7699 X_Doc_Category_Code := to_char(p_x_header_rec.order_type_id);
7700 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
7701 X_Doc_Category_Code := to_char(p_x_header_rec.order_type_id)||'-Quote';
7702 END IF;
7703 ELSE
7704 RAISE FND_API.G_EXC_ERROR ;
7705 END IF;
7706
7707 -- QUOTING changes
7708 IF OE_Quote_Util.G_COMPLETE_NEG = 'Y'
7709 AND nvl(l_order_type_rec.quote_num_as_ord_num_flag,'Y') = 'Y' --added nvl for bug4474915
7710 THEN
7711 oe_debug_pub.ADD('retain document number is Yes');
7712 GOTO End_Of_Procedure;
7713 END IF;
7714
7715 oe_debug_pub.ADD('before calling get_seq_info ', 2);
7716 oe_debug_pub.ADD('Category Code'||x_doc_category_code, 3);
7717 oe_debug_pub.ADD('Set of Books'||x_set_of_books_id, 3);
7718 x_result := fnd_seqnum.get_seq_info(
7719 660,
7720 x_doc_category_code,
7721 x_set_of_books_id,
7722 null,
7723 sysdate,
7724 X_doc_sequence_id,
7725 x_doc_sequence_type,
7726 x_doc_sequence_name,
7727 X_db_sequence_name,
7728 seqassid,
7729 X_Prd_Tbl_Name,
7730 X_Aud_Tbl_Name,
7731 X_Msg_Flag
7732 );
7733
7734 oe_debug_pub.ADD('after calling get_seq_info ', 2);
7735
7736 IF x_result <> FND_SEQNUM.SEQSUCC THEN
7737 IF x_result = FND_SEQNUM.NOTUSED THEN
7738 fnd_message.set_name('ONT','OE_MISS_DOC_SEQ');
7739 OE_MSG_PUB.Add;
7740 RAISE FND_API.G_EXC_ERROR;
7741 END IF;
7742 END IF;
7743 l_doc_seq_type := x_doc_sequence_type;
7744
7745 IF ( l_doc_seq_type <> 'M') THEN
7746
7747 X_result := fnd_seqnum.get_seq_val(
7748 660,
7749 x_doc_category_code,
7750 x_set_of_books_id,
7751 null,
7752 sysdate,
7753 x_doc_sequence_value,
7754 X_doc_sequence_id,
7755 'Y',
7756 'Y');
7757 IF x_result <> 0 THEN
7758 RAISE FND_API.G_EXC_ERROR;
7759 END IF;
7760
7761 oe_debug_pub.ADD('fndseqresult'||to_char(x_result), 2);
7762 oe_debug_pub.ADD('fndseqtype'||x_doc_sequence_value, 2);
7763
7764 -- Quoting Changes
7765 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
7766 p_x_header_rec.order_number := x_doc_sequence_value;
7767 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
7768 p_x_header_rec.quote_number := x_doc_sequence_value;
7769 p_x_header_rec.order_number := x_doc_sequence_value;
7770 END IF;
7771
7772
7773 ELSIF (l_doc_seq_type = 'M') THEN
7774 oe_debug_pub.add('manual sequence');
7775
7776 -- Quoting Changes
7777 -- Fix for bug 3204076
7778 -- Raise error if manual sequence and quote/order number is
7779 -- not provided.
7780 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
7781 IF p_x_header_rec.order_number IS NULL THEN
7782 fnd_message.set_name('ONT','OE_ATTRIBUTE_REQUIRED');
7783 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
7784 OE_Order_UTIL.Get_Attribute_Name('ORDER_NUMBER'));
7785 OE_MSG_PUB.Add;
7786 RAISE FND_API.G_EXC_ERROR;
7787 ELSE
7788 x_doc_sequence_value := p_x_header_rec.order_number;
7789 END IF;
7790 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
7791 IF p_x_header_rec.quote_number IS NULL THEN
7792 fnd_message.set_name('ONT','OE_ATTRIBUTE_REQUIRED');
7793 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
7794 OE_Order_UTIL.Get_Attribute_Name('QUOTE_NUMBER'));
7795 OE_MSG_PUB.Add;
7796 RAISE FND_API.G_EXC_ERROR;
7797 ELSE
7798 x_doc_sequence_value := p_x_header_rec.quote_number;
7799 p_x_header_rec.order_number := x_doc_sequence_value;
7800 END IF;
7801 END IF;
7802
7803 END IF;
7804
7805 -- QUOTING changes - unique key checks and set WF user keys
7806 -- based on transaction phase
7807 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
7808
7809 Select Count(Header_id) into
7810 lcount
7811 From OE_ORDER_HEADERS_ALL
7812 WHERE order_type_id = p_x_header_rec.order_type_id
7813 and order_number = p_x_header_rec.order_number
7814 -- We need to remove the check condition around the version number.
7815 --Bug #3357896.
7816 --and version_number = p_x_header_rec.version_number
7817 and header_id <> p_x_header_rec.header_id;
7818
7819 IF lcount > 0 THEN
7820 fnd_message.set_name('ONT','OE_ORDER_NUM_EXISTS');
7821 OE_MSG_PUB.Add;
7822 RAISE FND_API.G_EXC_ERROR;
7823 END IF;
7824
7825 -- Fix for bug# 3526149. Also see bug 3485680
7826 oe_debug_pub.add('p_old_header_rec.order_number:' || p_old_header_rec.order_number,1);
7827 oe_debug_pub.add('p_old_header_rec.transaction_phase_code:' ||
7828 p_old_header_rec.transaction_phase_code,1);
7829 IF (p_x_header_rec.order_number <> p_old_header_rec.order_number AND
7830 p_old_header_rec.order_number is not null AND
7831 p_old_header_rec.order_number <> FND_API.G_MISS_NUM) AND
7832 OE_Quote_Util.G_COMPLETE_NEG = 'N' THEN
7833 oe_debug_pub.add('Ord_Num Changed, Calling Set_Header_User_Key and WF_ENGINE.SetItemUserKey',1);
7834 OE_Order_WF_Util.Set_Header_User_Key(p_x_header_rec);
7835 WF_ENGINE.SetItemUserKey(OE_Globals.G_WFI_HDR, to_char(p_x_header_rec.header_id),
7836 substrb(fnd_message.get, 1, 240));
7837
7838 WF_ENGINE.SetItemAttrNumber(OE_Globals.G_WFI_HDR, to_char(p_x_header_rec.header_id),
7839 'ORDER_NUMBER', p_x_header_rec.order_number); -- Bug 3589688
7840 END IF;
7841
7842 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
7843
7844 Select Count(Header_id) into
7845 lcount
7846 From OE_ORDER_HEADERS_ALL
7847 WHERE order_type_id = p_x_header_rec.order_type_id
7848 and quote_number = p_x_header_rec.quote_number
7849 -- We need to remove the check condition around the version number.
7850 --Bug #3357896.
7851 --and version_number = p_x_header_rec.version_number
7852 and header_id <> p_x_header_rec.header_id;
7853
7854 IF lcount > 0 THEN
7855 fnd_message.set_name('ONT','OE_QUOTE_NUM_EXISTS');
7856 OE_MSG_PUB.Add;
7857 RAISE FND_API.G_EXC_ERROR;
7858 END IF;
7859
7860 -- Fix for bug# 3526149. Also see bug 3485680
7861 oe_debug_pub.add('p_old_header_rec.quote_number:' || p_old_header_rec.quote_number,1);
7862 IF (p_x_header_rec.quote_number <> p_old_header_rec.quote_number AND
7863 p_old_header_rec.quote_number is not null AND
7864 p_old_header_rec.quote_number <> FND_API.G_MISS_NUM) THEN
7865 oe_debug_pub.add('Calling OE_Order_WF_Util.Set_Negotiate_Hdr_User_Key for HeaderID:'
7866 || to_char(p_x_header_rec.header_id), 1);
7867 OE_Order_WF_Util.Set_Negotiate_Hdr_User_Key
7868 (p_header_id => p_x_header_rec.header_id
7869 ,p_sales_document_type_code => 'O'
7870 ,p_transaction_number => p_x_header_rec.quote_number
7871 );
7872 WF_ENGINE.SetItemAttrNumber(OE_GLOBALS.G_WFI_NGO, to_char(p_x_header_rec.header_id),
7873 'TRANSACTION_NUMBER', p_x_header_rec.quote_number); -- Bug 3589688
7874 END IF;
7875
7876
7877 END IF; -- end if transaction phase check
7878
7879 END IF; -- Global equal
7880
7881 <<End_Of_Procedure>>
7882
7883 oe_debug_pub.add('Exiting OR_HEADER_UTIL.Get_Order_Number',1);
7884
7885 EXCEPTION
7886 WHEN FND_API.G_EXC_ERROR THEN
7887 oe_debug_pub.ADD('Get Order Number-Exp exception ', 1);
7888 RAISE FND_API.G_EXC_ERROR;
7889
7890
7891 WHEN OTHERS THEN
7892 oe_debug_pub.ADD('Get Order Number-exception ', 1);
7893
7894
7895 IF OE_MSG_PUB.Check_Msg_Level (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
7896 THEN
7897 OE_MSG_PUB.Add_Exc_Msg
7898 ( G_PKG_NAME ,
7899 'Get_Order_Number'
7900 );
7901 END IF;
7902
7903 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7904
7905 END Get_Order_Number;
7906
7907 FUNCTION Get_Base_Order_Type
7908 ( p_order_type_id IN NUMBER)
7909 RETURN VARCHAR2
7910 IS
7911 l_order_type_id NUMBER;
7912 l_order_type VARCHAR2(240);
7913 --
7914 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7915 --
7916 BEGIN
7917 IF l_debug_level > 0 THEN
7918 oe_debug_pub.add('Entering OR_HEADER_UTIL.Get_Base_Order_Type ' || p_order_type_id,1);
7919 END IF;
7920
7921 SELECT NAME
7922 INTO l_order_type
7923 FROM OE_TRANSACTION_TYPES_TL
7924 WHERE TRANSACTION_TYPE_ID = p_order_type_id
7925 AND language = (select language_code
7926 from fnd_languages
7927 where installed_flag = 'B');
7928
7929 IF l_debug_level > 0 THEN
7930 oe_debug_pub.add('Exiting OR_HEADER_UTIL.Get_Base_Order_Type ' || l_order_type,1);
7931 END IF;
7932
7933 RETURN l_order_type;
7934
7935 EXCEPTION
7936 WHEN NO_DATA_FOUND THEN
7937 RETURN null;
7938 WHEN OTHERS THEN
7939 RETURN null;
7940
7941 END Get_Base_Order_Type;
7942
7943 PROCEDURE Pre_Write_Process
7944 ( p_x_header_rec IN OUT NOCOPY oe_order_pub.header_rec_type,
7945 p_old_header_rec IN oe_order_pub.header_rec_type )
7946 IS
7947 -- included to fix bug 1589196 Begin
7948 CURSOR C_HSC_COUNT(t_header_id Number) IS
7949 SELECT count(sales_credit_id), max(sales_credit_id)
7950 FROM oe_sales_credits sc,
7951 oe_sales_credit_types sct
7952 WHERE header_id = t_header_id
7953 AND sct.sales_credit_type_id = sc.sales_credit_type_id
7954 AND sct.quota_flag = 'Y'
7955 AND line_id is null;
7956 -- included to fix bug 1589196 End
7957
7958 l_return_status VARCHAR2(30);
7959 l_count NUMBER;
7960 /* Variables to call process order */
7961 l_control_rec OE_GLOBALS.Control_Rec_Type;
7962 p_x_old_header_rec OE_ORDER_PUB.Header_Rec_Type:= p_old_header_rec ;
7963 l_msg_count NUMBER;
7964 l_msg_data VARCHAR2(2000);
7965 l_new_order_type varchar2(80);
7966 l_order_type varchar2(80);
7967 l_return_value number;
7968 l_source_code VARCHAR2(40);
7969 -- included to fix bug 1589196 Begin
7970 l_sales_crd_cnt number;
7971 l_sales_crd_id number;
7972 -- included to fix bug 1589196 end
7973 l_reason_code VARCHAR2(30);
7974 l_reason_comments VARCHAR2(2000);
7975 --bug 4190357
7976 v_count NUMBER;
7977 l_meaning VARCHAR2(80);
7978 l_old_line_tbl OE_Order_PUB.Line_Tbl_Type;
7979 l_line_tbl OE_Order_PUB.Line_Tbl_Type;
7980 i Number;
7981 j Number := 0;
7982 lx_line_rec OE_Order_PUB.Line_Rec_Type;
7983 l_apply_automatic_atchmt VARCHAR2(1) :=
7984 NVL(FND_PROFILE.VALUE('OE_APPLY_AUTOMATIC_ATCHMT'),'Y') ; --5893276
7985
7986 cursor line_ids(p_header_id IN NUMBER) is
7987 select line_id from oe_order_lines_all
7988 where header_id = p_header_id;
7989 --bug 4190357
7990 -- R12 CC encryption
7991 l_changed_attribute VARCHAR2(200);
7992 l_modified_from VARCHAR2(30);
7993 --
7994 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7995 --
7996 l_attr_attach_change boolean := FALSE; --6896311
7997 BEGIN
7998 oe_debug_pub.add('Entering OR_HEADER_UTIL.Pre_Write_Process',1);
7999
8000 OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL := FALSE;
8001 -- Setting the global for IR ISO Tracking bug 7667702
8002
8003 /* Start AuditTrail */
8004
8005 IF (p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE) THEN
8006
8007 IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG = 'Y' THEN
8008 OE_DEBUG_PUB.add('OEXUHDRB: Audit check requires reason', 5);
8009
8010 IF (p_x_header_rec.change_reason IS NULL
8011 OR p_x_header_rec.change_reason = FND_API.G_MISS_CHAR
8012 OR NOT OE_Validate.Change_Reason_Code(p_x_header_rec.change_reason)) then
8013
8014 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
8015 IF OE_Versioning_Util.Captured_Reason IS NULL THEN
8016 OE_Versioning_Util.Get_Reason_Info(l_reason_code, l_reason_comments);
8017 IF l_reason_code IS NULL THEN
8018 -- bug 3636884, defaulting reason from group API
8019 IF OE_GLOBALS.G_DEFAULT_REASON THEN
8020 oe_debug_pub.add('Defaulting Audit Reason for Order Header', 1);
8021 p_x_header_rec.change_reason := 'SYSTEM';
8022 ELSE
8023 OE_DEBUG_PUB.add('Reason code for change is missing or invalid', 1);
8024 fnd_message.set_name('ONT','OE_AUDIT_REASON_RQD');
8025 fnd_message.set_token('OBJECT','ORDER');
8026 oe_msg_pub.add;
8027 RAISE FND_API.G_EXC_ERROR;
8028 END IF;
8029 END IF;
8030 END IF;
8031 ELSE
8032 OE_DEBUG_PUB.add('Reason code for change is missing or invalid', 1);
8033 fnd_message.set_name('ONT','OE_AUDIT_REASON_RQD');
8034 fnd_message.set_token('OBJECT','ORDER');
8035 oe_msg_pub.add;
8036 RAISE FND_API.G_EXC_ERROR;
8037 END IF;
8038 END IF;
8039 END IF;
8040 END IF;
8041
8042 /* START PREPAYMENT */
8043 IF (p_x_header_rec.payment_term_id IS NOT NULL AND --Bug 4207730
8044 NOT OE_GLOBALS.Equal(p_x_header_rec.payment_term_id,p_old_header_rec.payment_term_id))
8045 THEN
8046 IF OE_PREPAYMENT_UTIL.Is_Prepaid_Order(p_x_header_rec) = 'Y' THEN
8047 FND_MESSAGE.SET_NAME('ONT', 'ONT_USE_HDR_TERMS_FOR_INVOICE');
8048 OE_MSG_PUB.Add;
8049 END IF;
8050 END IF;
8051 /* END PREPAYMENT */
8052 -- Included to fix bug 1589196 Begin
8053
8054 IF NOT OE_GLOBALS.Equal(p_x_header_rec.salesrep_id,p_old_header_rec.salesrep_id)
8055 then
8056 IF p_x_header_rec.operation <> OE_GLOBALS.G_OPR_CREATE THEN
8057 OPEN C_HSC_COUNT(p_x_header_rec.header_id);
8058 FETCH C_HSC_COUNT INTO l_sales_crd_cnt, l_sales_crd_id;
8059 CLOSE C_HSC_COUNT;
8060 if l_sales_crd_cnt > 1 then
8061 fnd_message.set_name('ONT','OE_TOO_MANY_HSCREDIT');
8062 OE_MSG_PUB.Add;
8063 RAISE FND_API.G_EXC_ERROR;
8064 end if;
8065 END IF;
8066 END IF;
8067 -- Included to fix bug 1589196 End
8068
8069 Oe_Header_Util.get_order_number(p_x_header_rec => p_x_header_rec,
8070 p_old_header_rec => p_old_header_rec);
8071
8072
8073 -- Call Cancellation Related Code
8074
8075
8076 IF (p_x_header_rec.cancelled_flag = 'Y') then
8077
8078 /* Fix Bug # 3241831: Set Global before Order Cancellation Starts */
8079 IF OE_GLOBALS.G_UI_FLAG = FALSE THEN
8080 oe_debug_pub.add('SET G_ORD_LVL_CAN TO TRUE FOR NON UI ORDER CANCEL');
8081 OE_OE_FORM_CANCEL_LINE.g_ord_lvl_can := TRUE;
8082 END IF;
8083
8084 /* 7576948: IR ISO Change Management project Start */
8085 --
8086 -- When the order header level cancellation is triggered, and all the
8087 -- order lines are successfully cancelled, we should log a delayed request
8088 -- G_UPDATE_REQUISITION to call the Purchasing API so as to trigger the
8089 -- requisition header cancellation. For this, we need to log the delayed
8090 -- requests from Pre_Write_Process procedure of OE_Header_Util package.
8091 -- In this procedure, we need to raise this delayed request only after
8092 -- successful execution of OE_Sales_Can_Util.Perform_Cancel_Order API,
8093 -- which is responsible for canceling both order header and all order
8094 -- lines. This code will be triggered in the event of Full Order
8095 -- Cancellation only.
8096 --
8097 -- If it is a partial order cancellation, i.e. cancellation of internal
8098 -- sales order lines, which are eligible for cancellation and there exists
8099 -- atleast one line in non-cancellation status, then purchasing product
8100 -- will be called only with the cancelled internal sales order lines
8101 -- information, such that corresponding requisition lines can be cancelled/
8102 -- updated. However, in such a case, it may happen that due to system split,
8103 -- fulfillment organization user may cancel a specific line shipment, which
8104 -- may request for requisition line cancellation, but requesting org may
8105 -- have not yet received the partial shipment done so far. In that event,
8106 -- requestion line should be cancelled only after validating that there
8107 -- exists no open quantity for receiving. If there exists open quantity
8108 -- for receiving for requesting org, then inspite of fulfillment org requested
8109 -- for requestion line cancellation, it should be suppressed by the
8110 -- requesting org for update operation.
8111 --
8112 -- Additionally, while logging the delated request, system will ensure that
8113 -- global OE_Internal_Requisition_Pvt.G_Update_ISO_From_Req should be set to
8114 -- FALSE. If this global is TRUE then it signifies that the full header
8115 -- cancellation is triggered from Requesting Organization user.
8116 --
8117 -- Please refer to following delayed request params with their meaning
8118 -- useful while logging the delayed request -
8119 --
8120 -- P_entity_code Entity for which delayed request has to be logged.
8121 -- In this project it can be OE_Globals.G_Entity_Line
8122 -- or OE_Globals.G_Entity_Header
8123 -- P_entity_id Primary key of the entity record. In this project,
8124 -- it can be Order Line_id or Header_id
8125 -- P_requesting_entity_code Which entity has requested this delayed request to
8126 -- be logged! In this project it will be OE_Globals.
8127 -- G_Entity_Line or OE_Globals.G_Entity_Header
8128 -- P_requesting_entity_id Primary key of the requesting entity. In this
8129 -- project, it is Line_id or Header_id
8130 -- P_request_type Indicates which business logic (or which procedure)
8131 -- should be executed. In this project, it is OE_Global
8132 -- s.G_UPDATE_REQUISITION
8133 -- P_request_unique_key1 Additional argument in form of parameters.
8134 -- In this project, it will denote the Sales Order
8135 -- Header id
8136 -- P_request_unique_key2 Additional argument in form of parameters.
8137 -- In this project, it will denote the Requisition
8138 -- Header id
8139 -- P_request_unique_key3 Additional argument in form of parameters. In
8140 -- this project, it will denote the Requistion Line
8141 -- id
8142 -- P_param1 Additional argument in form of parameters. In this project, it
8143 -- will denote net change in order quantity with respective single
8144 -- requisition line. If it is greater than 0 then it is an increment
8145 -- in the quantity, while if it is less than 0 then it is a decrement
8146 -- in the ordered quantity. If it is 0 then it indicates there is no
8147 -- change in ordered quantity value
8148 -- P_param2 Additional argument in form of parameters. In this project, it
8149 -- will denote whether internal sales order is cancelled or not. If
8150 -- it is cancelled then respective Purchasing api will be called to
8151 -- trigger the requisition header cancellation. It accepts a value of
8152 -- Y indicating requisition header has to be cancelled.
8153 -- P_param3 Additional argument in form of parameters. In this project, it
8154 -- will denote the number of sales order lines cancelled while order
8155 -- header is (Full/Partial) cancelled.
8156 -- p_date_param1 Additional date argument in form of parameters. In this
8157 -- project, it will denote the change in Schedule Ship Date
8158 -- with to respect to single requisition line.
8159 -- P_Long_param1 Additional argument in form of parameters. In this project,
8160 -- it will store all the sales order line_ids, which are getting
8161 -- cancelled while order header gets cancelled (Full/Partial).
8162 -- These Line_ids will be separated by a delimiter comma ','
8163 --
8164 -- For details on IR ISO CMS project, please refer to FOL >
8165 -- OM Development > OM GM > 12.1.1 > TDD > IR_ISO_CMS_TDD.doc
8166 --
8167
8168 IF (p_x_header_rec.order_source_id = 10) THEN
8169 OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL := TRUE;
8170 IF l_debug_level > 0 THEN
8171 oe_debug_pub.add(' Setting global Header Cancel for IR ISO to TRUE',5);
8172 END IF;
8173 END IF;
8174 -- Setting this global to TRUE confirming it to be
8175 -- Order header level full cancellation
8176
8177 OE_SALES_CAN_UTIL.Perform_cancel_order(p_x_header_rec,
8178 p_old_header_rec,
8179 l_return_status);
8180
8181 IF (p_x_header_rec.order_source_id = 10) THEN
8182 OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL := FALSE;
8183 IF l_debug_level > 0 THEN
8184 oe_debug_pub.add(' Setting global Header Cancel for IR ISO to FALSE',5);
8185 END IF;
8186 END IF;
8187 -- Resetting the global to FALSE
8188
8189 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8190 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
8191 RAISE FND_API.G_EXC_ERROR;
8192 ELSE
8193 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8194 END IF;
8195
8196
8197 ELSE -- If return status is SUCCESS
8198 IF (p_x_header_rec.order_source_id = 10) THEN
8199 IF NOT OE_Internal_Requisition_Pvt.G_Update_ISO_From_Req THEN
8200 IF l_debug_level > 0 THEN
8201 oe_debug_pub.add(' Header level cancellation. Log the IR ISO update delayed request',5);
8202 END IF;
8203
8204 OE_delayed_requests_Pvt.log_request
8205 ( p_entity_code => OE_GLOBALS.G_ENTITY_HEADER
8206 , p_entity_id => p_x_header_rec.header_id
8207 , p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER
8208 , p_requesting_entity_id => p_x_header_rec.header_id
8209 , p_request_unique_key2 => p_x_header_rec.source_document_id -- Req Hdr_id
8210 , p_param2 => 'Y'
8211 , p_request_type => OE_GLOBALS.G_UPDATE_REQUISITION
8212 , x_return_status => l_return_status
8213 );
8214
8215 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8216 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8217 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8218 RAISE FND_API.G_EXC_ERROR;
8219 END IF;
8220 END IF;
8221 END IF; -- Order_Source_id
8222
8223
8224 /* ============================= */
8225 /* IR ISO Change Management Ends */
8226
8227
8228 END IF;
8229 END IF;
8230
8231 -- If ship from org has been changed validate the freight carrier. If
8232 -- freight carrier is not a valid one for the ship from org clear the
8233 -- freight carrier field.
8234
8235 IF (p_x_header_rec.order_category_code <> 'RETURN') THEN
8236
8237 IF (NOT OE_GLOBALS.Equal(p_x_header_rec.ship_from_org_id,
8238 p_old_header_rec.ship_from_org_id) OR
8239 NOT OE_GLOBALS.Equal(p_x_header_rec.shipping_method_code,
8240 p_old_header_rec.shipping_method_code)) THEN
8241
8242 IF p_x_header_rec.shipping_method_code IS NOT NULL AND
8243 p_x_header_rec.ship_from_org_id IS NOT NULL THEN
8244
8245 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110509' THEN
8246 SELECT count(*)
8247 INTO l_count
8248 FROM wsh_carrier_services wsh,
8249 wsh_org_carrier_services wsh_org
8250 WHERE wsh_org.organization_id = p_x_header_rec.ship_from_org_id
8251 AND wsh.carrier_service_id = wsh_org.carrier_service_id
8252 AND wsh.ship_method_code = p_x_header_rec.shipping_method_code
8253 AND wsh_org.enabled_flag = 'Y';
8254 ELSE
8255 SELECT count(CARRIER_SHIP_METHOD_ID)
8256 INTO l_count
8257 FROM wsh_carrier_ship_methods
8258 WHERE ship_method_code = p_x_header_rec.shipping_method_code
8259 AND organization_id = p_x_header_rec.ship_from_org_id
8260 AND enabled_flag = 'Y'; -- added for bug 3886064
8261 END IF;
8262
8263 -- Valid shipping method.
8264
8265 IF l_debug_level > 0 THEN
8266 oe_debug_pub.add('l_count : ' || l_count);
8267 oe_debug_pub.add('shipping_method_code : ' || p_x_header_rec.shipping_method_code);
8268 END IF;
8269
8270 IF l_count = 0 THEN
8271
8272 --bug 4190357
8273 select count(*) into v_count from oe_price_adjustments
8274 where header_id = p_x_header_rec.header_id
8275 and line_id is null
8276 and substitution_attribute = 'QUALIFIER_ATTRIBUTE11'
8277 and list_line_type_code = 'TSN'
8278 and modified_to = p_x_header_rec.shipping_method_code;
8279 IF v_count > 0 THEN
8280 IF l_debug_level > 0 THEN
8281 oe_debug_pub.add('Deleting the header tsn adjustments');
8282 END IF;
8283 DELETE FROM OE_PRICE_ADJUSTMENTS
8284 WHERE HEADER_ID = p_x_header_rec.header_id
8285 AND LIST_LINE_TYPE_CODE = 'TSN'
8286 AND SUBSTITUTION_ATTRIBUTE = 'QUALIFIER_ATTRIBUTE11'
8287 AND MODIFIED_TO = p_x_header_rec.shipping_method_code
8288 RETURNING MODIFIED_FROM INTO l_modified_from;
8289 END IF;
8290 select meaning into l_meaning from oe_ship_methods_v where lookup_type = 'SHIP_METHOD' and lookup_code = p_x_header_rec.shipping_method_code;
8291 --bug 4190357
8292
8293 l_control_rec.write_to_DB := FALSE;
8294 l_control_rec.controlled_operation := TRUE;
8295 l_control_rec.process := FALSE;
8296 --bug 3941272
8297 p_x_old_header_rec := p_x_header_rec ;
8298 IF v_count = 0 THEN
8299 --end bug 3941272
8300 p_x_header_rec.freight_carrier_code := NULL;
8301 p_x_header_rec.shipping_method_code := NULL;
8302 ELSE
8303 p_x_header_rec.shipping_method_code := l_modified_from;
8304 END IF;
8305
8306 Oe_Order_Pvt.Header
8307 ( p_validation_level => FND_API.G_VALID_LEVEL_NONE
8308 , p_control_rec => l_control_rec
8309 , p_x_header_rec => p_x_header_rec
8310 , p_x_old_header_rec => p_x_old_header_rec
8311 , x_return_status => l_return_status );
8312
8313 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8314 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8315 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8316 RAISE FND_API.G_EXC_ERROR;
8317 END IF;
8318
8319
8320 OE_MSG_PUB.Update_Msg_Context(p_attribute_code => 'SHIPPING_METHOD');
8321 fnd_message.set_name('ONT','OE_INVALID_ATTRIBUTE');
8322 --bug 4190357 added l_meaning to the token
8323 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
8324 OE_Order_Util.Get_Attribute_Name('shipping_method_code') || ' ' || l_meaning);
8325 OE_MSG_PUB.Add;
8326 OE_MSG_PUB.Update_Msg_Context(p_attribute_code => null);
8327
8328 oe_debug_pub.add('Value of shipping Method:'
8329 ||p_x_header_rec.shipping_method_code,2);
8330
8331 --bug 4190357
8332 for i in line_ids(p_x_header_rec.header_id) loop
8333 v_count := 0;
8334 select count(*) into v_count from oe_price_Adjustments
8335 where header_id = p_x_header_rec.header_id
8336 and line_id = i.line_id
8337 and substitution_attribute = 'QUALIFIER_ATTRIBUTE11'
8338 and list_line_type_code = 'TSN';
8339 If v_count = 0 Then
8340 j := j + 1;
8341 Oe_Line_Util.Query_Row(i.line_id, lx_line_rec);
8342 l_old_line_tbl(j) := lx_line_rec;
8343 l_line_tbl(j) := lx_line_rec;
8344 IF l_modified_from is NULL Then
8345 l_line_tbl(j).freight_carrier_code := NULL;
8346 l_line_tbl(j).shipping_method_code := NULL;
8347 ELSE
8348 l_line_tbl(j).shipping_method_code := l_modified_from;
8349 END IF;
8350 l_line_tbl(j).operation := OE_GLOBALS.G_OPR_UPDATE;
8351 End If;
8352 end loop;
8353 IF l_line_tbl.count > 0 THEN
8354 OE_GLOBALS.G_PRICING_RECURSION := 'Y';
8355 l_control_rec.controlled_operation := TRUE;
8356 l_control_rec.check_security := TRUE;
8357 l_control_rec.clear_dependents := FALSE;
8358 l_control_rec.default_attributes := FALSE;
8359 l_control_rec.change_attributes := TRUE;
8360 l_control_rec.validate_entity := FALSE;
8361 l_control_rec.write_to_DB := TRUE;
8362 l_control_rec.process := FALSE;
8363
8364 Oe_Order_Pvt.Lines
8365 ( p_validation_level => FND_API.G_VALID_LEVEL_NONE
8366 ,p_control_rec => l_control_rec
8367 ,p_x_line_tbl => l_line_tbl
8368 ,p_x_old_line_tbl => l_old_line_tbl
8369 ,x_return_status => l_return_status
8370 );
8371
8372 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
8373 RAISE FND_API.G_EXC_ERROR;
8374 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8375 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8376 END IF;
8377 OE_GLOBALS.G_PRICING_RECURSION := 'N';
8378 END IF;
8379 --bug 4190357
8380
8381 END IF;
8382
8383 END IF;
8384 END IF;
8385
8386 END IF;
8387
8388 -- Log delayed request to create automatic attachments
8389 /*6896311
8390 IF (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE OR
8391 p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE) AND --5893276
8392 6896311*/
8393 IF (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE ) AND --6896311
8394 l_apply_automatic_atchmt = 'Y' THEN
8395 oe_debug_pub.add('log request to apply atcmt');
8396 OE_DELAYED_REQUESTS_PVT.Log_Request
8397 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8398 p_entity_id => p_x_header_rec.header_id,
8399 p_request_type => OE_GLOBALS.G_APPLY_AUTOMATIC_ATCHMT,
8400 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8401 p_requesting_entity_id => p_x_header_rec.header_id,
8402 x_return_status => l_return_status
8403 );
8404 END IF;
8405
8406 --6896311
8407 IF (p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE ) AND
8408 l_apply_automatic_atchmt = 'Y'
8409 THEN
8410 oe_debug_pub.add('log request to update atcmt');
8411
8412 IF NOT OE_GLOBALS.Equal(p_x_header_rec.CUST_PO_NUMBER
8413 ,p_old_header_rec.CUST_PO_NUMBER)
8414 OR NOT OE_GLOBALS.Equal(p_x_header_rec.INVOICE_TO_ORG_ID
8415 ,p_old_header_rec.INVOICE_TO_ORG_ID)
8416 OR NOT OE_GLOBALS.Equal(p_x_header_rec.ORDER_TYPE_ID
8417 ,p_old_header_rec.ORDER_TYPE_ID)
8418 OR NOT OE_GLOBALS.Equal(p_x_header_rec.SHIP_TO_ORG_ID
8419 ,p_old_header_rec.SHIP_TO_ORG_ID)
8420 OR NOT OE_GLOBALS.Equal(p_x_header_rec.SOLD_TO_ORG_ID
8421 ,p_old_header_rec.SOLD_TO_ORG_ID)
8422 OR NOT OE_GLOBALS.Equal(p_x_header_rec.ORDER_CATEGORY_CODE
8423 ,p_old_header_rec.ORDER_CATEGORY_CODE)
8424 THEN
8425
8426 l_attr_attach_change := TRUE;
8427
8428 END IF;
8429
8430 IF l_attr_attach_change THEN
8431 OE_delayed_requests_Pvt.Log_Request
8432 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8433 p_entity_id => p_x_header_rec.header_id,
8434 p_request_type => OE_GLOBALS.G_APPLY_AUTOMATIC_ATCHMT,
8435 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8436 p_requesting_entity_id => p_x_header_rec.header_id,
8437 x_return_status => l_return_status
8438 );
8439 END IF;
8440 END IF;
8441 --6896311
8442
8443
8444 -- QUOTING changes
8445 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F'
8446 AND NOT OE_GLOBALS.Equal(p_x_header_rec.order_type_id
8447 ,p_old_header_rec.order_type_id)
8448 THEN
8449
8450 -- If the Order Type has changed, we need to sync up the
8451 -- MTL_SALES_ORDERS table.
8452 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
8453
8454 l_source_code := FND_PROFILE.VALUE('ONT_SOURCE_CODE');
8455 -- 3817802 : New api Get_Base_Order_Type is used to get order type based on base lang
8456 l_new_order_type := Get_Base_Order_Type(p_x_header_rec.order_type_id);
8457 l_order_type := Get_Base_Order_Type(p_old_header_rec.order_type_id);
8458 IF l_debug_level > 0 THEN
8459 oe_debug_pub.add('l_source_code ' || l_source_code,2);
8460 oe_debug_pub.add('l_new_order_type ' || l_new_order_type,2);
8461 oe_debug_pub.add('l_order_type ' || l_order_type,2);
8462 END IF;
8463 l_return_value :=
8464 inv_salesorder.synch_salesorders_with_om(
8465 p_original_order_number =>
8466 to_char(p_old_header_rec.order_number),
8467 p_original_order_type => l_order_type,
8468 p_original_source_code => l_source_code,
8469 p_new_order_number =>
8470 to_char(p_x_header_rec.order_number),
8471 p_new_order_type => l_new_order_type,
8472 p_new_order_source => l_source_code,
8473 p_multiple_rows => 'N');
8474 oe_debug_pub.add(' Return Value ' || l_return_value,1);
8475 END IF;
8476
8477 END IF;
8478 --included for the create internal requisition Spares Management (Ikon) project mshenoy
8479 -- For all Internal Sales Orders (Source Document Type ID = 10 ) and Create ISO Operations
8480 -- log a Delayed Request for the create Internal Requisition
8481 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
8482 p_x_header_rec.Source_Document_Type_id = 10 AND
8483 p_x_header_rec.Source_Document_id is null AND
8484 p_x_header_rec.Orig_sys_document_ref is null THEN
8485 oe_debug_pub.add('log request to create internal Req for ISO');
8486 OE_delayed_requests_Pvt.Log_Request
8487 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
8488 p_entity_id => p_x_header_rec.header_id,
8489 p_request_type => OE_GLOBALS.G_CREATE_INTERNAL_REQ,
8490 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8491 p_requesting_entity_id => p_x_header_rec.header_id,
8492 x_return_status => l_return_status );
8493 oe_debug_pub.add(' Return Status log_request Delayed Requests for Int req ' || l_return_status);
8494
8495 END IF;
8496
8497 -- Fix for bug1167537
8498 -- Clear the header record cached by defaulting APIs so that the
8499 -- default values on the line record are obtained from the
8500 -- updated header record
8501 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
8502 ONT_HEADER_Def_Util.Clear_HEADER_Cache;
8503 END IF;
8504
8505 -- R12 CC encryption
8506 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
8507 AND (p_x_header_rec.payment_type_code = 'CREDIT_CARD'
8508 OR p_old_header_rec.payment_type_code = 'CREDIT_CARD') THEN
8509
8510 IF (NOT OE_GLOBALS.Is_Same_Credit_Card(p_old_header_rec.credit_card_number,
8511 p_x_header_rec.credit_card_number,
8512 p_old_header_rec.cc_instrument_id,
8513 p_x_header_rec.cc_instrument_id))
8514 OR
8515 (p_x_header_rec.payment_type_code IS NULL AND NOT OE_GLOBALS.Is_Same_Credit_Card(p_old_header_rec.credit_card_number,p_x_header_rec.credit_card_number,p_old_header_rec.cc_instrument_id, NULL))
8516 THEN
8517
8518 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_NUMBER';
8519
8520 /**
8521 IF l_changed_attribute = 'CREDIT_CARD_CODE' THEN
8522 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_NUMBER';
8523 ELSE
8524 l_changed_attribute := 'CREDIT_CARD_NUMBER';
8525 END IF;
8526 **/
8527
8528 END IF;
8529
8530 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_code,p_old_header_rec.credit_card_code)
8531 THEN
8532
8533 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_CODE';
8534
8535 /**
8536 IF l_changed_attribute = 'CREDIT_CARD_NUMBER' THEN
8537 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_CODE';
8538 ELSE
8539 l_changed_attribute := 'CREDIT_CARD_CODE';
8540 END IF;
8541 **/
8542
8543 END IF;
8544
8545 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_holder_name,p_old_header_rec.credit_card_holder_name)
8546 THEN
8547 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_HOLDER_NAME';
8548
8549 END IF;
8550
8551 IF NOT OE_GLOBALS.Equal(p_x_header_rec.credit_card_expiration_date,p_old_header_rec.credit_card_expiration_date)
8552 THEN
8553 l_changed_attribute := l_changed_attribute||',' ||'CREDIT_CARD_EXPIRATION_DATE';
8554
8555 END IF;
8556 oe_debug_pub.add('changed attr is: '||l_changed_attribute, 3);
8557 END IF;
8558
8559 -- Bug 1755817: clear the cached constraint results for header entity
8560 -- when order header is updated.
8561 OE_PC_Constraints_Admin_Pvt.Clear_Cached_Results
8562 (p_validation_entity_id => OE_PC_GLOBALS.G_ENTITY_HEADER);
8563
8564 --11.5.10 Versioning/Audit Trail updates
8565 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' AND
8566 OE_GLOBALS.G_ROLL_VERSION <> 'N' THEN
8567 IF OE_GLOBALS.G_REASON_CODE IS NULL AND
8568 OE_GLOBALS.G_CAPTURED_REASON IN ('V','A') THEN
8569 IF p_x_header_rec.change_reason <> FND_API.G_MISS_CHAR THEN
8570 OE_GLOBALS.G_REASON_CODE := p_x_header_rec.change_reason;
8571 OE_GLOBALS.G_REASON_COMMENTS := p_x_header_rec.change_comments;
8572 OE_GLOBALS.G_CAPTURED_REASON := 'Y';
8573 ELSE
8574 OE_DEBUG_PUB.add('Reason code for versioning is missing', 1);
8575 if OE_GLOBALS.G_UI_FLAG THEN
8576 raise FND_API.G_EXC_ERROR;
8577 end if;
8578 END IF;
8579 END IF;
8580
8581 --log delayed request
8582 oe_debug_pub.add('log versioning request',1);
8583 OE_Delayed_Requests_Pvt.Log_Request(p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
8584 p_entity_id => p_x_header_rec.header_id,
8585 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8586 p_requesting_entity_id => p_x_header_rec.header_id,
8587 p_request_type => OE_GLOBALS.G_VERSION_AUDIT,
8588 p_param1 => l_changed_attribute,
8589 x_return_status => l_return_status);
8590 END IF;
8591
8592 IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG = 'Y' OR
8593 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG = 'Y' THEN
8594 OE_DEBUG_PUB.add('Call oe_order_chg_pvt to record Header Audit History',5);
8595
8596 --11.5.10 Versioning/Audit Trail updates
8597 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
8598 OE_Versioning_Util.Capture_Audit_Info(p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8599 p_entity_id => p_x_header_rec.header_id,
8600 p_hist_type_code => 'UPDATE');
8601 --log delayed request
8602 OE_Delayed_Requests_Pvt.Log_Request(p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
8603 p_entity_id => p_x_header_rec.header_id,
8604 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8605 p_requesting_entity_id => p_x_header_rec.header_id,
8606 p_request_type => OE_GLOBALS.G_VERSION_AUDIT,
8607 p_param1 => l_changed_attribute,
8608 x_return_status => l_return_status);
8609 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'N';
8610 ELSE
8611 OE_CHG_ORDER_PVT.RecordHeaderHist
8612 ( p_header_id => p_x_header_rec.header_id,
8613 p_header_rec => null,
8614 p_hist_type_code => 'UPDATE',
8615 p_reason_code => p_x_header_rec.change_reason,
8616 p_comments => p_x_header_rec.change_comments,
8617 p_wf_activity_code => null,
8618 p_wf_result_code => null,
8619 x_return_status => l_return_status
8620 );
8621
8622 if l_return_status <> FND_API.G_RET_STS_SUCCESS then
8623 oe_debug_pub.add('Inserting Header History Caused Error ',1);
8624 if l_return_status = FND_API.G_RET_STS_ERROR then
8625 raise FND_API.G_EXC_ERROR;
8626 else
8627 raise FND_API.G_EXC_UNEXPECTED_ERROR;
8628 end if;
8629 end if;
8630 END IF;
8631 END IF;
8632
8633 -- QUOTING changes
8634 -- Initialize flow status to DRAFT or ENTERED dependening on transaction phase
8635 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE THEN
8636
8637 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
8638 /*
8639 ** Fix Bug # 3484862: iStore will be sending flow status as WORKING
8640 ** for RMAs created with Return for Submission with Approval Flow.
8641 */
8642 IF p_x_header_rec.flow_status_code = 'WORKING' THEN
8643 null;
8644 ELSE
8645 p_x_header_rec.flow_status_code := 'ENTERED';
8646 END IF;
8647 ELSIF p_x_header_rec.transaction_phase_code = 'N' THEN
8648 p_x_header_rec.flow_status_code := 'DRAFT';
8649 END IF;
8650
8651 END IF; -- if operation CREATE
8652
8653 --For bug 3563983. Logging REquest for updaet of Blanekt fields.
8654 --Moved this logic from post-write process.
8655 --Log request for deletes AND for update of currency
8656
8657 IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509'
8658 AND NVL(p_x_header_rec.transaction_phase_code,'F') = 'F'
8659 AND (p_x_header_rec.operation = OE_GLOBALS.G_OPR_DELETE OR
8660 (p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
8661 AND NOT OE_GLOBALS.EQUAL(p_x_header_rec.transactional_curr_code
8662 ,p_old_header_rec.transactional_curr_code)))
8663 THEN
8664 Blkt_Req_For_Curr_Upd_And_Del(p_x_header_rec,p_old_header_rec);
8665 END IF;
8666
8667
8668 oe_debug_pub.add('Exiting OR_HEADER_UTIL.Pre_Write_Process',1);
8669
8670 EXCEPTION
8671 -- included to fix bug 1589196 Begin
8672 WHEN FND_API.G_EXC_ERROR THEN
8673
8674 OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL := FALSE;
8675 -- Adding this for IR ISO Tracking bug 7667702
8676
8677 RAISE FND_API.G_EXC_ERROR;
8678 -- included to fix bug 1589196 End
8679
8680 WHEN OTHERS THEN
8681
8682 OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL := FALSE;
8683 -- Adding this for IR ISO Tracking bug 7667702
8684
8685 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
8686 THEN
8687 OE_MSG_PUB.Add_Exc_Msg
8688 ( G_PKG_NAME
8689 , 'Pre_Write_Process'
8690 );
8691 END IF;
8692 p_x_header_rec.return_status := FND_API.G_RET_STS_ERROR;
8693
8694 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8695
8696
8697 End Pre_Write_Process;
8698
8699 PROCEDURE Post_Write_Process
8700 ( p_x_header_rec IN OUT NOCOPY oe_order_pub.header_rec_type,
8701 p_old_header_rec IN oe_order_pub.header_rec_type )
8702 IS
8703 l_return_status VARCHAR2(30);
8704 l_msg_count NUMBER;
8705 l_msg_data VARCHAR2(2000);
8706
8707 l_control_rec OE_GLOBALS.Control_Rec_Type;
8708 l_old_line_tbl OE_Order_PUB.Line_Tbl_Type;
8709 l_line_tbl OE_Order_PUB.Line_Tbl_Type;
8710 l_recursion_mode VARCHAR2(1);
8711 l_operation VARCHAR2(30);
8712 --R12 CC Encryption
8713 l_x_Header_Payment_tbl OE_ORDER_PUB.Header_Payment_tbl_type;
8714 l_x_old_Header_Payment_tbl OE_ORDER_PUB.Header_Payment_tbl_type;
8715 l_payment_exists VARCHAR2(1) := 'N';
8716 l_payment_number NUMBER;
8717 l_old_payment_type_code VARCHAR2(30) := NULL;
8718 --R12 CC Encryption
8719 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
8720 --bug 5258767
8721 l_payment_term_id NUMBER;
8722 l_prepayment_flag VARCHAR2(1) := NULL;
8723 l_prepay_count NUMBER := 0;
8724 l_currency_code VARCHAR2(30) := NULL;
8725 l_subtotal number;
8726 l_discount number;
8727 l_charges number;
8728 l_tax number;
8729 L_ORDER_TOTAL number;
8730 L_DOWNPAYMENT number;
8731 l_line_payment_count NUMBER;
8732 --bug 5258767
8733 BEGIN
8734 oe_debug_pub.add('Entering OE_HEADER_UTIL.Post_Write_Process',1);
8735
8736 -- Added call to new procedure eval_post_write_header for performance
8737 -- and to be consistent with evalualte_post_write for lines.
8738 -- See bug#1777317
8739 -- QUOTING changes - moved this call within another create loop
8740 -- later as holds should be applied only to orders in fulfillment phase.
8741
8742 --Fix bug 1649402
8743 OE_DELAYED_REQUESTS_PVT.Process_Request_for_ReqType
8744 (p_request_type => OE_GLOBALS.G_DFLT_HSCREDIT_FOR_SREP
8745 ,p_delete => FND_API.G_TRUE
8746 ,x_return_status=> l_return_status
8747 );
8748 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8749 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8750 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8751 RAISE FND_API.G_EXC_ERROR;
8752 END IF;
8753
8754 -- QUOTING changes - moved this call within another create loop
8755 -- later as mtl_sales_order records should be created only for
8756 -- orders in fulfillment phase.
8757
8758 -- QUOTING changes
8759 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
8760 OR (OE_Quote_Util.G_COMPLETE_NEG = 'Y'
8761 AND NOT OE_GLOBALS.EQUAL(p_x_header_rec.transaction_phase_code,
8762 p_old_header_rec.transaction_phase_code)
8763 )
8764 THEN
8765
8766 -- Fulfillment phase specific actions - holds,
8767 -- MTL entry and fulfillment WF start
8768 IF nvl(p_x_header_rec.transaction_phase_code,'F') = 'F' THEN
8769
8770 -- Added call to new procedure eval_post_write_header for performance
8771 -- and to be consistent with evalualte_post_write for lines.
8772 -- See bug#1777317
8773
8774 /*ER#7479609
8775 oe_debug_pub.add('Before calling eval_post_write_header in HEADER Post Write',1);
8776
8777 OE_HOLDS_PUB.eval_post_write_header
8778 ( p_entity_code => OE_GLOBALS.G_ENTITY_HEADER
8779 ,p_entity_id => p_x_header_rec.header_id
8780 ,p_hold_entity_code => 'C'
8781 ,p_hold_entity_id => p_x_header_rec.sold_to_org_id
8782 ,x_return_status => l_return_status
8783 ,x_msg_count => l_msg_count
8784 ,x_msg_data => l_msg_data );
8785
8786
8787
8788 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8789 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8790 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8791 RAISE FND_API.G_EXC_ERROR;
8792 END IF;
8793
8794 oe_debug_pub.add('After calling eval_post_write_header in HEADER Post Write',1);
8795 ER#7479609*/
8796
8797 --ER#7479609 start
8798 if l_debug_level > 0 then
8799 oe_debug_pub.add('Call evaluate_holds_post_write for CREATE');
8800 end if;
8801 OE_Holds_PUB.evaluate_holds_post_write
8802 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER
8803 ,p_entity_id => p_x_header_rec.header_id
8804 ,x_msg_count => l_msg_count
8805 ,x_msg_data => l_msg_data
8806 ,x_return_status => l_return_status
8807 );
8808
8809 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
8810 RAISE FND_API.G_EXC_ERROR;
8811 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8812 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8813 END IF;
8814
8815 if l_debug_level > 0 then
8816 oe_debug_pub.add('After evaluate_holds_post_write in Header Post Write');
8817 end if;
8818 --ER#7479609 end
8819
8820 -- Create record in the MTL_SALES_ORDERS table
8821
8822 oe_debug_pub.add('Before calling OE_SCHEDULE_UTIL',3);
8823 OE_SCHEDULE_UTIL.Insert_into_mtl_sales_orders(p_x_header_rec);
8824
8825 -- Create and Start the Header level Workflow
8826
8827 OE_Order_WF_Util.CreateStart_HdrProcess(p_x_header_rec);
8828
8829 -- Negotiation phase specific actions - negotiation WF start
8830 ELSE
8831
8832 -- Sam to provide this API
8833 OE_Order_WF_Util.CreateStart_HdrInternal
8834 (p_item_type => 'OENH'
8835 ,p_header_id => p_x_header_rec.header_id
8836 ,p_transaction_number => p_x_header_rec.quote_number
8837 ,p_sales_document_type_code => 'O'
8838 );
8839 NULL;
8840
8841 END IF;
8842
8843 -- Check if the lock_control has changed, it would if there
8844 -- were updates due to synchronous activities like booking in
8845 -- the header flow. If yes, refresh the header record
8846
8847 OE_Order_Cache.Load_Order_Header(p_x_header_rec.header_id);
8848 oe_debug_pub.add('DB lock control :'||
8849 OE_Order_Cache.g_header_rec.lock_control);
8850
8851 IF OE_Order_Cache.g_header_rec.lock_control
8852 <> p_x_header_rec.lock_control
8853 THEN
8854 l_operation := p_x_header_rec.operation;
8855 p_x_header_rec := OE_Order_Cache.g_header_rec;
8856 p_x_header_rec.operation := l_operation;
8857 OE_GLOBALS.G_CASCADING_REQUEST_LOGGED := TRUE;
8858 END IF;
8859
8860 END IF; -- END for check if CREATE operation
8861 -- QUOTING changes END
8862
8863 -- Close the order if its a complet cancellation at the line and
8864 -- is indeed a cancellation (by constraints)
8865 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
8866 IF oe_sales_can_util.g_order_cancel AND
8867 p_x_header_rec.cancelled_flag = 'Y' AND (p_old_header_rec.cancelled_flag <> 'Y') THEN --7142748
8868 -- Bug 1895144: set recursion mode so that close does
8869 -- not execute any delayed requests
8870 BEGIN
8871 l_recursion_mode := OE_GLOBALS.G_RECURSION_MODE;
8872 -- OE_GLOBALS.G_RECURSION_MODE := 'Y';
8873
8874 -- Log a request to cancel the workflow.
8875 /*
8876 -- commented to take care of P1 issues in configuration
8877
8878 OE_delayed_requests_Pvt.log_request
8879 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
8880 p_entity_id => p_x_header_rec.header_id,
8881 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_ALL,
8882 p_requesting_entity_id => p_x_header_rec.header_id,
8883 p_request_type => OE_GLOBALS.G_CANCEL_WF,
8884 p_param1 => OE_GLOBALS.G_ENTITY_HEADER,
8885 x_return_status => l_return_status);
8886 */
8887
8888 -- Commented the code to move the logic to delayed request
8889 -- Uncommented to take care of P1 configuration issues
8890 wf_engine.handleerror(OE_Globals.G_WFI_HDR
8891 ,to_char(p_x_header_rec.header_id)
8892 ,'CLOSE_HEADER',
8893 'RETRY','CANCEL');
8894
8895 -- OE_GLOBALS.G_RECURSION_MODE := l_recursion_mode;
8896 -- BUG 2013611 - Increment promotional balance in response to cancellation
8897 oe_debug_pub.add('log request to Reverse_Limits for CANCEL in HEADER Post Write',1);
8898 OE_delayed_requests_Pvt.log_request(
8899 p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8900 p_entity_id => p_x_header_rec.header_id,
8901 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
8902 p_requesting_entity_id => p_x_header_rec.header_id,
8903 p_request_unique_key1 => 'HEADER',
8904 p_param1 => 'CANCEL',
8905 p_param2 => p_x_header_rec.price_request_code,
8906 p_param3 => NULL,
8907 p_param4 => NULL,
8908 p_param5 => NULL,
8909 p_param6 => NULL,
8910 p_request_type => OE_GLOBALS.G_REVERSE_LIMITS,
8911 x_return_status => l_return_status);
8912 oe_debug_pub.add('Request to Reverse_Limits in HEADER Post Write is done',1);
8913 -- BUG 2013611 End
8914 EXCEPTION
8915 WHEN OTHERS THEN
8916 -- OE_GLOBALS.G_RECURSION_MODE := l_recursion_mode;
8917 RAISE;
8918 END;
8919 END IF;
8920 END IF;
8921 oe_sales_can_util.g_order_cancel := FALSE;
8922
8923
8924 ----------------------------------------------------------------
8925 -- Update the customer on the order lines if changed on the
8926 -- order header
8927 ----------------------------------------------------------------
8928 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
8929 AND NOT OE_GLOBALS.EQUAL( p_x_header_rec.sold_to_org_id,
8930 p_old_header_rec.sold_to_org_id )
8931 THEN
8932
8933 OE_Line_Util.Query_Rows
8934 ( p_header_id => p_x_header_rec.header_id
8935 , x_line_tbl => l_old_line_tbl );
8936
8937 IF l_old_line_tbl.COUNT = 0 THEN
8938 RETURN;
8939 END IF;
8940
8941 l_line_tbl := l_old_line_tbl;
8942 FOR I IN 1..l_line_tbl.COUNT LOOP
8943 -- IF condition added for bug 5471580
8944 IF nvl(l_line_tbl(I).cancelled_flag, 'N') = 'N' THEN
8945 l_line_tbl(I).sold_to_org_id := p_x_header_rec.sold_to_org_id;
8946 l_line_tbl(I).operation := OE_GLOBALS.G_OPR_UPDATE;
8947 ELSE
8948 l_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
8949 END IF;
8950 END LOOP;
8951
8952 l_control_rec.controlled_operation := TRUE;
8953 l_control_rec.clear_dependents := TRUE;
8954 l_control_rec.default_attributes := TRUE;
8955 l_control_rec.check_security := TRUE;
8956 l_control_rec.change_attributes := TRUE;
8957 l_control_rec.validate_entity := TRUE;
8958 l_control_rec.write_to_db := TRUE;
8959 l_control_rec.process := FALSE;
8960
8961 -- OE_GLOBALS.G_RECURSION_MODE := 'Y';
8962
8963 OE_Order_PVT.Lines
8964 ( p_validation_level => FND_API.G_VALID_LEVEL_NONE
8965 , p_control_rec => l_control_rec
8966 , p_x_line_tbl => l_line_tbl
8967 , p_x_old_line_tbl => l_old_line_tbl
8968 , x_return_status => l_return_status
8969 );
8970
8971 -- OE_GLOBALS.G_RECURSION_MODE := 'N';
8972
8973 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
8974 RAISE FND_API.G_EXC_ERROR;
8975 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8976 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8977 END IF;
8978
8979 -- commented out for notification framework
8980 /* OE_Order_PVT.Process_Requests_And_Notify
8981 ( p_process_requests => FALSE
8982 , p_notify => TRUE
8983 , p_line_tbl => l_line_tbl
8984 , p_old_line_tbl => l_old_line_tbl
8985 , x_return_status => l_return_status
8986 );
8987
8988 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
8989 RAISE FND_API.G_EXC_ERROR;
8990 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
8991 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8992 END IF;
8993 */
8994 OE_GLOBALS.G_CASCADING_REQUEST_LOGGED := TRUE;
8995
8996 END IF;
8997
8998 --For bug 3563983. Commented this code and moved this logic to pre-write process.
8999 --Line data will not be available for delete operation and this stage.
9000 /* IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509'
9001 AND p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
9002 AND NOT OE_GLOBALS.EQUAL(p_x_header_rec.transactional_curr_code
9003 ,p_old_header_rec.transactional_curr_code)
9004 -- QUOTING changes
9005 AND NVL(p_x_header_rec.transaction_phase_code,'F') = 'F'
9006 THEN
9007
9008 Blanket_Req_For_Curr_Update(p_x_header_rec,p_old_header_rec);
9009
9010 END IF;*/
9011
9012 -- QUOTING changes
9013 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
9014 AND p_x_header_rec.transaction_phase_code = 'N'
9015 AND NOT OE_GLOBALS.EQUAL(p_x_header_rec.expiration_date
9016 ,p_old_header_rec.expiration_date)
9017 THEN
9018
9019 -- Call WF API to re-set expiration date timer
9020 OE_Negotiate_WF.Offer_Date_Changed
9021 (p_header_id => p_x_header_rec.header_id
9022 ,x_return_status => l_return_status
9023 );
9024
9025 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
9026 RAISE FND_API.G_EXC_ERROR;
9027 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
9028 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9029 END IF;
9030
9031 END IF;
9032
9033 -- Sales Contract changes.
9034 -- Instantiate the contract template for the sales order for create
9035 -- operation.
9036
9037 IF p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE AND
9038 OE_CODE_CONTROL.Get_Code_Release_Level >= '110510' AND
9039 -- Do not instantiate for copied orders
9040 nvl(p_x_header_rec.source_document_type_id,-1) <> 2 AND
9041 (p_x_header_rec.contract_template_id IS NOT NULL OR
9042 p_x_header_rec.contract_source_doc_type_code IS NOT NULL OR
9043 p_x_header_rec.contract_source_document_id IS NOT NULL)
9044 THEN
9045
9046 IF p_x_header_rec.contract_source_doc_type_code IS NOT NULL AND
9047 p_x_header_rec.Contract_Template_Id IS NULL AND
9048 p_x_header_rec.contract_source_document_id IS NULL THEN
9049 fnd_message.set_name('ONT','OE_INVALID_CONTRACT_ATTR_COMB');
9050 OE_MSG_PUB.Add;
9051 END IF;
9052
9053 OE_CONTRACTS_UTIL.Copy_Doc(
9054 p_api_version => 1.0,
9055 p_init_msg_list => FND_API.G_FALSE,
9056 p_commit => FND_API.G_FALSE,
9057 p_source_doc_type => p_x_header_rec.contract_source_doc_type_code,
9058 p_source_doc_id => p_x_header_rec.contract_source_document_id,
9059 p_target_doc_type => 'O',
9060 p_target_doc_id => p_x_header_rec.header_id,
9061 p_contract_template_id => p_x_header_rec.contract_template_id,
9062 x_return_status => l_return_status,
9063 x_msg_count => l_msg_count,
9064 x_msg_data => l_msg_data
9065 );
9066
9067 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
9068 if l_debug_level > 0 then
9069 oe_debug_pub.ADD('OE_Header_Util.Post_Write unexp error in instantiate doc terms',1);
9070 end if;
9071 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9072 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
9073 if l_debug_level > 0 then
9074 oe_debug_pub.ADD('OE_Header_Util.Post_Write exp error in instantiate doc terms',1);
9075 end if;
9076 RAISE FND_API.G_EXC_ERROR;
9077 END IF;
9078
9079 END IF;
9080 oe_debug_pub.add('Post Write Process R12 CCE changes...'||p_x_header_rec.header_id);
9081 oe_debug_pub.add('Old header id'||p_old_header_rec.header_id);
9082 oe_debug_pub.add('payment type'||p_x_header_rec.payment_type_code);
9083 oe_debug_pub.add('card number'||p_x_header_rec.credit_Card_number);
9084 --If Bill to site is changed, then the payment record would
9085 --be deleted through the delayed request. So not calling
9086 --the process order if bill to site has changed.
9087 --bug 4885313
9088 IF NOT OE_GLOBALS.Equal(p_x_header_rec.invoice_to_org_id,p_old_header_rec.invoice_to_org_id)
9089 THEN
9090 --If the user has modified the bill to site and has entered a new
9091 --credit card before saving the record, then the global flag need
9092 --to be set to Y so that the current trxn extension id would be
9093 --deleted and a new one created (as the context has changed).
9094 oe_debug_pub.add('Old invoice to'||p_x_header_rec.invoice_to_org_id);
9095 oe_debug_pub.add('New invoice to'||p_old_header_rec.invoice_to_org_id);
9096 IF NOT OE_GLOBALS.Equal(p_old_header_rec.invoice_to_org_id,FND_API.G_MISS_NUM)
9097 AND p_old_header_rec.invoice_to_org_id IS NOT NULL AND
9098 p_x_header_rec.payment_type_code = 'CREDIT_CARD' THEN
9099 OE_Payment_Trxn_Util.g_old_bill_to_site := p_old_header_rec.invoice_to_org_id;
9100 END IF;
9101 oe_debug_pub.add('Bill to site changed in post_write_process'||OE_Payment_Trxn_Util.g_old_bill_to_site);
9102 END IF;
9103
9104 oe_debug_pub.add('Operatoin in post write...in header rec..'||p_x_header_rec.operation);
9105
9106 --R12 CC Encryption
9107 --As ACH and Direct Debit are not supported in Order Header Others tab
9108 --only Credit card payment type code is checked here.
9109 --Moreover, when the old payment type code is credit card, then need
9110 --to delete the trxn extension id created for this creditcard
9111 --When the old payment type is not null and the new one is null then
9112 --need to delete the payment record from oe_payments.
9113 IF( ( OE_GLOBALS.Equal(p_x_header_rec.payment_type_code, 'CREDIT_CARD') AND
9114 p_x_header_rec.credit_card_number is not null
9115 )
9116 OR (
9117 OE_GLOBALS.Equal(p_old_header_rec.payment_type_code,'CREDIT_CARD')
9118 )
9119 OR ( p_old_header_rec.payment_type_code IS NOT NULL AND
9120 p_x_header_rec.payment_type_code IS NULL
9121 ))
9122 AND --For copy orders, the CREATE operation need not call process order here
9123 ( --as the payment record would be inserted from oe_header_payment_util package.
9124 nvl(p_x_header_rec.source_document_type_id,-99) <> 2 OR
9125 ( --To create or update credit cards on copied orders
9126 nvl(p_x_header_rec.source_document_type_id,-99)=2 AND
9127 p_x_header_rec.operation=OE_GLOBALS.G_OPR_UPDATE
9128 )
9129 )
9130
9131 THEN
9132 BEGIN
9133 --For update operation, payment number needs to be set in
9134 --the payment record type as otherwise the process order
9135 --call was failing in Query_row procedure during update operation
9136 SELECT 'Y',payment_number,payment_type_code
9137 INTO l_payment_exists,l_payment_number,l_old_payment_type_code
9138 FROM oe_payments
9139 WHERE header_id = p_x_header_rec.header_id
9140 and line_id is null
9141 AND nvl(PAYMENT_COLLECTION_EVENT,'PREPAY') = 'INVOICE';
9142
9143 EXCEPTION
9144 WHEN NO_DATA_FOUND THEN
9145 l_payment_exists := 'N';
9146 END;
9147
9148 l_control_rec.controlled_operation := TRUE;
9149 l_control_rec.check_security := TRUE;
9150 l_control_rec.default_attributes := TRUE;
9151 l_control_rec.change_attributes := TRUE;
9152 l_control_rec.clear_dependents := FALSE;
9153 l_control_rec.validate_entity := FALSE;
9154 l_control_rec.write_to_DB := TRUE; --Verify
9155 l_control_rec.process := FALSE;
9156 l_control_rec.clear_api_cache := FALSE;
9157 l_control_rec.clear_api_requests := FALSE;
9158
9159 l_x_Header_Payment_tbl(1):=OE_ORDER_PUB.G_MISS_HEADER_PAYMENT_REC;
9160 l_x_old_Header_Payment_Tbl(1):=OE_ORDER_PUB.G_MISS_HEADER_PAYMENT_REC;
9161
9162 l_x_Header_Payment_tbl(1).header_id := p_x_header_rec.header_id;
9163 l_x_Header_Payment_tbl(1).payment_collection_event := 'INVOICE';
9164 l_x_Header_Payment_tbl(1).payment_level_code := 'ORDER';
9165 l_x_Header_Payment_tbl(1).credit_card_number := p_x_header_rec.credit_card_number;
9166 l_x_Header_Payment_tbl(1).credit_card_code := p_x_header_rec.credit_card_code;
9167 l_x_Header_Payment_tbl(1).credit_card_holder_name := p_x_header_rec.credit_card_holder_name;
9168 l_x_Header_Payment_tbl(1).credit_card_expiration_date := p_x_header_rec.credit_card_expiration_date;
9169 l_x_Header_Payment_tbl(1).credit_card_approval_code := p_x_header_rec.credit_card_approval_code;
9170 l_x_Header_Payment_tbl(1).credit_card_approval_date := p_x_header_rec.credit_card_approval_date;
9171 l_x_Header_Payment_tbl(1).payment_type_code := p_x_header_rec.payment_type_code;
9172 l_x_Header_Payment_tbl(1).CC_INSTRUMENT_ID := p_x_header_rec.CC_INSTRUMENT_ID;
9173 l_x_Header_Payment_tbl(1).CC_INSTRUMENT_ASSIGNMENT_ID := p_x_header_rec.CC_INSTRUMENT_ASSIGNMENT_ID;
9174 l_x_Header_Payment_tbl(1).instrument_security_code := p_x_header_rec.instrument_security_code;
9175 l_x_Header_Payment_tbl(1).payment_number := l_payment_number;
9176 l_x_Header_Payment_tbl(1).check_number := p_x_header_rec.check_number;
9177 oe_debug_pub.add('Old payment type'||l_old_payment_type_code);
9178 oe_debug_pub.add('New payment type'||p_x_header_rec.payment_type_code);
9179 oe_debug_pub.add('Header_id'||p_x_header_rec.header_id);
9180 /*IF NOT OE_GLOBALS.Equal(l_old_payment_type_code,p_x_header_rec.payment_type_code) THEN
9181 oe_debug_pub.add('ksurendr: Receipt method id in uhdrb post write'||l_x_Header_Payment_tbl(1).receipt_method_id);
9182 l_x_Header_Payment_tbl(1).receipt_method_id := FND_API.G_MISS_NUM;
9183 END IF;*/
9184
9185 --Verify
9186 IF l_payment_exists = 'Y' THEN
9187 --If the old payment type code is not null and the new payment type code
9188 --is null, then the payment record has been cleared by the user from the
9189 --Others tab and hence it is required to delete this record from oe_payments.
9190 IF l_old_payment_type_code IS NOT NULL
9191 AND p_x_header_rec.payment_type_code IS NULL THEN
9192 l_x_Header_Payment_tbl(1).operation := OE_GLOBALS.G_OPR_DELETE;
9193 -- bug 5035651
9194 ELSIF nvl(p_x_header_rec.cancelled_flag, 'N') <> 'Y' THEN
9195 l_x_Header_Payment_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
9196 ELSE
9197 l_x_Header_Payment_tbl(1).operation := NULL;
9198 END IF;
9199
9200 /*
9201 ELSE
9202 l_x_Header_Payment_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
9203 END IF;
9204 */
9205 ELSE
9206 l_x_Header_Payment_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
9207
9208 --bug 5258767
9209 --Only credit card payment types have the pre-payment records inserted
9210 --from this procedure. The other payment types are taken care by the
9211 --procedure Update_Hdr_Payment in Oe_Prepayment_Pvt.
9212 IF OE_GLOBALS.Equal(p_x_header_rec.payment_type_code, 'CREDIT_CARD') THEN
9213 --Need to check if the payment term present in the header
9214 --has the prepayment check box checked so as to insert the
9215 --prepayment record as well if the other conditions are
9216 --satisfied.
9217 BEGIN
9218 SELECT PAYMENT_TERM_ID,TRANSACTIONAL_CURR_CODE
9219 INTO l_payment_term_id,l_currency_code
9220 FROM OE_ORDER_HEADERS_ALL
9221 WHERE HEADER_ID = p_x_header_rec.header_id;
9222 EXCEPTION
9223 WHEN NO_DATA_FOUND THEN
9224 l_payment_term_id := NULL;
9225 END;
9226 IF l_debug_level > 0 THEN
9227 oe_debug_pub.add('OEXUHDRB post write: term id : ' || l_payment_term_id);
9228 END IF;
9229
9230 if l_payment_term_id is not null then
9231 l_prepayment_flag := AR_PUBLIC_UTILS.Check_Prepay_Payment_Term(l_payment_term_id);
9232 IF l_debug_level > 0 THEN
9233 oe_debug_pub.add('prepayment_flag is : ' || l_prepayment_flag );
9234 END IF;
9235 end if;
9236
9237 IF nvl(l_prepayment_flag,'N') = 'Y' THEN
9238 --Checking the count for prepayments and not inserting
9239 --the prepayment record if there is an existing prepayment
9240 --for this header.
9241 BEGIN
9242 SELECT count(*) INTO l_prepay_count
9243 FROM OE_PAYMENTS
9244 WHERE HEADER_ID = p_x_header_rec.header_id
9245 AND LINE_ID IS NULL AND
9246 NVL(PAYMENT_COLLECTION_EVENT,'PREPAY') = 'PREPAY';
9247 EXCEPTION
9248 WHEN NO_DATA_FOUND THEN
9249 l_prepay_count := 0;
9250 END;
9251
9252 IF l_debug_level > 0 THEN
9253 oe_debug_pub.add('OEXUHDRB post write: prepayment count...'||l_prepay_count);
9254 END IF;
9255
9256 --Since prepayments should not be allowed when there are line
9257 --payments, checking the line payments count before calling the
9258 --process order for inserting the prepayments.
9259 BEGIN
9260 SELECT COUNT(PAYMENT_TYPE_CODE) INTO l_line_payment_count
9261 FROM OE_PAYMENTS
9262 WHERE HEADER_ID = p_x_header_rec.header_id
9263 AND LINE_ID IS NOT NULL
9264 AND PAYMENT_TYPE_CODE <> 'COMMITMENT';
9265 EXCEPTION
9266 WHEN NO_DATA_FOUND THEN
9267 l_line_payment_count := 0;
9268 END;
9269
9270 IF l_debug_level > 0 THEN
9271 oe_debug_pub.add('OEXUHDRB post write: line payment count...'||l_line_payment_count);
9272 END IF;
9273
9274 --If prepayment count is zero, then need to insert an
9275 --additional prepayment record in Oe_Payments as the payment
9276 --term used has the prepayment check box checked
9277 IF nvl(l_prepay_count,0) = 0 and nvl(l_line_payment_count,0) = 0 THEN
9278 IF l_debug_level > 0 THEN
9279 oe_debug_pub.add('OEXUHDRB: Inside prepayment record insertion....'||l_prepay_count);
9280 oe_debug_pub.add('Payment number value...'||l_payment_number);
9281 oe_debug_pub.add('Header id ----> '||p_x_header_rec.header_id);
9282 END IF;
9283
9284 l_x_Header_Payment_tbl(2):=OE_ORDER_PUB.G_MISS_HEADER_PAYMENT_REC;
9285 l_x_old_Header_Payment_Tbl(2):=OE_ORDER_PUB.G_MISS_HEADER_PAYMENT_REC;
9286
9287 l_x_Header_Payment_tbl(2).header_id := p_x_header_rec.header_id;
9288 l_x_Header_Payment_tbl(2).payment_collection_event := 'PREPAY';
9289 l_x_Header_Payment_tbl(2).payment_level_code := 'ORDER';
9290 l_x_Header_Payment_tbl(2).credit_card_number := p_x_header_rec.credit_card_number;
9291 l_x_Header_Payment_tbl(2).credit_card_code := p_x_header_rec.credit_card_code;
9292 l_x_Header_Payment_tbl(2).credit_card_holder_name := p_x_header_rec.credit_card_holder_name;
9293 l_x_Header_Payment_tbl(2).credit_card_expiration_date := p_x_header_rec.credit_card_expiration_date;
9294 l_x_Header_Payment_tbl(2).credit_card_approval_code := p_x_header_rec.credit_card_approval_code;
9295 l_x_Header_Payment_tbl(2).credit_card_approval_date := p_x_header_rec.credit_card_approval_date;
9296 l_x_Header_Payment_tbl(2).payment_type_code := p_x_header_rec.payment_type_code;
9297 l_x_Header_Payment_tbl(2).CC_INSTRUMENT_ID := p_x_header_rec.CC_INSTRUMENT_ID;
9298 l_x_Header_Payment_tbl(2).CC_INSTRUMENT_ASSIGNMENT_ID := p_x_header_rec.CC_INSTRUMENT_ASSIGNMENT_ID;
9299 l_x_Header_Payment_tbl(2).instrument_security_code := p_x_header_rec.instrument_security_code;
9300 l_x_Header_Payment_tbl(2).payment_number := l_payment_number+1;
9301
9302
9303 OE_OE_TOTALS_SUMMARY.Order_Totals
9304 (
9305 p_header_id=>p_x_header_rec.header_id,
9306 p_subtotal =>l_subtotal,
9307 p_discount =>l_discount,
9308 p_charges =>l_charges,
9309 p_tax =>l_tax
9310 );
9311
9312 l_order_total := nvl(l_subtotal,0) + nvl(l_charges,0) + nvl(l_tax,0);
9313
9314 l_downpayment := oe_prepayment_util.get_downpayment_amount(
9315 p_header_id => p_x_header_rec.header_id,
9316 p_term_id => l_payment_term_id,
9317 p_curr_code => l_currency_code,
9318 p_order_total => l_order_total);
9319
9320 l_x_Header_Payment_tbl(2).payment_amount := l_downpayment;
9321
9322 IF l_debug_level > 0 THEN
9323 oe_debug_pub.add('Inside prepayment type'||l_old_payment_type_code);
9324 oe_debug_pub.add('New prepayment type'||p_x_header_rec.payment_type_code);
9325 oe_debug_pub.add('Header_id'||p_x_header_rec.header_id);
9326 END IF;
9327 l_x_Header_Payment_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;
9328 END IF;
9329 END IF;
9330 END IF;
9331 --bug 5258767
9332 END IF;
9333 oe_debug_pub.add('Operation to be performed....frm post write proces...'||l_x_Header_Payment_tbl(1).operation);
9334
9335 OE_Order_PVT.Header_Payments
9336 ( p_validation_level => FND_API.G_VALID_LEVEL_NONE
9337 , p_init_msg_list => FND_API.G_FALSE
9338 , p_control_rec => l_control_rec
9339 , p_x_Header_Payment_tbl => l_x_Header_Payment_tbl
9340 , p_x_old_Header_Payment_tbl => l_x_old_Header_Payment_tbl
9341 , x_return_Status => l_return_status
9342 );
9343 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
9344 RAISE FND_API.G_EXC_ERROR;
9345 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
9346 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9347 ELSIF l_return_Status = FND_API.G_RET_STS_SUCCESS THEN
9348 oe_debug_pub.add('Success in Header Payments call...');
9349 END IF;
9350 END IF;
9351 --R12 CC Encryption
9352 oe_debug_pub.add('Exiting OE_HEADER_UTIL.Post_Write_Process',1);
9353 EXCEPTION
9354 WHEN FND_API.G_EXC_ERROR THEN
9355 RAISE FND_API.G_EXC_ERROR;
9356 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
9357 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9358 WHEN OTHERS THEN
9359 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
9360 THEN
9361 OE_MSG_PUB.Add_Exc_Msg
9362 ( G_PKG_NAME
9363 , 'Post_Write_Process'
9364 );
9365 END IF;
9366 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9367 END Post_Write_Process;
9368
9369
9370 Procedure Validate_gapless_seq( p_application_id IN NUMBER,
9371 p_entity_short_name in VARCHAR2,
9372 p_validation_entity_short_name in VARCHAR2,
9373 p_validation_tmplt_short_name in VARCHAR2,
9374 p_record_set_tmplt_short_name in VARCHAR2,
9375 p_scope in VARCHAR2,
9376 p_result OUT NOCOPY /* file.sql.39 change */ NUMBER )
9377 IS
9378 ltype VARCHAR2(1);
9379 l_header_id NUMBER := oe_header_security.g_record.header_id;
9380 l_order_type_id NUMBER;
9381 l_transaction_phase_code VARCHAR2(1)
9382 := oe_header_security.g_record.transaction_phase_code;
9383 BEGIN
9384
9385 oe_debug_pub.add('Entering OR_HEADER_UTIL.Validate_Gapless_Seq',1);
9386
9387 select order_type_id into
9388 l_order_type_id
9389 from oe_order_headers_all
9390 where header_id = l_header_id;
9391
9392 ltype := Get_ord_seq_type(l_order_type_id,l_transaction_phase_code);
9393
9394 IF ltype = 'G' THEN
9395 p_result := 1;
9396 ELSE
9397 p_result := 0;
9398 END IF;
9399
9400 EXCEPTION
9401
9402 when no_data_found then
9403 p_result := 1;
9404
9405 End Validate_gapless_seq;
9406
9407 PROCEDURE get_customer_details
9408 ( p_org_id IN NUMBER
9409 , p_site_use_code IN VARCHAR2
9410 , x_customer_name OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9411 , x_customer_number OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9412 , x_customer_id OUT NOCOPY /* file.sql.39 change */ number
9413 , x_location OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9414 , x_address1 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9415 , x_address2 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9416 , x_address3 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9417 , x_address4 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9418 , x_city OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9419 , x_state OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9420 , x_zip OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9421 , x_country OUT NOCOPY /* file.sql.39 change */ VARCHAR2
9422 )
9423
9424 IS
9425 BEGIN
9426
9427 IF p_org_id is NOT NULL THEN
9428
9429 SELECT /*MOAC_SQL_CHANGE*/ cust.cust_account_id,
9430 party.party_name,
9431 cust.account_number,
9432 site.location,
9433 loc.address1,
9434 loc.address2,
9435 loc.address3,
9436 loc.address4,
9437 loc.city,
9438 nvl(loc.state,loc.province), --3603600
9439 loc.postal_code,
9440 loc.country
9441 INTO x_customer_id,
9442 x_customer_name,
9443 x_customer_number,
9444 x_location,
9445 x_address1,
9446 x_address2,
9447 x_address3,
9448 x_address4,
9449 x_city,
9450 x_state,
9451 x_zip,
9452 x_country
9453 FROM HZ_CUST_SITE_USES_ALL site,
9454 HZ_CUST_ACCT_SITES cas,
9455 hz_cust_accounts cust,
9456 hz_parties party,
9457 hz_party_sites ps,
9458 hz_locations loc
9459 WHERE site.cust_acct_site_id=cas.cust_acct_site_id
9460 AND site.site_use_code=p_site_use_code
9461 AND site.site_use_id=p_org_id
9462 AND cust.cust_account_id = cas.cust_account_id
9463 AND cas.party_site_id = ps.party_site_id
9464 AND ps.location_id = loc.location_id
9465 AND party.party_id = cust.party_id;
9466
9467 ELSE
9468
9469 x_customer_name := NULL ;
9470 x_customer_number := NULL ;
9471 x_customer_id := NULL ;
9472 x_location := NULL;
9473 x_address1 := nULL;
9474 x_address2 := nULL;
9475 x_address3 := nULL;
9476 x_address4 := nULL;
9477 x_city := nULL;
9478 x_state := nULL;
9479 x_zip := nULL;
9480 x_country := nULL;
9481
9482 END IF;
9483
9484 EXCEPTION
9485
9486 WHEN NO_DATA_FOUND THEN
9487
9488 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
9489 THEN
9490
9491 fnd_message.set_name('ONT','OE_ID_TO_VALUE_ERROR');
9492 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','get_customer_details');
9493 OE_MSG_PUB.Add;
9494
9495 END IF;
9496
9497
9498 WHEN OTHERS THEN
9499
9500 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
9501 THEN
9502 OE_MSG_PUB.Add_Exc_Msg
9503 ( G_PKG_NAME
9504 , 'get_customer_details'
9505 );
9506 END IF;
9507
9508 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9509
9510 END get_customer_details;
9511
9512 -- This procedure deletes all the header level charges when the order/all the lines are cancelled
9513
9514 PROCEDURE cancel_header_charges
9515 ( p_header_id IN number ,
9516 -- p_x_line_id IN number,
9517 x_return_status OUT NOCOPY varchar2
9518 )
9519 IS
9520 l_total_quantity NUMBER;
9521 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
9522
9523 BEGIN
9524
9525 SELECT sum(ordered_quantity) into l_total_quantity from
9526 OE_ORDER_LINES where header_id = p_header_id;
9527
9528 IF l_total_quantity =0 THEN
9529 OE_Header_Adj_Util.Delete_Header_Charges( p_header_id => p_header_id );
9530 END IF;
9531
9532 EXCEPTION
9533
9534 WHEN FND_API.G_EXC_ERROR THEN
9535 x_return_status := FND_API.G_RET_STS_ERROR;
9536
9537 WHEN OTHERS THEN
9538 IF l_debug_level > 0 THEN
9539 oe_debug_pub.add( 'UNEXPECTED ERROR IN ' || G_PKG_NAME || ':' || 'PERFORM_LINE_CANCEL' ) ;
9540 x_return_status := FND_API.G_RET_STS_ERROR;
9541 END IF;
9542 END;
9543
9544 --For bug 3563983
9545 --Changed the Function name from Blanket_Req_For_Curr_Update
9546 --Added code to mask logging Validate shipment and Incrementing amounts for delete
9547
9548 PROCEDURE Blkt_Req_For_Curr_Upd_And_Del
9549 (p_header_rec IN OE_Order_PUB.Header_Rec_Type
9550 ,p_old_header_rec IN OE_Order_PUB.Header_Rec_Type
9551 )
9552 IS
9553
9554 CURSOR lines IS
9555 SELECT line_id
9556 ,blanket_number
9557 ,blanket_line_number
9558 ,ordered_quantity
9559 ,order_quantity_uom
9560 ,inventory_item_id
9561 ,unit_selling_price
9562 ,fulfilled_flag
9563 ,line_set_id
9564 FROM OE_ORDER_LINES
9565 WHERE HEADER_ID = p_header_rec.header_id
9566 AND BLANKET_NUMBER IS NOT NULL;
9567
9568 l_return_status VARCHAR2(1);
9569
9570 BEGIN
9571
9572 -- BUG 2746595, send currency code as request_unique_key1 parameter to
9573 -- process release request. This is required as 2 distinct requests need to
9574 -- be logged for currency updates.
9575
9576 -- For all release lines i.e. lines with a blanket reference
9577 -- , log delayed requests to update amounts based on the new currency
9578 FOR c IN lines LOOP
9579
9580 -- Request to decrement amounts based on old currency code
9581 OE_Delayed_Requests_Pvt.Log_Request
9582 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL
9583 ,p_entity_id => c.line_id
9584 ,p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER
9585 ,p_requesting_entity_id => p_header_rec.header_id
9586 ,p_request_type => OE_GLOBALS.G_PROCESS_RELEASE
9587 -- Old values
9588 ,p_param1 => c.blanket_number
9589 ,p_param2 => c.blanket_line_number
9590 ,p_param3 => c.ordered_quantity
9591 ,p_param4 => c.order_quantity_uom
9592 ,p_param5 => c.unit_selling_price
9593 ,p_param6 => c.inventory_item_id
9594 -- New values
9595 ,p_param11 => null
9596 ,p_param12 => null
9597 ,p_param13 => 0
9598 ,p_param14 => null
9599 ,p_param15 => 0
9600 ,p_param16 => null
9601 -- Other parameters - old currency code here
9602 ,p_param8 => c.fulfilled_flag
9603 ,p_param9 => c.line_set_id
9604 ,p_request_unique_key1 => p_old_header_rec.transactional_curr_code
9605 ,x_return_status => l_return_status
9606 );
9607 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9608 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9609 END IF;
9610
9611 --For bug 3563983
9612 IF p_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
9613 THEN
9614 -- Request to increment amounts based on new currency code
9615 OE_Delayed_Requests_Pvt.Log_Request
9616 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL
9617 ,p_entity_id => c.line_id
9618 ,p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER
9619 ,p_requesting_entity_id => p_header_rec.header_id
9620 ,p_request_type => OE_GLOBALS.G_PROCESS_RELEASE
9621 -- Old values
9622 ,p_param1 => null
9623 ,p_param2 => null
9624 ,p_param3 => 0
9625 ,p_param4 => null
9626 ,p_param5 => 0
9627 ,p_param6 => null
9628 -- New values
9629 ,p_param11 => c.blanket_number
9630 ,p_param12 => c.blanket_line_number
9631 ,p_param13 => c.ordered_quantity
9632 ,p_param14 => c.order_quantity_uom
9633 ,p_param15 => c.unit_selling_price
9634 ,p_param16 => c.inventory_item_id
9635 -- Other parameters - new currency code here
9636 ,p_param8 => c.fulfilled_flag
9637 ,p_param9 => c.line_set_id
9638 ,p_request_unique_key1 => p_header_rec.transactional_curr_code
9639 ,x_return_status => l_return_status
9640 );
9641
9642
9643 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9644 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9645 END IF;
9646
9647 -- For shipment lines, also log requests to validate that
9648 -- sum of amounts across all shipments in the line set are
9649 -- within release min/max limits set on blanket line
9650 IF c.line_set_id IS NOT NULL THEN
9651
9652 OE_Delayed_Requests_Pvt.Log_Request
9653 (p_entity_code => OE_GLOBALS.G_ENTITY_ALL
9654 ,p_entity_id => c.line_set_id
9655 ,p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE
9656 ,p_requesting_entity_id => c.line_id
9657 ,p_request_type => OE_GLOBALS.G_VALIDATE_RELEASE_SHIPMENTS
9658 ,p_request_unique_key1 => c.blanket_number
9659 ,p_request_unique_key2 => c.blanket_line_number
9660 ,p_param1 =>
9661 p_header_rec.transactional_curr_code
9662 ,x_return_status => l_return_status
9663 );
9664 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9665 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9666 END IF;
9667
9668 END IF;
9669
9670 END IF;
9671
9672 END LOOP;
9673
9674 EXCEPTION
9675
9676 WHEN OTHERS THEN
9677
9678 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
9679 THEN
9680 OE_MSG_PUB.Add_Exc_Msg
9681 ( G_PKG_NAME
9682 , 'Blkt_Req_For_Curr_Upd_And_Del'
9683 );
9684 END IF;
9685
9686 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
9687
9688 END Blkt_Req_For_Curr_Upd_And_Del;
9689 END OE_Header_Util;