DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_AUTOPOST_OPTIONS_PKG

Source


1 PACKAGE BODY gl_autopost_options_pkg AS
2 /* $Header: glistapb.pls 120.4 2005/05/05 01:22:14 kvora ship $ */
3 
4 --
5 -- PUBLIC FUNCTIONS
6 --
7 
8   PROCEDURE check_unique(x_autopost_set_id  NUMBER,
9                          x_ledger_id        NUMBER,
10 			 x_actual_flag      VARCHAR2,
11 			 x_period_name      VARCHAR2,
12 			 x_source_name      VARCHAR2,
13 			 x_category_name    VARCHAR2,
14 			 row_id             VARCHAR2) IS
15     CURSOR chk_duplicates is
16       SELECT 'Duplicate'
17       FROM   GL_AUTOMATIC_POSTING_OPTIONS apo
18       WHERE  apo.autopost_set_id = x_autopost_set_id
19       AND    apo.ledger_id = x_ledger_id
20       AND    apo.actual_flag = x_actual_flag
21       AND    apo.period_name = x_period_name
22       AND    apo.je_source_name = x_source_name
23       AND    apo.je_category_name = x_category_name
24       AND    (   row_id is null
25               OR apo.rowid <> row_id);
26     dummy VARCHAR2(10);
27   BEGIN
28     OPEN chk_duplicates;
29     FETCH chk_duplicates INTO dummy;
30 
31     IF chk_duplicates%FOUND THEN
32       CLOSE chk_duplicates;
33       fnd_message.set_name('SQLGL', 'GL_DUPLICATE_AUTOPOST_COMBO');
34       app_exception.raise_exception;
35     END IF;
36 
37     CLOSE chk_duplicates;
38 
39   EXCEPTION
40     WHEN app_exceptions.application_exception THEN
41       RAISE;
42     WHEN OTHERS THEN
43       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
44       fnd_message.set_token('PROCEDURE',
45                             'gl_autopost_options_pkg.check_unique');
46       RAISE;
47   END check_unique;
48 
49 PROCEDURE Insert_Row(X_Rowid                        IN OUT NOCOPY VARCHAR2,
50                      X_Autopost_Set_Id                     NUMBER,
51                      X_Ledger_Id                           NUMBER,
52                      X_Actual_Flag                         VARCHAR2,
53                      X_Period_Name                         VARCHAR2,
54                      X_Je_Source_Name                      VARCHAR2,
55                      X_Je_Category_Name                    VARCHAR2,
56                      X_Posting_Priority                    NUMBER,
57                      X_Last_Update_Date                    DATE,
58                      X_Last_Updated_By                     NUMBER,
59                      X_Creation_Date                       DATE,
60                      X_Created_By                          NUMBER,
61                      X_Last_Update_Login                   NUMBER,
62                      X_Attribute1                          VARCHAR2,
63                      X_Attribute2                          VARCHAR2,
64                      X_Attribute3                          VARCHAR2,
65                      X_Attribute4                          VARCHAR2,
66                      X_Attribute5                          VARCHAR2,
67                      X_Attribute6                          VARCHAR2,
68                      X_Attribute7                          VARCHAR2,
69                      X_Attribute8                          VARCHAR2,
70                      X_Attribute9                          VARCHAR2,
71                      X_Attribute10                         VARCHAR2,
72                      X_Attribute11                         VARCHAR2,
73                      X_Attribute12                         VARCHAR2,
74                      X_Attribute13                         VARCHAR2,
75                      X_Attribute14                         VARCHAR2,
76                      X_Attribute15                         VARCHAR2,
77                      X_Context                             VARCHAR2
78  ) IS
79    CURSOR C IS SELECT rowid FROM GL_AUTOMATIC_POSTING_OPTIONS
80              WHERE autopost_set_id = X_autopost_set_id
81              AND   ledger_id = X_ledger_Id
82              AND   actual_flag = X_Actual_Flag
83              AND   period_name = X_Period_Name
84              AND   je_source_name = X_Je_Source_Name
85              AND   je_category_name = X_Je_Category_Name;
86 
87 BEGIN
88 
89   INSERT INTO GL_AUTOMATIC_POSTING_OPTIONS(
90 	  autopost_set_id,
91           ledger_id,
92 	  actual_flag,
93 	  period_name,
94 	  je_source_name,
95 	  je_category_name,
96           posting_priority,
97           last_update_date,
98           last_updated_by,
99           creation_date,
100           created_by,
101           last_update_login,
102           attribute1,
103           attribute2,
104           attribute3,
105           attribute4,
106           attribute5,
107           attribute6,
108           attribute7,
109           attribute8,
110           attribute9,
111           attribute10,
112           attribute11,
113           attribute12,
114           attribute13,
115           attribute14,
116           attribute15,
117           context
118          ) VALUES (
119           X_Autopost_Set_Id,
120           X_Ledger_Id,
121           X_Actual_Flag,
122           X_Period_Name,
123           X_Je_Source_Name,
124           X_Je_Category_Name,
125           X_Posting_Priority,
126           X_Last_Update_Date,
127           X_Last_Updated_By,
128           X_Creation_Date,
129           X_Created_By,
130           X_Last_Update_Login,
131           X_Attribute1,
132           X_Attribute2,
133           X_Attribute3,
134           X_Attribute4,
135           X_Attribute5,
136           X_Attribute6,
137           X_Attribute7,
138           X_Attribute8,
139           X_Attribute9,
140           X_Attribute10,
141           X_Attribute11,
142           X_Attribute12,
143           X_Attribute13,
144           X_Attribute14,
145           X_Attribute15,
146           X_Context
147 
148   );
149 
150   OPEN C;
151   FETCH C INTO X_Rowid;
152   if (C%NOTFOUND) then
153     CLOSE C;
154     RAISE NO_DATA_FOUND;
155   end if;
156   CLOSE C;
157 END Insert_Row;
158 
159 PROCEDURE Lock_Row(X_Rowid                                 VARCHAR2,
160                    X_Autopost_Set_Id                       NUMBER,
161                    X_Ledger_Id                             NUMBER,
162                    X_Actual_Flag                           VARCHAR2,
163                    X_Period_Name                           VARCHAR2,
164                    X_Je_Source_Name                        VARCHAR2,
165                    X_Je_Category_Name                      VARCHAR2,
166                    X_Posting_Priority                      NUMBER,
167                    X_Attribute1                            VARCHAR2,
168                    X_Attribute2                            VARCHAR2,
169                    X_Attribute3                            VARCHAR2,
170                    X_Attribute4                            VARCHAR2,
171                    X_Attribute5                            VARCHAR2,
172                    X_Attribute6                            VARCHAR2,
173                    X_Attribute7                            VARCHAR2,
174                    X_Attribute8                            VARCHAR2,
175                    X_Attribute9                            VARCHAR2,
176                    X_Attribute10                           VARCHAR2,
177                    X_Attribute11                           VARCHAR2,
178                    X_Attribute12                           VARCHAR2,
179                    X_Attribute13                           VARCHAR2,
180                    X_Attribute14                           VARCHAR2,
181                    X_Attribute15                           VARCHAR2,
182                    X_Context                               VARCHAR2
183 ) IS
184   CURSOR C IS
185       SELECT *
186       FROM   GL_AUTOMATIC_POSTING_OPTIONS
187       WHERE  rowid = X_Rowid
188       FOR UPDATE of autopost_set_id NOWAIT;
189   Recinfo C%ROWTYPE;
190 BEGIN
191   OPEN C;
192   FETCH C INTO Recinfo;
193   if (C%NOTFOUND) then
194     CLOSE C;
195     RAISE NO_DATA_FOUND;
196   end if;
197   CLOSE C;
198   if (
199           (   (Recinfo.autopost_set_id = X_autopost_set_id)
200            OR (    (Recinfo.autopost_set_id IS NULL)
201                AND (X_autopost_set_id IS NULL)))
202       AND (   (Recinfo.ledger_id = X_Ledger_Id)
203            OR (    (Recinfo.ledger_id IS NULL)
204                AND (X_Ledger_Id IS NULL)))
205       AND (   (Recinfo.actual_flag = X_Actual_Flag)
206            OR (    (Recinfo.actual_flag IS NULL)
207                AND (X_Actual_Flag IS NULL)))
208       AND (   (Recinfo.period_name = X_Period_Name)
209            OR (    (Recinfo.period_name IS NULL)
210                AND (X_Period_Name IS NULL)))
211       AND (   (Recinfo.je_source_name = X_Je_Source_Name)
212            OR (    (Recinfo.je_source_name IS NULL)
213                AND (X_Je_Source_Name IS NULL)))
214       AND (   (Recinfo.je_category_name = X_je_category_name)
215            OR (    (Recinfo.je_category_name IS NULL)
216                AND (X_Je_category_name IS NULL)))
217       AND (   (Recinfo.posting_priority = X_posting_priority)
218            OR (    (Recinfo.posting_priority IS NULL)
219                AND (X_posting_priority IS NULL)))
220       AND (   (Recinfo.attribute1 = X_Attribute1)
221            OR (    (Recinfo.attribute1 IS NULL)
222                AND (X_Attribute1 IS NULL)))
223       AND (   (Recinfo.attribute2 = X_Attribute2)
224            OR (    (Recinfo.attribute2 IS NULL)
225                AND (X_Attribute2 IS NULL)))
226       AND (   (Recinfo.attribute3 = X_Attribute3)
227            OR (    (Recinfo.attribute3 IS NULL)
228                AND (X_Attribute3 IS NULL)))
229       AND (   (Recinfo.attribute4 = X_Attribute4)
230            OR (    (Recinfo.attribute4 IS NULL)
231                AND (X_Attribute4 IS NULL)))
232       AND (   (Recinfo.attribute5 = X_Attribute5)
233            OR (    (Recinfo.attribute5 IS NULL)
234                AND (X_Attribute5 IS NULL)))
235       AND (   (Recinfo.attribute6 = X_Attribute6)
236            OR (    (Recinfo.attribute6 IS NULL)
237                AND (X_Attribute6 IS NULL)))
238       AND (   (Recinfo.attribute7 = X_Attribute7)
239            OR (    (Recinfo.attribute7 IS NULL)
240                AND (X_Attribute7 IS NULL)))
241       AND (   (Recinfo.attribute8 = X_Attribute8)
242            OR (    (Recinfo.attribute8 IS NULL)
243                AND (X_Attribute8 IS NULL)))
244       AND (   (Recinfo.attribute9 = X_Attribute9)
245            OR (    (Recinfo.attribute9 IS NULL)
246                AND (X_Attribute9 IS NULL)))
247       AND (   (Recinfo.attribute10 = X_Attribute10)
248            OR (    (Recinfo.attribute10 IS NULL)
249                AND (X_Attribute10 IS NULL)))
250       AND (   (Recinfo.attribute11 = X_Attribute11)
251            OR (    (Recinfo.attribute11 IS NULL)
252                AND (X_Attribute11 IS NULL)))
253       AND (   (Recinfo.attribute12 = X_Attribute12)
254            OR (    (Recinfo.attribute12 IS NULL)
255                AND (X_Attribute12 IS NULL)))
256       AND (   (Recinfo.attribute13 = X_Attribute13)
257            OR (    (Recinfo.attribute13 IS NULL)
258                AND (X_Attribute13 IS NULL)))
259       AND (   (Recinfo.attribute14 = X_Attribute14)
260            OR (    (Recinfo.attribute14 IS NULL)
261                AND (X_Attribute14 IS NULL)))
262       AND (   (Recinfo.attribute15 = X_Attribute15)
263            OR (    (Recinfo.attribute15 IS NULL)
264                AND (X_Attribute15 IS NULL)))
265       AND (   (Recinfo.context = X_Context)
266            OR (    (Recinfo.context IS NULL)
267                AND (X_Context IS NULL)))
268           ) then
269     return;
270   else
271     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
272     APP_EXCEPTION.RAISE_EXCEPTION;
273   end if;
274 END Lock_Row;
275 
276 PROCEDURE Update_Row(X_Rowid                               VARCHAR2,
277                      X_Autopost_Set_ID                     NUMBER,
278                      X_Ledger_Id                           NUMBER,
279                      X_Actual_Flag                         VARCHAR2,
280                      X_Period_Name                         VARCHAR2,
281                      X_Je_Source_Name                      VARCHAR2,
282                      X_Je_Category_Name                    VARCHAR2,
283                      X_Posting_Priority                    NUMBER,
284                      X_Last_Update_Date                    DATE,
285                      X_Last_Updated_By                     NUMBER,
286                      X_Last_Update_Login                   NUMBER,
287                      X_Attribute1                          VARCHAR2,
288                      X_Attribute2                          VARCHAR2,
289                      X_Attribute3                          VARCHAR2,
290                      X_Attribute4                          VARCHAR2,
291                      X_Attribute5                          VARCHAR2,
292                      X_Attribute6                          VARCHAR2,
293                      X_Attribute7                          VARCHAR2,
294                      X_Attribute8                          VARCHAR2,
295                      X_Attribute9                          VARCHAR2,
296                      X_Attribute10                         VARCHAR2,
297                      X_Attribute11                         VARCHAR2,
298                      X_Attribute12                         VARCHAR2,
299                      X_Attribute13                         VARCHAR2,
300                      X_Attribute14                         VARCHAR2,
301                      X_Attribute15                         VARCHAR2,
302                      X_Context                             VARCHAR2
303 ) IS
304 BEGIN
305   UPDATE GL_AUTOMATIC_POSTING_OPTIONS
306   SET
307 
308     autopost_set_id                           =    X_Autopost_Set_Id,
309     ledger_id                                 =    X_Ledger_Id,
310     actual_flag                               =    X_Actual_Flag,
311     period_name                               =    X_Period_Name,
312     je_source_name                            =    X_Je_Source_Name,
313     je_category_name                          =    X_Je_Category_Name,
314     posting_priority                          =    X_Posting_Priority,
315     last_update_date                          =    X_Last_Update_Date,
316     last_updated_by                           =    X_Last_Updated_By,
317     last_update_login                         =    X_Last_Update_Login,
318     attribute1                                =    X_Attribute1,
319     attribute2                                =    X_Attribute2,
320     attribute3                                =    X_Attribute3,
321     attribute4                                =    X_Attribute4,
322     attribute5                                =    X_Attribute5,
323     attribute6                                =    X_Attribute6,
324     attribute7                                =    X_Attribute7,
325     attribute8                                =    X_Attribute8,
326     attribute9                                =    X_Attribute9,
327     attribute10                               =    X_Attribute10,
328     attribute11                               =    X_Attribute11,
329     attribute12                               =    X_Attribute12,
330     attribute13                               =    X_Attribute13,
331     attribute14                               =    X_Attribute14,
332     attribute15                               =    X_Attribute15,
333     context                                   =    X_Context
334   WHERE rowid = X_rowid;
335 
336   if (SQL%NOTFOUND) then
337     RAISE NO_DATA_FOUND;
338   end if;
339 
340 END Update_Row;
341 
342 
343 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
344 BEGIN
345   DELETE FROM GL_AUTOMATIC_POSTING_OPTIONS
346   WHERE  rowid = X_Rowid;
347 
348   if (SQL%NOTFOUND) then
349     RAISE NO_DATA_FOUND;
350   end if;
351 END Delete_Row;
352 
353 END gl_autopost_options_pkg;