[Home] [Help]
PACKAGE BODY: APPS.PO_ASL_AUTHORIZATIONS_THS
Source
1 PACKAGE BODY PO_ASL_AUTHORIZATIONS_THS as
2 /* $Header: POXADLSB.pls 115.3 2002/11/23 03:36:44 sbull ship $ */
3
4 /*=============================================================================
5
6 PROCEDURE NAME: insert_row()
7
8 ============================================================================*/
9
10 procedure insert_row(
11 x_using_organization_id NUMBER,
12 x_reference_id NUMBER,
13 x_reference_type VARCHAR2,
14 x_authorization_code VARCHAR2,
15 x_authorization_sequence NUMBER,
16 x_last_update_date DATE,
17 x_last_updated_by NUMBER,
18 x_creation_date DATE,
19 x_created_by NUMBER,
20 x_last_update_login NUMBER,
21 x_purchasing_unit_of_measure VARCHAR2,
22 x_timefence_days NUMBER,
23 x_rowid IN OUT NOCOPY VARCHAR2) is
24
25 cursor row_id is SELECT rowid
26 FROM CHV_AUTHORIZATIONS
27 WHERE reference_id = x_reference_id
28 AND reference_type = x_reference_type
29 AND using_organization_id = x_using_organization_id
30 AND authorization_sequence = x_authorization_sequence;
31
32 x_record_unique boolean;
33
34 begin
35
36 -- Check for duplicate sequence number for the current reference
37 -- number and type. Also check for duplicate authorization
38 -- code.
39
40 x_record_unique := po_asl_authorizations_sv.check_record_unique(
41 x_reference_id,
42 x_reference_type,
43 x_authorization_code,
44 x_authorization_sequence,
45 x_using_organization_id);
46
47 IF NOT x_record_unique THEN
48
49 fnd_message.set_name('FND','FORM_RECORD_DUPLICATE');
50 app_exception.raise_exception;
51
52 END IF;
53
54 INSERT INTO CHV_AUTHORIZATIONS(
55 using_organization_id ,
56 reference_id ,
57 reference_type ,
58 authorization_code ,
59 authorization_sequence ,
60 last_update_date ,
61 last_updated_by ,
62 creation_date ,
63 created_by ,
64 last_update_login ,
65 purchasing_unit_of_measure ,
66 timefence_days
67 ) VALUES (
68 x_using_organization_id ,
69 x_reference_id ,
70 x_reference_type ,
71 x_authorization_code ,
72 x_authorization_sequence ,
73 x_last_update_date ,
74 x_last_updated_by ,
75 x_creation_date ,
76 x_created_by ,
77 x_last_update_login ,
78 x_purchasing_unit_of_measure ,
79 x_timefence_days
80 );
81
82 OPEN row_id;
83 FETCH row_id INTO x_rowid;
84 if (row_id%notfound) then
85 CLOSE row_id;
86 raise no_data_found;
87 end if;
88 CLOSE row_id;
89
90 end insert_row;
91
92
93 /*=============================================================================
94
95 PROCEDURE NAME: update_row()
96
97 =============================================================================*/
98 procedure update_row(
99 x_using_organization_id NUMBER,
100 x_reference_id NUMBER,
101 x_reference_type VARCHAR2,
102 x_authorization_code VARCHAR2,
103 x_authorization_sequence NUMBER,
104 x_last_update_date DATE,
105 x_last_updated_by NUMBER,
106 x_creation_date DATE,
107 x_created_by NUMBER,
108 x_last_update_login NUMBER,
109 x_purchasing_unit_of_measure VARCHAR2,
110 x_timefence_days NUMBER,
111 x_rowid VARCHAR2) is
112 begin
113
114 UPDATE CHV_AUTHORIZATIONS
115 SET
116 using_organization_id = x_using_organization_id ,
117 reference_id = x_reference_id ,
118 reference_type = x_reference_type ,
119 authorization_code = x_authorization_code ,
120 authorization_sequence = x_authorization_sequence ,
121 last_update_date = x_last_update_date ,
122 last_updated_by = x_last_updated_by ,
123 creation_date = x_creation_date ,
124 created_by = x_created_by ,
125 last_update_login = x_last_update_login ,
126 purchasing_unit_of_measure = x_purchasing_unit_of_measure ,
127 timefence_days = x_timefence_days
128 WHERE rowid = x_rowid;
129
130 if (sql%notfound) then
131 raise no_data_found;
132 end if;
133
134 end update_row;
135
136 /*=============================================================================
137
138 PROCEDURE NAME: lock_row()
139
140 ============================================================================*/
141
142 procedure lock_row(
143 x_using_organization_id NUMBER,
144 x_reference_id NUMBER,
145 x_reference_type VARCHAR2,
146 x_authorization_code VARCHAR2,
147 x_authorization_sequence NUMBER,
148 x_purchasing_unit_of_measure VARCHAR2,
149 x_timefence_days NUMBER,
150 x_rowid VARCHAR2) is
151
152 cursor auth_row is SELECT *
153 FROM CHV_AUTHORIZATIONS
154 WHERE rowid = x_rowid
155 FOR UPDATE NOWAIT;
156
157 recinfo auth_row%rowtype;
158
159 begin
160
161 OPEN auth_row;
162 FETCH auth_row INTO recinfo;
163 if (auth_row%notfound) then
164 CLOSE auth_row;
165 fnd_message.set_name('FND','FORM_RECORD_DELETED');
166 app_exception.raise_exception;
167 end if;
168 CLOSE auth_row;
169
170 if (
171 (recinfo.using_organization_id = x_using_organization_id)
172 AND (recinfo.reference_id = x_reference_id)
173 AND (recinfo.reference_type = x_reference_type)
174 AND (recinfo.authorization_code = x_authorization_code)
175 AND (recinfo.authorization_sequence = x_authorization_sequence)
176 AND ((recinfo.purchasing_unit_of_measure =
177 x_purchasing_unit_of_measure) OR
178 ((recinfo.purchasing_unit_of_measure is null) AND
179 (x_purchasing_unit_of_measure is null)))
180 AND ((recinfo.timefence_days = x_timefence_days) OR
181 ((recinfo.timefence_days is null) AND
182 (x_timefence_days is null)))
183 ) then
184 return;
185 else
186 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
187 app_exception.raise_exception;
188 end if;
189
190 end lock_row;
191
192 END PO_ASL_AUTHORIZATIONS_THS;