DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_FND_ATTACHMENTS_PUB

Source


1 PACKAGE BODY oe_fnd_attachments_pub as
2 /* $Header: OEXPATTB.pls 120.0 2005/06/01 00:01:09 appldev noship $ */
3 
4 
5 G_INVALID_PARAMETER_EXCEPTION  EXCEPTION;
6 G_PKG_NAME     CONSTANT VARCHAR2(30):= 'Oe_Fnd_Attachments_Pub';
7 
8 
9 -- public functions
10 -------------------------------------------------------------------------
11 PROCEDURE Add_Attachment
12 (
13  p_api_version				in   number,
14  p_entity_name				in   varchar,
15  p_pk1_value                        in   varchar2,
16  p_pk2_value                        in   varchar2 default null,
17  p_pk3_value                        in   varchar2 default null,
18  p_pk4_value                        in   varchar2 default null,
19  p_pk5_value                        in   varchar2 default null,
20  p_automatic_flag				in   varchar2 default 'N',
21  p_commit					in   varchar2 default fnd_api.G_FALSE,
22  p_document_id				in   number,
23  x_attachment_id				out NOCOPY /* file.sql.39 change */  number,
24  x_return_status                    out NOCOPY /* file.sql.39 change */  varchar2,
25  x_msg_count                        out NOCOPY /* file.sql.39 change */  number,
26  x_msg_data                         out NOCOPY /* file.sql.39 change */  varchar2
27 )
28 IS
29    l_api_version           CONSTANT NUMBER := 1.0;
30    l_api_name              CONSTANT VARCHAR2(30):= 'Add_Attachment';
31 
32    l_user_id	      	number:=fnd_global.USER_ID;
33    l_login_id	      	number:=fnd_global.LOGIN_ID;
34    l_program_id	      	number:=fnd_global.CONC_PROGRAM_ID;
35    l_program_application_id	number:=fnd_global.PROG_APPL_ID;
36    l_request_id			number:=fnd_global.CONC_REQUEST_ID;
37    l_curr_date          	date  :=sysdate;
38    l_program_update_date 	date  :=null;
39    l_dummy				varchar(1);
40    l_attachment_id            number;
41    l_attachment_exists        boolean;
42 
43    CURSOR C_ATCHMT
44    IS
45       SELECT 'Y'
46       FROM FND_ATTACHED_DOCUMENTS
47       WHERE document_id = p_document_id
48       AND   entity_name = p_entity_name
49       AND    pk1_value   = p_pk1_value
50       AND    (pk2_value IS NULL
51            OR  pk2_value = p_pk2_value)
52       AND    (pk3_value IS NULL
53            OR  pk3_value = p_pk3_value)
54       AND    (pk2_value IS NULL
55            OR  pk4_value = p_pk4_value)
56       AND    (pk2_value IS NULL
57            OR  pk5_value = p_pk5_value);
58 
59 
60 --
61 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
62 --
63 BEGIN
64    IF l_debug_level  > 0 THEN
65        oe_debug_pub.add(  'OE_FND_ATTACHMENTS_PUB.ADD_ATTACHMENT:BEGIN' || P_ENTITY_NAME || ' , '||P_PK1_VALUE ||' , '||P_PK2_VALUE ) ;
66    END IF;
67 
68     --  Standard call to check for call compatibility
69     -----------------------------------------------------------------------
70     if not fnd_api.compatible_api_call(   l_api_version
71 					           , p_api_version
72 					           , l_api_name
73 					           , G_PKG_NAME
74 					           ) then
75         raise fnd_api.G_EXC_UNEXPECTED_ERROR;
76     end if;
77 
78     -- we need to attach the documents only if it is not already attached
79     --------------------------------------------------------------------------
80     l_attachment_exists := TRUE; -- assume
81     open C_ATCHMT;
82     fetch C_ATCHMT into l_dummy;
83     IF l_debug_level  > 0 THEN
84         oe_debug_pub.add(  'OE_FND_ATTACHMENTS_PUB.ATTACHMENT EXISTS DUMMY=' || L_DUMMY ) ;
85     END IF;
86     if (C_ATCHMT%NOTFOUND)   then
87        l_attachment_exists := FALSE;
88        close C_ATCHMT;
89     else
90       close C_ATCHMT;
91     end if;
92 
93     if (l_attachment_exists = FALSE) then
94        IF l_debug_level  > 0 THEN
95            oe_debug_pub.add(  'OE_FND_ATTACHMENTS_PUB.ADD_ATTACHMENT:CALLING PVT.ADD_ATTACHMENT!' ) ;
96        END IF;
97 
98        Oe_Fnd_Attachments_PVT.Add_Attachment(
99                               p_api_version		=> 1.0,
100 					p_entity_name	=> p_entity_name,
101 					p_pk1_value		=> p_pk1_value,
102 					p_pk2_value		=> p_pk2_value,
103 					p_pk3_value		=> p_pk3_value,
104 					p_pk4_value		=> p_pk4_value,
105 					p_pk5_value		=> p_pk5_value,
106                               p_automatic_flag  => p_automatic_flag,
107                               p_document_id	=> p_document_id,
108                               p_validate_flag   => 'Y',
109 					x_attachment_id	=> x_attachment_id,
110 				      x_return_status   => x_return_status,
111 					x_msg_count 	=> x_msg_count,
112 				      x_msg_data        => x_msg_data
113 					);
114 
115     end if;
116 
117    IF l_debug_level  > 0 THEN
118        oe_debug_pub.add(  'OE_FND_ATTACHMENTS_PUB.ADD_ATTACHMENT:END' ) ;
119    END IF;
120 
121 END Add_Attachment;
122 
123 
124 ---------------------------------------------------------------------------
125 PROCEDURE Add_Attachments
126 (
127  p_api_version                      in   number,
128  p_entity_name                      in   varchar2,
129  p_pk1_value                        in   varchar2,
130  p_pk2_value                        in   varchar2 default null,
131  p_pk3_value                        in   varchar2 default null,
132  p_pk4_value                        in   varchar2 default null,
133  p_pk5_value                        in   varchar2 default null,
134  p_process_flag				in   varchar2 default G_RETURN_ON_ERROR,
135  p_automatic_attachment			in   varchar2 default 'N',
136  p_commit					in   varchar2 default fnd_api.G_FALSE,
137  p_document_tbl   		      in out NOCOPY /* file.sql.39 change */ Documet_Tbl_Type,
138  x_return_status                    out NOCOPY /* file.sql.39 change */  varchar2,
139  x_msg_count                        out NOCOPY /* file.sql.39 change */  number,
140  x_msg_data                         out NOCOPY /* file.sql.39 change */  varchar2
141 )
142 IS
143    l_api_version           CONSTANT NUMBER := 1.0;
144    l_api_name              CONSTANT VARCHAR2(30):= 'Add_Attachments';
145    l_return_status	   varchar2(1);
146    l_msg_count		   number;
147    l_msg_data		   varchar2(80);
148    l_attach_this_document     boolean := FALSE;
149    l_attachment_exists        boolean := FALSE;
150 
151    l_dummy				varchar(1);
152 
153 
154    CURSOR C_DOC (cp_document_id number)
155    IS
156       SELECT 'Y'
157       FROM FND_DOCUMENTS
158       WHERE document_id = cp_document_id;
159 
160 
161 
162   --
163   l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
164   --
165 BEGIN
166 
167     --  Standard call to check for call compatibility
168     -----------------------------------------------------------------------
169     if not fnd_api.compatible_api_call(   l_api_version
170 					           , p_api_version
171 					           , l_api_name
172 					           , G_PKG_NAME
173 					           ) then
174         raise fnd_api.G_EXC_UNEXPECTED_ERROR;
175     end if;
176 
177 
178 
179    -- do it for all documents in the table
180    ----------------------------------------
181    for i in 1..p_document_tbl.COUNT loop
182       l_attach_this_document := FALSE;
183       l_attachment_exists    := FALSE;
184 
185       -- if the document_id is passed then validate it..
186       -- otherwise create the document on the fly
187       ----------------------------------------------------
188       if (p_document_tbl(i).document_id is null) then
189 
190          -- this version supports only SHORT_TEXT..
191          -- raise an error for any other data types
192          --------------------------------------------------------------
193          if (p_document_tbl(i).datatype_id <> G_DATATYPE_SHORT_TEXT) then
194             -- add messages here...
195             raise G_INVALID_PARAMETER_EXCEPTION;
196          end if;
197          Create_Short_Text_Document(
198 					p_api_version 		=> 1.0,
199 					p_document_text		=> p_document_tbl(i).content_short_text,
200 					p_document_category	=> p_document_tbl(i).category_id,
201 					p_document_description	=> p_document_tbl(i).description,
202 				      p_language			=> p_document_tbl(i).language,
203 				      p_security_type         => p_document_tbl(i).security_type,
204 					p_security_id 		=> p_document_tbl(i).security_id,
205 					p_publish_flag		=> p_document_tbl(i).publish_flag,
206 					p_usage_type		=> p_document_tbl(i).usage_type,
207 				      p_start_date_active	=> p_document_tbl(i).start_date_active,
208 				      p_end_date_active		=> p_document_tbl(i).end_date_active,
209 					x_document_id           => p_document_tbl(i).document_id,
210 				      x_return_status         => l_return_status,
211 					x_msg_count 		=> l_msg_count,
212 				      x_msg_data              => l_msg_data
213 					);
214          if (l_return_status <> fnd_api.G_RET_STS_SUCCESS) then
215             if (p_process_flag = G_RETURN_ON_ERROR) then
216                -- terminate process
217                x_return_status := l_return_status;
218 	         --  Get message count and data
219        	   fnd_msg_pub.Count_And_Get(p_count    => x_msg_count
220 			  			     ,p_data    => x_msg_data );
221                return;
222             end if;
223             l_attach_this_document := FALSE;
224          else
225             l_attach_this_document := TRUE;
226          end if;
227       else
228          -- no need to create document on the fly..
229          -- document id is passed as the parameter.. let's validate it..
230          -- before attaching this document, let's validate the document id...
231          ------------------------------------------------------------------------
232          l_attach_this_document := TRUE;
233          open C_DOC(p_document_tbl(i).document_id);
234          fetch C_DOC into l_dummy;
235          if (C_DOC%NOTFOUND)   then
236             -- invalid document id!
237             close C_DOC;
238             l_attach_this_document := FALSE;
239          else
240             close C_DOC;
241          end if;
242       end if;
243 
244       if (l_attach_this_document = FALSE AND p_process_flag = G_RETURN_ON_ERROR) then
245            -- terminate process
246           x_return_status := fnd_api.G_RET_STS_ERROR;
247           -- add the error message
248           --  Get message count and data
249  	    fnd_msg_pub.Count_And_Get(p_count    => x_msg_count
250  		  			        ,p_data    => x_msg_data );
251           return;
252       end if;
253 
254       -- the document is valid. attach it to the entity
255       if (l_attach_this_document = TRUE) then
256          Oe_Fnd_Attachments_PVT.Add_Attachment(
257                               p_api_version		=> 1.0,
258 					p_entity_name	=> p_entity_name,
259 					p_pk1_value		=> p_pk1_value,
260 					p_pk2_value		=> p_pk2_value,
261 					p_pk3_value		=> p_pk3_value,
262 					p_pk4_value		=> p_pk4_value,
263 					p_pk5_value		=> p_pk5_value,
264                               p_automatic_flag  => p_automatic_attachment,
265                               p_document_id	=> p_document_tbl(i).document_id,
266                               p_validate_flag   => 'Y',
267 					x_attachment_id	=> p_document_tbl(i).attachment_id,
268 				      x_return_status   => l_return_status,
269 					x_msg_count 	=> l_msg_count,
270 				      x_msg_data        => l_msg_data
271 					);
272 
273       end if;
274    -- end of loop
275    --------------
276    end loop;
277    x_return_status := fnd_api.G_RET_STS_SUCCESS;
278    fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
279  		                   p_data   => x_msg_data
280    			          );
281 
282 
283 EXCEPTION
284    WHEN G_INVALID_PARAMETER_EXCEPTION THEN
285       fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
286   			               p_data   => x_msg_data
287    			             );
288       x_return_status := fnd_api.G_RET_STS_ERROR;
289 
290    WHEN fnd_api.G_EXC_UNEXPECTED_ERROR THEN
291 
292         x_return_status := fnd_api.G_RET_STS_UNEXP_ERROR ;
293 
294         --  Get message count and data
295         fnd_msg_pub.Count_And_Get(p_count   => x_msg_count
296 					   ,p_data    => x_msg_data );
297 
298 
299    WHEN OTHERS THEN
300         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
301 
302         if fnd_msg_pub.Check_Msg_Level(fnd_msg_pub.G_MSG_LVL_UNEXP_ERROR) then
303             fnd_msg_pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
304         end if;
305 
306         --  Get message count and data
307         fnd_msg_pub.Count_And_Get(p_count   => x_msg_count
308 					   ,p_data    => x_msg_data );
309 
310 
311 
312 END Add_Attachments;
313 
314 
315 -------------------------------------------------------------------------
316 PROCEDURE Add_Attachments_Automatic
317 (
318  p_api_version                      in   number,
319  p_entity_name                      in   varchar2,
320  p_pk1_value                        in   varchar2,
321  p_pk2_value                        in   varchar2 default null,
322  p_pk3_value                        in   varchar2 default null,
323  p_pk4_value                        in   varchar2 default null,
324  p_pk5_value                        in   varchar2 default null,
325  p_commit					in   varchar2 default fnd_api.G_FALSE,
326  x_attachment_count                 out NOCOPY /* file.sql.39 change */  number,
327  x_return_status                    out NOCOPY /* file.sql.39 change */  varchar2,
328  x_msg_count                        out NOCOPY /* file.sql.39 change */  number,
329  x_msg_data                         out NOCOPY /* file.sql.39 change */  varchar2
330 )
331 IS
332  l_return_status                    varchar2(1);
333  l_msg_count                        number;
334  l_msg_data                         varchar2(255);
335 
336 --
337 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
338 --
339 BEGIN
340 
341    -- NOTE: done in PVT package
342    oe_fnd_attachments_pvt.Add_Attachments_Automatic(
343      					      p_api_version => 1.0
344 					      ,p_entity_name => p_entity_name
345 					      ,p_pk1_value   => p_pk1_value
346 					      ,p_pk2_value   => p_pk2_value
347 					      ,p_pk3_value   => p_pk3_value
348 					      ,p_pk4_value   => p_pk4_value
349 					      ,p_pk5_value   => p_pk5_value
350 					      ,p_commit	   => p_commit
351                                     ,x_attachment_count=>x_attachment_count
352 					      ,x_return_status   => l_return_status
353 					      ,x_msg_count       => l_msg_count
354 					      ,x_msg_data        => l_msg_data
355 					   );
356 
357 
358    x_return_status := l_return_status;
359    x_msg_count     := l_msg_count;
360    x_msg_data      := l_msg_data;
361 
362 EXCEPTION
363    WHEN OTHERS THEN
364      IF l_debug_level  > 0 THEN
365          oe_debug_pub.add(  'OFA:ADD_ATTACHMENTS_AUTOMATIC:AN EXCCEPTION HAS OCCURED' ) ;
366      END IF;
367 
368      fnd_message.set_name('OE', 'OE_APPLY_ATTACHMENT_EXCEPTION');
369      fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
370 			             p_data   => x_msg_data
371 			          );
372      x_return_status := fnd_api.G_RET_STS_ERROR;
373 END Add_Attachments_Automatic;
374 
375 --------------------------------------------------------------------------------------
376 PROCEDURE Create_Short_Text_Document
377 (
378  p_api_version                      in   number,
379  p_document_text				in   varchar2,
380  p_document_category                in   number,
381  p_document_description			in   varchar2,
382  p_language					in   varchar2 default null,
383  p_security_type                    in   number default G_SECURITY_TYPE_NONE,
384  p_security_id                      in   number default null,
385  p_publish_flag                     in   varchar2 default 'Y',
386  p_usage_type                       in   varchar2,
387  p_start_date_active			in   date default sysdate,
388  p_end_date_active			in   date default null,
389  p_commit					in   varchar2 default fnd_api.G_FALSE,
390  x_document_id                      out NOCOPY /* file.sql.39 change */  number,
391  x_return_status                    out NOCOPY /* file.sql.39 change */  varchar2,
392  x_msg_count                        out NOCOPY /* file.sql.39 change */  number,
393  x_msg_data                         out NOCOPY /* file.sql.39 change */  varchar2
394 )
395 IS
396    l_media_id		number;
397    l_rowid			varchar2(30);
398    l_language           varchar2(30);
399    l_dummy              varchar2(5);
400    l_document_id        number;
401 
402    l_user_id	      	number:=fnd_global.USER_ID;
403    l_login_id	      	number:=fnd_global.LOGIN_ID;
404    l_program_id	      	number:=fnd_global.CONC_PROGRAM_ID;
405    l_program_application_id	number:=fnd_global.PROG_APPL_ID;
406    l_request_id			number:=fnd_global.CONC_REQUEST_ID;
407    l_curr_date          	date  :=sysdate;
408    l_program_update_date 	date  :=null;
409 
410    CURSOR C_CATEGORY
411    IS
412       SELECT 'Yes'
413       FROM FND_DOCUMENT_CATEGORIES
414       WHERE category_id = p_document_category;
415 
416 
417 --
418 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
419 --
420 BEGIN
421 
422    IF l_debug_level  > 0 THEN
423        oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:BEGIN' ) ;
424    END IF;
425    -- do the basic validations to test null document
426    -------------------------------------------------
427    if (p_document_text IS NULL) then
428       IF l_debug_level  > 0 THEN
429           oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:DOCUMENT TEXT IS NULL' ) ;
430       END IF;
431       fnd_message.set_name('FND', 'ATCHMT-NULL DOCUMENT');
432       fnd_msg_pub.add;
433       raise G_INVALID_PARAMETER_EXCEPTION;
434    end if;
435 
436    -- do the basic validations on security type
437    ---------------------------------------------
438    if (p_security_type <> G_SECURITY_TYPE_NONE AND p_security_id IS NULL) then
439       IF l_debug_level  > 0 THEN
440           oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:INVALID SECURITY COMBINATION' ) ;
441       END IF;
442       fnd_message.set_name('FND', 'SECURITY_TYPE_NULL');
443       fnd_msg_pub.add;
444       raise G_INVALID_PARAMETER_EXCEPTION;
445    end if;
446 
447    -- assign program update date to current date if this is a conc mgr call
448    ------------------------------------------------------------------------
449    if(l_program_id <> -1) then
450       l_program_update_date := l_curr_date;
451    end if;
452 
453    -- validate and assign language
454    ------------------------------------------------------------------------
455    if (p_language is null) then
456       -- validate the language
457       l_language := SUBSTR(USERENV('LANGUAGE'),1,INSTR(USERENV('LANGUAGE'),'_')-1);
458    else
459       l_language := p_language;
460    end if;
461 
462    -- validate document_category_id
463    ------------------------------------------------------------------------
464    open C_CATEGORY;
465    fetch C_CATEGORY into l_dummy;
466    if (C_CATEGORY%NOTFOUND)   then
467       IF l_debug_level  > 0 THEN
468           oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:INVALID CATEGORY ID' ) ;
469       END IF;
470       close C_CATEGORY;
471       fnd_message.set_name('FND', 'INVALID_DOCUMENT_CATEGORY');
472       fnd_msg_pub.add;
473       raise G_INVALID_PARAMETER_EXCEPTION;
474    else
475      close C_CATEGORY;
476    end if;
477 
478 
479    -- data is valid, create the document by calling fnd_documents_pkg.insert_row
480    -----------------------------------------------------------------------------
481    IF l_debug_level  > 0 THEN
482        oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:INSERING A ROW-> FND_DOCUMENTS_PKG.INSERT_ROW' ) ;
483    END IF;
484 
485    fnd_documents_pkg.insert_row (
486                         x_rowid		=> l_rowid
487 				,x_document_id	=> l_document_id
488 				,x_creation_date	=> l_curr_date
489 				,x_created_by	=> l_user_id
490 				,x_last_update_date  => l_curr_date
491                         ,x_last_updated_by   => l_user_id
492 				,x_last_update_login => l_login_id
493 				,x_request_id   	   => l_request_id
494 				,x_program_application_id => l_program_application_id
495 				,x_program_id		=> l_program_id
496 				,x_program_update_date	=> l_program_update_date
497 				,x_datatype_id	=> G_DATATYPE_SHORT_TEXT
498 				,x_category_id	=> p_document_category
499                         ,x_security_type	=> p_security_type
500 				,x_security_id	=> p_security_id
501 				,x_publish_flag	=> p_publish_flag
502 				,x_image_type     => null
503 				,x_storage_type	=> null
504 				,x_usage_type	=> p_usage_type
505 				,x_start_date_active => p_start_date_active
506 				,x_end_date_active  => p_end_date_active
507 				,x_language		=> p_language
508 				,x_description	=> p_document_description
509 				,x_file_name	=> null
510 				,x_media_id		=> l_media_id
511 				,x_attribute_category => null
512 				,x_attribute1	=> null
513 				,x_attribute2	=> null
514 				,x_attribute3	=> null
515 				,x_attribute4	=> null
516 				,x_attribute5	=> null
517 				,x_attribute6	=> null
518 				,x_attribute7	=> null
519 				,x_attribute8	=> null
520 				,x_attribute9	=> null
521 				,x_attribute10	=> null
522 				,x_attribute11	=> null
523 				,x_attribute12	=> null
524 				,x_attribute13	=> null
525 				,x_attribute14	=> null
526 				,x_attribute15	=> null
527 			);
528     x_document_id := l_document_id;
529 
530    -- now we need to insert the document text in fnd_document_short_text table
531    ---------------------------------------------------------------------------
532    IF l_debug_level  > 0 THEN
533        oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:INSERING A ROW INTO FND_DOCUMENTS_SHORT_TEXT ID' || TO_CHAR ( L_DOCUMENT_ID ) ) ;
534    END IF;
535 
536    INSERT INTO fnd_documents_short_text
537    (
538      media_id
539      ,short_text
540    )
541    VALUES
542    (
543      l_media_id
544      ,p_document_text
545    );
546 
547    -- if commit is requested then commit the work
548    ----------------------------------------------
549    if(p_commit = fnd_api.G_TRUE) then
550       commit;
551    end if;
552    IF l_debug_level  > 0 THEN
553        oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:END' ) ;
554    END IF;
555 
556 EXCEPTION
557 
558    WHEN G_INVALID_PARAMETER_EXCEPTION THEN
559      IF l_debug_level  > 0 THEN
560          oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:AN INVALID PARAM EXCCEPTION HAS OCCURED' ) ;
561      END IF;
562      fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
563   			               p_data   => x_msg_data
564    			             );
565       x_return_status := fnd_api.G_RET_STS_ERROR;
566 
567    WHEN OTHERS THEN
568       IF l_debug_level  > 0 THEN
569           oe_debug_pub.add(  'OFA:CREATE_SHORT_TEXT_DOCUMENT:AN EXCCEPTION HAS OCCURED' ) ;
570       END IF;
571 
572       fnd_message.set_name('OE', 'CREATE_DOCUMENT_UNEXPECTED_ERROR');
573       fnd_msg_pub.add;
574       fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
575  			                p_data   => x_msg_data
576 			             );
577       x_return_status := fnd_api.G_RET_STS_ERROR;
578 
579 END Create_Short_Text_Document;
580 
581 
582 --------------------------------------------------------------------
583 PROCEDURE Copy_Attachments
584 (
585  p_api_version                      in   number,
586  p_copy_attachments_tbl             in   Copy_Attachments_Tbl_Type
587 )
588 IS
589    l_user_id	      	number:=fnd_global.USER_ID;
590    l_login_id	      	number:=fnd_global.LOGIN_ID;
591    l_program_id	      	number:=fnd_global.CONC_PROGRAM_ID;
592    l_program_application_id	number:=fnd_global.PROG_APPL_ID;
593    l_request_id			number:=fnd_global.CONC_REQUEST_ID;
594 
595 --
596 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
597 --
598 BEGIN
599 
600 
601    for i in 1..p_copy_attachments_tbl.COUNT loop
602       fnd_attached_documents2_pkg.copy_attachments(
603 			   x_from_entity_name	=>  p_copy_attachments_tbl(i).from_entity_name
604 			   ,x_from_pk1_value  	=>  p_copy_attachments_tbl(i).from_pk1_value
605 			   ,x_from_pk2_value  	=>  p_copy_attachments_tbl(i).from_pk2_value
606 			   ,x_from_pk3_value  	=>  p_copy_attachments_tbl(i).from_pk3_value
607 			   ,x_from_pk4_value  	=>  p_copy_attachments_tbl(i).from_pk4_value
608 			   ,x_from_pk5_value  	=>  p_copy_attachments_tbl(i).from_pk5_value
609 			   ,x_to_entity_name 	=>  p_copy_attachments_tbl(i).to_entity_name
610      			   ,x_to_pk1_value     	=>  p_copy_attachments_tbl(i).to_pk1_value
611      			   ,x_to_pk2_value     	=>  p_copy_attachments_tbl(i).to_pk2_value
612      			   ,x_to_pk3_value     	=>  p_copy_attachments_tbl(i).to_pk3_value
613      			   ,x_to_pk4_value     	=>  p_copy_attachments_tbl(i).to_pk4_value
614      			   ,x_to_pk5_value     	=>  p_copy_attachments_tbl(i).to_pk5_value
615 			   ,x_created_by		=>  l_user_id
616 			   ,x_last_update_login	=>  l_login_id
617 			   ,x_program_application_id => l_program_application_id
618 		         ,x_program_id  	=>  l_program_id
619 			   ,x_request_id		=>  l_request_id
620                      );
621    end loop;
622 EXCEPTION
623    WHEN OTHERS THEN
624 /*
625       fnd_message.set_name('OE', 'OE_COPY_ATTACHMENT_EXCEPTION');
626       fnd_msg_pub.count_and_get(  p_count  => x_msg_count,
627  			             p_data   => x_msg_data
628 			          );
629       x_return_status := fnd_api.G_RET_STS_ERROR;
630 */
631       null;
632 END Copy_Attachments;
633 
634 
635 END oe_fnd_attachments_pub;