DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_INTERFACE_ERRORS_PVT

Source


1 PACKAGE BODY PO_INTERFACE_ERRORS_PVT AS
2 /* $Header: POXVPIEB.pls 115.1 2003/08/27 03:38:09 bao noship $*/
3 
4 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_INTERFACE_ERRORS_PVT';
5 
6 -----------------------------------------------------------------------
7 --Start of Comments
8 --Name: insert_row
9 --Pre-reqs:
10 --Modifies: po_interface_errors
11 --Locks:
12 --  None
13 --Function: Insert a record into po_interface_errors table based on
14 --          the values in record p_rec, which is passed in as a parameter
15 --Parameters:
16 --IN:
17 --p_api_version
18 --  API Version the caller thinks this API is on
19 --p_init_msg_list
20 --  Whether the message stack should get initialized within the procedure
21 --p_commit
22 --  Whether the API should commit
23 --p_rec
24 --  A record structure of the table PO_INTERFACE_ERRORS. The values in
25 --  this record will be inserted into po_interface_errors as a record.
26 --  See Notes for its usage
27 --IN OUT:
28 --OUT:
29 --x_return_status
30 --  status of the procedure (FND_API.G_RET_STS_SUCCESS indicates a success,
31 --  otherwise there is an error occurred)
32 --x_msg_count
33 --  Number of messages in the stack
34 --x_msg_data
35 --  If x_msg_count is 1, this out parameter will be populated with that msg
36 --x_row_id
37 --  rowid of the record that just gets inserted
38 --Returns:
39 --Notes:
40 --  Before calling this procedure, p_rec must be populated with values for
41 --  the columns user wants to set. If p_rec.interface_type is not set, the
42 --  value 'UNKNOWN' will be populated as INTERFACE_TYPE in po_interface_erros.
43 --  If p_rec.interface_transaction_id is not set, the value will be derived
44 --  from the next number in PO_INTERFACE_ERRORS_S sequence.
45 --  Also, the following fields will be derived within the procedure and
46 --  the corresponding columns within p_rec will be ignored:
47 --    creation_date
48 --    created_by
49 --    last_update_date
50 --    last_updated_by
51 --    last_update_login
52 --    request_id
53 --    program_application_id
54 --    program_id
55 --Testing:
56 --End of Comments
57 ------------------------------------------------------------------------
58 
59 PROCEDURE insert_row
60 ( p_api_version   IN         NUMBER,
61   p_init_msg_list IN         VARCHAR2,
62   p_commit        IN         VARCHAR2,
63   x_return_status OUT NOCOPY VARCHAR2,
64   x_msg_count     OUT NOCOPY NUMBER,
65   x_msg_data      OUT NOCOPY VARCHAR2,
66   p_rec           IN         PO_INTERFACE_ERRORS%ROWTYPE,
67   x_row_id        OUT NOCOPY ROWID
68 ) IS
69 
70 l_api_name CONSTANT VARCHAR2(30) := 'insert_row';
71 l_api_version NUMBER := 1.0;
72 
73 l_progress VARCHAR2(3);
74 
75 l_interface_transaction_id PO_INTERFACE_ERRORS.interface_transaction_id%TYPE;
76 BEGIN
77 
78     l_progress := '000';
79     x_return_status := FND_API.G_RET_STS_SUCCESS;
80 
81     IF (FND_API.to_boolean(p_init_msg_list)) THEN
82         FND_MSG_PUB.initialize;
83     END IF;
84 
85     IF (NOT FND_API.Compatible_API_Call
86             ( p_current_version_number => l_api_version,
87               p_caller_version_number  => p_api_version,
88               p_api_name               => l_api_name,
89               p_pkg_name               => g_pkg_name
90             )
91        ) THEN
92 
93         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
94     END IF;
95 
96     IF (p_rec.interface_transaction_id IS NULL) THEN
97         SELECT po_interface_errors_s.NEXTVAL
98         INTO   l_interface_transaction_id
99         FROM   DUAL;
100     ELSE
101         l_interface_transaction_id := p_rec.interface_transaction_id;
102     END IF;
103 
104     INSERT INTO po_interface_errors
105     ( interface_type,
106       interface_transaction_id,
107       column_name,
108       error_message,
109       processing_date,
110       creation_date,
111       created_by,
112       last_update_date,
113       last_updated_by,
114       last_update_login,
115       request_id,
116       program_application_id,
117       program_id,
118       program_update_date,
119       error_message_name,
120       table_name,
121       batch_id,
122       interface_header_id,
123       interface_line_id,
124       interface_distribution_id
125     )
126     VALUES
127     ( NVL(p_rec.interface_type, 'UNKNOWN'),
128       l_interface_transaction_id,
129       p_rec.column_name,
130       p_rec.error_message,
131       p_rec.processing_date,
132       SYSDATE,
133       FND_GLOBAL.USER_ID,
134       SYSDATE,
135       FND_GLOBAL.USER_ID,
136       FND_GLOBAL.LOGIN_ID,
137       FND_GLOBAL.CONC_REQUEST_ID,
138       FND_GLOBAL.PROG_APPL_ID,
139       FND_GLOBAL.CONC_PROGRAM_ID,
140       p_rec.program_update_date,
141       p_rec.error_message_name,
142       p_rec.table_name,
143       p_rec.batch_id,
144       p_rec.interface_header_id,
145       p_rec.interface_line_id,
146       p_rec.interface_distribution_id
147     )
148     RETURNING
149       ROWID
150     INTO
151       x_row_id;
152 
153     l_progress := '010';
154 
155     IF (FND_API.to_boolean(p_commit)) THEN
156         COMMIT;
157     END IF;
158 
159 EXCEPTION
160 WHEN OTHERS THEN
161     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
162 
163     FND_MSG_PUB.add_exc_msg
164     ( p_pkg_name       => G_PKG_NAME,
165       p_procedure_name => l_api_name || '.' || l_progress
166     );
167 
168     FND_MSG_PUB.count_and_get
169     ( p_encoded => 'F',
170       p_count   => x_msg_count,
171       p_data    => x_msg_data
172     );
173 
174 END insert_row;
175 
176 END PO_INTERFACE_ERRORS_PVT;