DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_ASL_DOCUMENTS_THS

Source


1 PACKAGE BODY PO_ASL_DOCUMENTS_THS as
2 /* $Header: POXA9LSB.pls 120.1 2007/12/12 09:05:26 irasoolm ship $ */
3 
4 /*=============================================================================
5 
6   PROCEDURE NAME:	insert_row()
7 
8 ===============================================================================*/
9 procedure insert_row(
10 	x_row_id		  IN OUT NOCOPY 	VARCHAR2,
11 	x_asl_id		  		NUMBER,
12 	x_using_organization_id   		NUMBER,
13 	x_sequence_num				NUMBER,
14 	x_document_type_code			VARCHAR2,
15 	x_document_header_id			NUMBER,
16 	x_document_line_id			NUMBER,
17 	x_last_update_date	  		DATE,
18 	x_last_updated_by	  		NUMBER,
19 	x_creation_date		  		DATE,
20 	x_created_by		  		NUMBER,
21 	x_attribute_category	  		VARCHAR2,
22 	x_attribute1		  		VARCHAR2,
23 	x_attribute2		  		VARCHAR2,
24 	x_attribute3		  		VARCHAR2,
25 	x_attribute4		  		VARCHAR2,
26 	x_attribute5		  		VARCHAR2,
27 	x_attribute6		  		VARCHAR2,
28 	x_attribute7		  		VARCHAR2,
29 	x_attribute8		  		VARCHAR2,
30 	x_attribute9		  		VARCHAR2,
31 	x_attribute10		  		VARCHAR2,
32 	x_attribute11		  		VARCHAR2,
33 	x_attribute12		  		VARCHAR2,
34 	x_attribute13		  		VARCHAR2,
35 	x_attribute14		  		VARCHAR2,
36 	x_attribute15		  		VARCHAR2,
37 	x_last_update_login	  		NUMBER,
38 	x_record_status				VARCHAR2) is   --bug 6504696
39 
40   x_record_unique	boolean;
41 
42   cursor row_id is 	SELECT rowid
43 			FROM   PO_ASL_DOCUMENTS
44     		   	WHERE  x_asl_id = asl_id
45 			AND    x_using_organization_id = using_organization_id
46 			AND    x_sequence_num = sequence_num;
47 
48 begin
49 
50     -- Check for duplicate sequence numbers for this asl_id
51     -- and using_organization_id.  The uniqueness constraint
52     -- on document_header_id is enforced by a unique index.
53 
54     x_record_unique := po_asl_documents_sv.check_record_unique(x_asl_id,
55 			     x_using_organization_id,
56 			     x_sequence_num,
57 			     x_document_header_id,
58 			     x_record_status);  --bug 6504696
59 
60     IF NOT x_record_unique THEN
61 
62 	fnd_message.set_name('FND','FORM_DUPLICATE_KEY_IN_INDEX'); --<BUG 3486101>
63         app_exception.raise_exception;
64 
65     END IF;
66 
67     INSERT INTO PO_ASL_DOCUMENTS(
68 	asl_id		  		,
69 	using_organization_id   	,
70 	sequence_num			,
71 	document_type_code		,
72 	document_header_id		,
73 	document_line_id		,
74 	last_update_date		,
75 	last_updated_by	  		,
76 	creation_date			,
77 	created_by			,
78 	attribute_category		,
79 	attribute1			,
80 	attribute2			,
81 	attribute3			,
82 	attribute4			,
83 	attribute5			,
84 	attribute6			,
85 	attribute7			,
86 	attribute8			,
87 	attribute9			,
88 	attribute10			,
89 	attribute11			,
90 	attribute12			,
91 	attribute13			,
92 	attribute14			,
93 	attribute15			,
94 	last_update_login
95      )  VALUES 			(
96 	x_asl_id		  	,
97 	x_using_organization_id  	,
98 	x_sequence_num			,
99 	x_document_type_code		,
100 	x_document_header_id		,
101 	x_document_line_id		,
102 	x_last_update_date	  	,
103 	x_last_updated_by	 	,
104 	x_creation_date		  	,
105 	x_created_by		  	,
106 	x_attribute_category	  	,
107 	x_attribute1		  	,
108 	x_attribute2		  	,
109 	x_attribute3		  	,
110 	x_attribute4		  	,
111 	x_attribute5		  	,
112 	x_attribute6		  	,
113 	x_attribute7		  	,
114 	x_attribute8		  	,
115 	x_attribute9		  	,
116 	x_attribute10		  	,
117 	x_attribute11		  	,
118 	x_attribute12		  	,
119 	x_attribute13		  	,
120 	x_attribute14		  	,
121 	x_attribute15		  	,
122 	x_last_update_login
123 	);
124 
125   OPEN row_id;
126   FETCH row_id INTO x_row_id;
127   if (row_id%notfound) then
128     CLOSE row_id;
129     raise no_data_found;
130   end if;
131   CLOSE row_id;
132 
133 end insert_row;
134 
135 END PO_ASL_DOCUMENTS_THS;