DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGC_CC_PO_LINES_ALL_PVT

Source


1 PACKAGE BODY IGC_CC_PO_LINES_ALL_PVT AS
2 /*$Header: IGCCPLNB.pls 120.4.12000000.1 2007/08/20 12:14:14 mbremkum ship $*/
3 
4   G_PKG_NAME CONSTANT VARCHAR2(30):= 'IGC_CC_PO_LINES_ALL_PVT';
5 
6   -- The flag determines whether to print debug information or not.
7   g_debug_flag        VARCHAR2(1) := 'N' ;
8 
9 /*=======================================================================+
10  |                       PROCEDURE Insert_Row                            |
11  +=======================================================================*/
12 PROCEDURE Insert_Row
13 (
14   p_api_version               IN       NUMBER,
15   p_init_msg_list             IN       VARCHAR2 := FND_API.G_FALSE,
16   p_commit                    IN       VARCHAR2 := FND_API.G_FALSE,
17   p_validation_level          IN       NUMBER   := FND_API.G_VALID_LEVEL_FULL,
18   x_return_status             OUT NOCOPY      VARCHAR2,
19   x_msg_count                 OUT NOCOPY      NUMBER,
20   x_msg_data                  OUT NOCOPY      VARCHAR2,
21   ---------------------------------------------
22   p_po_lines_rec              IN       po_lines_all%ROWTYPE
23 )
24 IS
25 
26 	l_api_name            CONSTANT VARCHAR2(30)   := 'Insert_Row';
27 	l_api_version         CONSTANT NUMBER         :=  1.0;
28 
29 BEGIN
30 
31 	SAVEPOINT Insert_Row_Pvt ;
32 
33 	IF NOT FND_API.Compatible_API_Call ( l_api_version,
34                                              p_api_version,
35                                              l_api_name,
36                                              G_PKG_NAME )
37 	THEN
38 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
39 	END IF;
40 
41 
42 	IF FND_API.to_Boolean ( p_init_msg_list )
43 	THEN
44 		FND_MSG_PUB.initialize ;
45 	END IF;
46 
47 	x_return_status := FND_API.G_RET_STS_SUCCESS ;
48 
49 	INSERT INTO po_lines_all (
50 	po_line_id,
51 	last_update_date,
52 	last_updated_by,
53 	po_header_id ,
54 	line_type_id,
55         -- bug 4097669, start 1
56         order_type_lookup_code,
57         purchase_basis,
58         matching_basis,
59         -- bug 4097669, end 1
60 	line_num,
61 	last_update_login,
62 	creation_date,
63 	created_by,
64 	item_id,
65 	item_revision,
66 	category_id,
67 	item_description ,
68 	unit_meas_lookup_code,
69 	quantity_committed,
70 	committed_amount,
71 	allow_price_override_flag,
72 	not_to_exceed_price,
73 	list_price_per_unit,
74 	unit_price,
75 	quantity,
76 	un_number_id,
77 	hazard_class_id,
78 	note_to_vendor,
79 	from_header_id,
80 	from_line_id,
81 	min_order_quantity,
82 	max_order_quantity,
83 	qty_rcv_tolerance,
84 	over_tolerance_error_flag,
85 	market_price,
86 	unordered_flag,
87 	closed_flag,
88 	user_hold_flag ,
89 	cancel_flag,
90 	cancelled_by,
91 	cancel_date,
92 	cancel_reason ,
93 	firm_status_lookup_code,
94 	firm_date,
95 	vendor_product_num,
96 	contract_num,
97 	taxable_flag,
98 	tax_name,
99 	type_1099 ,
100 	capital_expense_flag,
101 	negotiated_by_preparer_flag,
102 	attribute_category,
103 	attribute1 ,
104 	attribute2 ,
105 	attribute3,
106 	attribute4 ,
107 	attribute5,
108 	attribute6,
109 	attribute7 ,
110 	attribute8,
111 	attribute9 ,
112 	attribute10,
113 	reference_num ,
114 	attribute11,
115 	attribute12,
116 	attribute13,
117 	attribute14 ,
118 	attribute15,
119 	min_release_amount,
120 	price_type_lookup_code,
121 	closed_code,
122 	price_break_lookup_code,
123 	ussgl_transaction_code,
124 	government_context,
125 	request_id,
126 	program_application_id,
127 	program_id ,
128 	program_update_date,
129 	closed_date,
130 	closed_reason,
131 	closed_by,
132 	transaction_reason_code,
133 	org_id,
134 	qc_grade,
135 	base_uom,
136 	base_qty,
137 	secondary_uom,
138 	secondary_qty,
139 	global_attribute_category,
140 	global_attribute1 ,
141 	global_attribute2,
142 	global_attribute3,
143 	global_attribute4,
144 	global_attribute5,
145 	global_attribute6,
146 	global_attribute7,
147 	global_attribute8,
148 	global_attribute9,
149 	global_attribute10,
150 	global_attribute11,
151 	global_attribute12,
152 	global_attribute13,
153 	global_attribute14,
154 	global_attribute15,
155 	global_attribute16,
156 	global_attribute17,
157 	global_attribute18,
158 	global_attribute19,
159 	global_attribute20,
160 	line_reference_num,
161 	project_id,
162 	task_id,
163 	expiration_date,
164 	tax_code_id)
165 	VALUES
166 	(p_po_lines_rec.po_line_id,
167 	p_po_lines_rec.last_update_date,
168 	p_po_lines_rec.last_updated_by,
169 	p_po_lines_rec.po_header_id ,
170 	p_po_lines_rec.line_type_id,
171         -- bug 4097669, start 2
172         p_po_lines_rec.order_type_lookup_code,
173         p_po_lines_rec.purchase_basis,
174         p_po_lines_rec.matching_basis,
175         -- bug 4097669, end 2
176 	p_po_lines_rec.line_num,
177 	p_po_lines_rec.last_update_login,
178 	p_po_lines_rec.creation_date,
179 	p_po_lines_rec.created_by,
180 	p_po_lines_rec.item_id,
181 	p_po_lines_rec.item_revision,
182 	p_po_lines_rec.category_id,
183 	p_po_lines_rec.item_description ,
184 	p_po_lines_rec.unit_meas_lookup_code,
185 	p_po_lines_rec.quantity_committed,
186 	p_po_lines_rec.committed_amount,
187 	p_po_lines_rec.allow_price_override_flag,
188 	p_po_lines_rec.not_to_exceed_price,
189 	p_po_lines_rec.list_price_per_unit,
190 	p_po_lines_rec.unit_price,
191 	p_po_lines_rec.quantity,
192 	p_po_lines_rec.un_number_id,
193 	p_po_lines_rec.hazard_class_id,
194 	p_po_lines_rec.note_to_vendor,
195 	p_po_lines_rec.from_header_id,
196 	p_po_lines_rec.from_line_id,
197 	p_po_lines_rec.min_order_quantity,
198 	p_po_lines_rec.max_order_quantity,
199 	p_po_lines_rec.qty_rcv_tolerance,
200 	p_po_lines_rec.over_tolerance_error_flag,
201 	p_po_lines_rec.market_price,
202 	p_po_lines_rec.unordered_flag,
203 	p_po_lines_rec.closed_flag,
204 	p_po_lines_rec.user_hold_flag ,
205 	p_po_lines_rec.cancel_flag,
206 	p_po_lines_rec.cancelled_by,
207 	p_po_lines_rec.cancel_date,
208 	p_po_lines_rec.cancel_reason ,
209 	p_po_lines_rec.firm_status_lookup_code,
210 	p_po_lines_rec.firm_date,
211 	p_po_lines_rec.vendor_product_num,
212 	p_po_lines_rec.contract_num,
213 	p_po_lines_rec.taxable_flag,
214 	p_po_lines_rec.tax_name,
215 	p_po_lines_rec.type_1099 ,
216 	p_po_lines_rec.capital_expense_flag,
217 	p_po_lines_rec.negotiated_by_preparer_flag,
218 	p_po_lines_rec.attribute_category,
219 	p_po_lines_rec.attribute1 ,
220 	p_po_lines_rec.attribute2 ,
221 	p_po_lines_rec.attribute3,
222 	p_po_lines_rec.attribute4 ,
223 	p_po_lines_rec.attribute5,
224 	p_po_lines_rec.attribute6,
225 	p_po_lines_rec.attribute7 ,
226 	p_po_lines_rec.attribute8,
227 	p_po_lines_rec.attribute9 ,
228 	p_po_lines_rec.attribute10,
229 	p_po_lines_rec.reference_num ,
230 	p_po_lines_rec.attribute11,
231 	p_po_lines_rec.attribute12,
232 	p_po_lines_rec.attribute13,
233 	p_po_lines_rec.attribute14 ,
234 	p_po_lines_rec.attribute15,
235 	p_po_lines_rec.min_release_amount,
236 	p_po_lines_rec.price_type_lookup_code,
237 	p_po_lines_rec.closed_code,
238 	p_po_lines_rec.price_break_lookup_code,
239 	p_po_lines_rec.ussgl_transaction_code,
240 	p_po_lines_rec.government_context,
241 	p_po_lines_rec.request_id,
242 	p_po_lines_rec.program_application_id,
243 	p_po_lines_rec.program_id ,
244 	p_po_lines_rec.program_update_date,
245 	p_po_lines_rec.closed_date,
246 	p_po_lines_rec.closed_reason,
247 	p_po_lines_rec.closed_by,
248 	p_po_lines_rec.transaction_reason_code,
249 	p_po_lines_rec.org_id,
250 	p_po_lines_rec.qc_grade,
251 	p_po_lines_rec.base_uom,
252 	p_po_lines_rec.base_qty,
253 	p_po_lines_rec.secondary_uom,
254 	p_po_lines_rec.secondary_qty,
255 	p_po_lines_rec.global_attribute_category,
256 	p_po_lines_rec.global_attribute1 ,
257 	p_po_lines_rec.global_attribute2,
258 	p_po_lines_rec.global_attribute3,
259 	p_po_lines_rec.global_attribute4,
260 	p_po_lines_rec.global_attribute5,
261 	p_po_lines_rec.global_attribute6,
262 	p_po_lines_rec.global_attribute7,
263 	p_po_lines_rec.global_attribute8,
264 	p_po_lines_rec.global_attribute9,
265 	p_po_lines_rec.global_attribute10,
266 	p_po_lines_rec.global_attribute11,
267 	p_po_lines_rec.global_attribute12,
268 	p_po_lines_rec.global_attribute13,
269 	p_po_lines_rec.global_attribute14,
270 	p_po_lines_rec.global_attribute15,
271 	p_po_lines_rec.global_attribute16,
272 	p_po_lines_rec.global_attribute17,
273 	p_po_lines_rec.global_attribute18,
274 	p_po_lines_rec.global_attribute19,
275 	p_po_lines_rec.global_attribute20,
276 	p_po_lines_rec.line_reference_num,
277 	p_po_lines_rec.project_id,
278 	p_po_lines_rec.task_id,
279 	p_po_lines_rec.expiration_date,
280 	p_po_lines_rec.tax_code_id);
281 
282 	IF FND_API.To_Boolean ( p_commit )
283 	THEN
284 		COMMIT WORK;
285 	END IF;
286 
287 	FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
288                                     p_data  => x_msg_data );
289 
290 EXCEPTION
291 
292 	WHEN FND_API.G_EXC_ERROR
293 	THEN
294 
295 		ROLLBACK TO Insert_Row_Pvt ;
296 		x_return_status := FND_API.G_RET_STS_ERROR;
297 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
298                                             p_data  => x_msg_data );
299 
300 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR
301 	THEN
302 		ROLLBACK TO Insert_Row_Pvt ;
303 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
304 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
305                                 	    p_data  => x_msg_data );
306 
307 	WHEN OTHERS
308 	THEN
309 		ROLLBACK TO Insert_Row_Pvt ;
310 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
311 
312 		IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
313 		THEN
314 			FND_MSG_PUB.Add_Exc_Msg ( G_PKG_NAME,
315                                                   l_api_name);
316 		END IF;
317 
318 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
319                                             p_data  => x_msg_data );
320 
321 END Insert_Row;
322 /*-------------------------------------------------------------------------*/
323 
324 /*==========================================================================+
325  |                       PROCEDURE Update_Row                               |
326  +==========================================================================*/
327 PROCEDURE Update_Row
328 (
329   p_api_version               IN       NUMBER,
330   p_init_msg_list             IN       VARCHAR2 := FND_API.G_FALSE,
331   p_commit                    IN       VARCHAR2 := FND_API.G_FALSE,
332   p_validation_level          IN       NUMBER   := FND_API.G_VALID_LEVEL_FULL,
333   x_return_status             OUT NOCOPY      VARCHAR2,
334   x_msg_count                 OUT NOCOPY      NUMBER,
335   x_msg_data                  OUT NOCOPY      VARCHAR2,
336   ---------------------------------------------
337   p_po_lines_rec              IN       po_lines_all%ROWTYPE
338 
339 )
340 IS
341 
342 	l_api_name            CONSTANT VARCHAR2(30)   := 'Update_Row';
343 	l_api_version         CONSTANT NUMBER         :=  1.0;
344 
345 BEGIN
346 
347 	SAVEPOINT Update_Row_Pvt ;
348 
349 	IF NOT FND_API.Compatible_API_Call ( l_api_version,
350                                              p_api_version,
351                                              l_api_name,
352                                              G_PKG_NAME )
353 	THEN
354 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
355 	END IF;
356 
357 
358 	IF FND_API.to_Boolean ( p_init_msg_list )
359 	THEN
360 		FND_MSG_PUB.initialize ;
361 	END IF;
362 
363 	x_return_status := FND_API.G_RET_STS_SUCCESS ;
364 
365         /* update */
366 
367 	UPDATE po_lines_all
368         SET
369 		po_line_id                     = p_po_lines_rec.po_line_id,
370 		last_update_date               = p_po_lines_rec.last_update_date,
371 		last_updated_by                = p_po_lines_rec.last_updated_by,
372 		po_header_id                   = p_po_lines_rec.po_header_id ,
373 		line_type_id                   = p_po_lines_rec.line_type_id,
374 		line_num                       = p_po_lines_rec.line_num,
375 		last_update_login              = p_po_lines_rec.last_update_login,
376 		creation_date                  = p_po_lines_rec.creation_date,
377 		created_by                     = p_po_lines_rec.created_by,
378 		item_id                        = p_po_lines_rec.item_id,
379 		item_revision                  = p_po_lines_rec.item_revision,
380 		category_id                    = p_po_lines_rec.category_id,
381 		item_description               = p_po_lines_rec.item_description ,
382 		unit_meas_lookup_code          = p_po_lines_rec.unit_meas_lookup_code,
383 		quantity_committed             = p_po_lines_rec.quantity_committed,
384 		committed_amount               = p_po_lines_rec.committed_amount,
385 		allow_price_override_flag      = p_po_lines_rec.allow_price_override_flag,
386 		not_to_exceed_price            = p_po_lines_rec.not_to_exceed_price,
387 		list_price_per_unit            = p_po_lines_rec.list_price_per_unit,
388 		unit_price                     = p_po_lines_rec.unit_price,
389 		quantity                       = p_po_lines_rec.quantity,
390 		un_number_id                   = p_po_lines_rec.un_number_id,
391 		hazard_class_id                = p_po_lines_rec.hazard_class_id,
392 		note_to_vendor                 = p_po_lines_rec.note_to_vendor,
393 		from_header_id                 = p_po_lines_rec.from_header_id,
394 		from_line_id                   = p_po_lines_rec.from_line_id,
395 		min_order_quantity             = p_po_lines_rec.min_order_quantity,
396 		max_order_quantity             = p_po_lines_rec.max_order_quantity,
397 		qty_rcv_tolerance              = p_po_lines_rec.qty_rcv_tolerance,
398 		over_tolerance_error_flag      = p_po_lines_rec.over_tolerance_error_flag,
399 		market_price                   = p_po_lines_rec.market_price,
400 		unordered_flag                 = p_po_lines_rec.unordered_flag,
401 		closed_flag                    = p_po_lines_rec.closed_flag,
402 		user_hold_flag                 = p_po_lines_rec.user_hold_flag ,
403 		cancel_flag                    = p_po_lines_rec.cancel_flag,
404 		cancelled_by                   = p_po_lines_rec.cancelled_by,
405 		cancel_date                    = p_po_lines_rec.cancel_date,
406 		cancel_reason                  = p_po_lines_rec.cancel_reason ,
407 		firm_status_lookup_code        = p_po_lines_rec.firm_status_lookup_code,
408 		firm_date                      = p_po_lines_rec.firm_date,
409 		vendor_product_num             = p_po_lines_rec.vendor_product_num,
410 		contract_num                   = p_po_lines_rec.contract_num,
411 		taxable_flag                   = p_po_lines_rec.taxable_flag,
412 		tax_name                       = p_po_lines_rec.tax_name,
413 		type_1099                      = p_po_lines_rec.type_1099 ,
414 		capital_expense_flag           = p_po_lines_rec.capital_expense_flag,
415 		negotiated_by_preparer_flag    = p_po_lines_rec.negotiated_by_preparer_flag,
416 		attribute_category             = p_po_lines_rec.attribute_category,
417 		attribute1                     = p_po_lines_rec.attribute1 ,
418 		attribute2                     = p_po_lines_rec.attribute2 ,
419 		attribute3                     = p_po_lines_rec.attribute3,
420 		attribute4                     = p_po_lines_rec.attribute4 ,
421 		attribute5                     = p_po_lines_rec.attribute5,
422 		attribute6                     = p_po_lines_rec.attribute6,
423 		attribute7                     = p_po_lines_rec.attribute7 ,
424 		attribute8                     = p_po_lines_rec.attribute8,
425 		attribute9                     = p_po_lines_rec.attribute9 ,
426 		attribute10                    = p_po_lines_rec.attribute10,
427 		reference_num                  = p_po_lines_rec.reference_num ,
428 		attribute11                    = p_po_lines_rec.attribute11,
429 		attribute12                    = p_po_lines_rec.attribute12,
430 		attribute13                    = p_po_lines_rec.attribute13,
431 		attribute14                    = p_po_lines_rec.attribute14 ,
432 		attribute15                    = p_po_lines_rec.attribute15,
433 		min_release_amount             = p_po_lines_rec.min_release_amount,
434 		price_type_lookup_code         = p_po_lines_rec.price_type_lookup_code,
435 		closed_code                    = p_po_lines_rec.closed_code,
436 		price_break_lookup_code        = p_po_lines_rec.price_break_lookup_code,
437 		ussgl_transaction_code         = p_po_lines_rec.ussgl_transaction_code,
438 		government_context             = p_po_lines_rec.government_context,
439 		request_id                     = p_po_lines_rec.request_id,
440 		program_application_id         = p_po_lines_rec.program_application_id,
441 		program_id                     = p_po_lines_rec.program_id ,
442 		program_update_date            = p_po_lines_rec.program_update_date,
443 		closed_date                    = p_po_lines_rec.closed_date,
444 		closed_reason                  = p_po_lines_rec.closed_reason,
445 		closed_by                      = p_po_lines_rec.closed_by,
446 		transaction_reason_code        = p_po_lines_rec.transaction_reason_code,
447 		org_id                         = p_po_lines_rec.org_id,
448 		qc_grade                       = p_po_lines_rec.qc_grade,
449 		base_uom                       = p_po_lines_rec.base_uom,
450 		base_qty                       = p_po_lines_rec.base_qty,
451 		secondary_uom                  = p_po_lines_rec.secondary_uom,
452 		secondary_qty                  = p_po_lines_rec.secondary_qty,
453 		global_attribute_category      = p_po_lines_rec.global_attribute_category,
454 		global_attribute1              = p_po_lines_rec.global_attribute1 ,
455 		global_attribute2              = p_po_lines_rec.global_attribute2,
456 		global_attribute3              = p_po_lines_rec.global_attribute3,
457 		global_attribute4              = p_po_lines_rec.global_attribute4,
458 		global_attribute5              = p_po_lines_rec.global_attribute5,
459 		global_attribute6              = p_po_lines_rec.global_attribute6,
460 		global_attribute7              = p_po_lines_rec.global_attribute7,
461 		global_attribute8              = p_po_lines_rec.global_attribute8,
462 		global_attribute9              = p_po_lines_rec.global_attribute9,
463 		global_attribute10             = p_po_lines_rec.global_attribute10,
464 		global_attribute11             = p_po_lines_rec.global_attribute11,
465 		global_attribute12             = p_po_lines_rec.global_attribute12,
466 		global_attribute13             = p_po_lines_rec.global_attribute13,
467 		global_attribute14             = p_po_lines_rec.global_attribute14,
468 		global_attribute15             = p_po_lines_rec.global_attribute15,
469 		global_attribute16             = p_po_lines_rec.global_attribute16,
470 		global_attribute17             = p_po_lines_rec.global_attribute17,
471 		global_attribute18             = p_po_lines_rec.global_attribute18,
472 		global_attribute19             = p_po_lines_rec.global_attribute19,
473 		global_attribute20             = p_po_lines_rec.global_attribute20,
474 		line_reference_num             = p_po_lines_rec.line_reference_num,
475 		project_id                     = p_po_lines_rec.project_id,
476 		task_id                        = p_po_lines_rec.task_id,
477 		expiration_date                = p_po_lines_rec.expiration_date,
478 		tax_code_id                    = p_po_lines_rec.tax_code_id
479 	WHERE
480 		po_line_id = p_po_lines_rec.po_line_id;
481 
482 	IF (SQL%NOTFOUND)
483 	THEN
484 		RAISE NO_DATA_FOUND ;
485 	END IF;
486 
487 
488 	IF FND_API.To_Boolean ( p_commit )
489 	THEN
490 		COMMIT WORK;
491 	END IF;
492 
493 	FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
494                                     p_data  => x_msg_data );
495 
496 EXCEPTION
497 
498 	WHEN FND_API.G_EXC_ERROR
499 	THEN
500 		ROLLBACK TO Update_Row_Pvt ;
501 		x_return_status := FND_API.G_RET_STS_ERROR;
502 
503 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
504                                             p_data  => x_msg_data );
505 
506 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR
507 	THEN
508 
509 		ROLLBACK TO Update_Row_Pvt ;
510 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
511 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
512                                             p_data  => x_msg_data );
513 
514 	WHEN OTHERS
515 	THEN
516 
517 		ROLLBACK TO Update_Row_Pvt ;
518 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
519 
520 		IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
521 		THEN
522 			FND_MSG_PUB.Add_Exc_Msg ( G_PKG_NAME,
523                                                   l_api_name);
524 		END IF;
525 
526 		FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
527                                             p_data  => x_msg_data );
528 
529 END Update_Row;
530 /* ----------------------------------------------------------------------- */
531 
532 END IGC_CC_PO_LINES_ALL_PVT;