DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_AM_PROCESS_ASSET_TRX_WRAP

Source


1 PACKAGE BODY OKL_AM_PROCESS_ASSET_TRX_WRAP AS
2 /* $Header: OKLBAMAB.pls 115.4 2002/12/18 12:07:08 kjinger noship $ */
3 
4   -- Start of comments
5 --
6 -- Procedure Name  : process_transactions_wrap
7 -- Description     : This procedure calls process_transactions procedure of OKL_AM_PROCESS_ASSET_TRX_PUB API
8 -- Business Rules  :
9 -- Parameters      :  p_contract_id                  - contract id
10 --                    p_asset_id                     - asset_id
11 --                    p_kle_id                       - line id
12 --                    p_salvage_writedown_yn         - flag indicating whether to process salvage valye transactions
13 --
14 -- Version         : 1.0
15 -- End of comments
16 
17   PROCEDURE process_transactions_wrap(   ERRBUF                  OUT NOCOPY 	VARCHAR2,
18                                          RETCODE                 OUT NOCOPY    VARCHAR2 ,
19                                          p_api_version           IN  	NUMBER,
20            		 	                     p_init_msg_list         IN  	VARCHAR2 DEFAULT OKC_API.G_FALSE,
21                                          p_contract_id           IN     NUMBER DEFAULT NULL,
22                                          p_asset_id              IN     NUMBER DEFAULT NULL,
23                                          p_kle_id                IN     VARCHAR2 DEFAULT NULL,
24                                          p_salvage_writedown_yn  IN     VARCHAR2 DEFAULT 'N'
25            			            )    IS
26 
27 
28    l_return_status       VARCHAR2(1);
29    l_msg_count           NUMBER;
30    l_msg_data            VARCHAR2(2000);
31    l_transaction_status  VARCHAR2(1);
32    l_mesg                VARCHAR2(4000);
33    l_mesg_len            NUMBER;
34    l_api_name            CONSTANT VARCHAR2(30) := 'process_transactions_wrap';
35    l_total_count         NUMBER;
36    l_processed_count     NUMBER;
37    l_error_count         NUMBER;
38 
39    BEGIN
40 
41                          OKL_AM_PROCESS_ASSET_TRX_PUB.process_transactions(
42                                 p_api_version           => p_api_version,
43            			            p_init_msg_list         => p_init_msg_list ,
44            			            x_return_status         => l_return_status,
45            			            x_msg_count             => l_msg_count,
46            			            x_msg_data              => l_msg_data,
47 				                p_contract_id    	    => p_contract_id ,
48                                 p_asset_id              => p_asset_id,
49                                 p_kle_id                => TO_NUMBER(p_kle_id),
50                                 p_salvage_writedown_yn  => p_salvage_writedown_yn,
51                                 x_total_count           => l_total_count,
52                                 x_processed_count       => l_processed_count,
53                                 x_error_count           => l_error_count);
54 
55                         l_msg_count := fnd_msg_pub.count_msg;
56                         IF l_msg_count > 0 THEN
57 
58                             l_mesg :=  substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE), 1, 512);
59 
60                             FOR i IN 1..(l_msg_count - 1) LOOP
61                                 l_mesg := l_mesg || ' ' ||
62                                 substr(fnd_msg_pub.get(fnd_msg_pub.G_NEXT,fnd_api.G_FALSE), 1, 512);
63                             END LOOP;
64 
65                             fnd_msg_pub.delete_msg();
66 
67                             l_mesg_len := length(l_mesg);
68                             fnd_file.put_line(fnd_file.log, 'Error: ');
69                             fnd_file.put_line(fnd_file.output, 'Error: ');
70 
71                             FOR i IN 1..ceil(l_mesg_len/255) LOOP
72                                 fnd_file.put_line(fnd_file.log, l_mesg);
73                                 fnd_file.put_line(fnd_file.output, l_mesg);
74                             END LOOP;
75 
76                             fnd_file.new_line(fnd_file.log,2);
77                             fnd_file.new_line(fnd_file.output,2);
78                         END IF;
79 
80                         IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
81                            fnd_file.put_line(fnd_file.log, 'FA ADJUSTMENTS Failed, None of the transactions got processed');
82                            fnd_file.put_line(fnd_file.output, 'FA ADJUSTMENTS Failed, None of the transactions got processed');
83                         END IF;
84 
85                         IF l_return_status = OKC_API.G_RET_STS_SUCCESS AND
86                            l_transaction_status <> OKC_API.G_RET_STS_SUCCESS THEN
87                               fnd_file.put_line(fnd_file.log, 'One or more transactions failed');
88                               fnd_file.put_line(fnd_file.output, 'One or more transactions failed');
89                         END IF;
90 
91                         IF l_return_status = OKC_API.G_RET_STS_SUCCESS AND
92                            l_transaction_status = OKC_API.G_RET_STS_SUCCESS THEN
93                               fnd_file.put_line(fnd_file.log, 'All the transactions got processed successfully');
94                               fnd_file.put_line(fnd_file.output, 'All the transactions got processed successfully');
95                         END IF;
96 
97 
98 fnd_file.put_line(fnd_file.log,'KHR ID '||TO_CHAR(P_CONTRACT_ID));
99 fnd_file.put_line(fnd_file.log,'KLE_ID '||P_KLE_ID);
100 fnd_file.put_line(fnd_file.log,'msg data '||l_msg_data);
101 fnd_file.put_line(fnd_file.log,'return status '||l_return_status);
102 fnd_file.put_line(fnd_file.log,'transaction status  '||l_transaction_status);
103 
104    END;
105 
106 END;