DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_WIP_INTEGRATION_GRP

Source


1 PACKAGE BODY PO_WIP_INTEGRATION_GRP AS
2 /* $Header: POXGWIPB.pls 115.3 2004/01/15 03:06:03 tpoon noship $*/
3 
4 -- Read the profile option that enables/disables the debug log
5 g_fnd_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6 
7 g_pkg_name CONSTANT varchar2(30) := 'PO_WIP_INTEGRATION_GRP';
8 g_module_prefix  CONSTANT VARCHAR2(40) := 'po.plsql.' || g_pkg_name || '.';
9 
10 -----------------------------------------------------------------------------
11 --Start of Comments
12 --Name: update_document
13 --Function:
14 --  Calls the PO Change API, which validates and applies the requested
15 --  changes and any derived changes to the Purchase Order, Purchase
16 --  Agreement, or Release.
17 --Notes:
18 --  For details, see the comments on PO_DOCUMENT_UPDATE_GRP.update_document.
19 --End of Comments
20 -----------------------------------------------------------------------------
21 PROCEDURE update_document (
22   p_api_version            IN NUMBER,
23   p_init_msg_list          IN VARCHAR2,
24   x_return_status          OUT NOCOPY VARCHAR2,
25   p_changes                IN OUT NOCOPY PO_CHANGES_REC_TYPE,
26   p_run_submission_checks  IN VARCHAR2,
27   p_launch_approvals_flag  IN VARCHAR2,
28   p_buyer_id               IN NUMBER,
29   p_update_source          IN VARCHAR2,
30   p_override_date          IN DATE,
31   x_api_errors             OUT NOCOPY PO_API_ERRORS_REC_TYPE
32 ) IS
33   l_api_name     CONSTANT VARCHAR(30) := 'UPDATE_DOCUMENT';
34   l_api_version  CONSTANT NUMBER := 1.0;
35 BEGIN
36   -- Standard API initialization:
37   IF NOT FND_API.Compatible_API_Call ( l_api_version, p_api_version,
38                                        l_api_name, g_pkg_name ) THEN
39     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
40   END IF;
41 
42   IF (FND_API.to_boolean(p_init_msg_list)) THEN
43     FND_MSG_PUB.initialize;
44   END IF;
45 
46   -- Call the PO Change API.
47   PO_DOCUMENT_UPDATE_GRP.update_document(
48     p_api_version => 1.0,
49     p_init_msg_list => p_init_msg_list,
50     x_return_status => x_return_status,
51     p_changes => p_changes,
52     p_run_submission_checks => p_run_submission_checks,
53     p_launch_approvals_flag => p_launch_approvals_flag,
54     p_buyer_id => p_buyer_id,
55     p_update_source => p_update_source,
56     p_override_date => p_override_date,
57     x_api_errors => x_api_errors
58   );
59 EXCEPTION
60   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
61     -- Add the errors on the API message list to x_api_errors.
62     PO_DOCUMENT_UPDATE_PVT.add_message_list_errors (
63       p_api_errors => x_api_errors,
64       x_return_status => x_return_status
65     );
66     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
67   WHEN OTHERS THEN
68     -- Add the unexpected error to the API message list.
69     PO_DEBUG.handle_unexp_error ( p_pkg_name => g_pkg_name,
70                                   p_proc_name => l_api_name );
71     -- Add the errors on the API message list to x_api_errors.
72     PO_DOCUMENT_UPDATE_PVT.add_message_list_errors (
73       p_api_errors => x_api_errors,
74       x_return_status => x_return_status
75     );
76     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
77 END update_document;
78 
79 
80 -----------------------------------------------------------------------------
81 --Start of Comments
82 --Name: cancel_document
83 --Function:
84 --  Wrapper for WIP to Cancel Purchasing Document
85 --  Calls the PO Control API with Action=CANCEL to cancel the Purchase Order,
86 --  Purchase Agreement, or Release.
87 --Notes:
88 --  For details, see the comments on PO_Document_Control_GRP.control_document.
89 --End of Comments
90 -----------------------------------------------------------------------------
91 PROCEDURE cancel_document (
92     p_api_version            IN NUMBER,
93     p_doc_type               IN PO_TBL_VARCHAR30,
94     p_doc_subtype            IN PO_TBL_VARCHAR30,
95     p_doc_id                 IN PO_TBL_NUMBER,
96     p_doc_num                IN PO_TBL_VARCHAR30,
97     p_release_id             IN PO_TBL_NUMBER,
98     p_release_num            IN PO_TBL_NUMBER,
99     p_doc_line_id            IN PO_TBL_NUMBER,
100     p_doc_line_num           IN PO_TBL_NUMBER,
101     p_doc_line_loc_id        IN PO_TBL_NUMBER,
102     p_doc_shipment_num       IN PO_TBL_NUMBER,
103     p_source                 IN VARCHAR2,
104     p_cancel_date            IN DATE,
105     p_cancel_reason          IN VARCHAR2,
106     p_cancel_reqs_flag       IN VARCHAR2,
107     p_print_flag             IN VARCHAR2,
108     p_note_to_vendor         IN VARCHAR2,
109     x_return_status          OUT NOCOPY  VARCHAR2,
110     x_msg_count              OUT NOCOPY  NUMBER,
111     x_msg_data               OUT NOCOPY  VARCHAR2
112 ) IS
113 
114 l_api_name     CONSTANT VARCHAR(30) := 'CANCEL_DOCUMENT';
115 l_progress     VARCHAR2(3) := '000';
116 
117 BEGIN
118 
119 -- Call Control Document API to Cancel PO Documents
120 l_progress := '010';
121 FOR i IN 1..p_doc_id.count LOOP
122 
123     l_progress := '020';
124     PO_Document_Control_GRP.control_document
125            (p_api_version      => p_api_version,
126             p_init_msg_list    => FND_API.G_FALSE,
127             p_commit           => FND_API.G_FALSE,
128             x_return_status    => x_return_status,
129             p_doc_type         => p_doc_type(i),
130             p_doc_subtype      => p_doc_subtype(i),
131             p_doc_id           => p_doc_id(i),
132             p_doc_num          => p_doc_num(i),
133             p_release_id       => p_release_id(i),
134             p_release_num      => p_release_num(i),
135             p_doc_line_id      => p_doc_line_id(i),
136             p_doc_line_num     => p_doc_line_num(i),
137             p_doc_line_loc_id  => p_doc_line_loc_id(i),
138             p_doc_shipment_num => p_doc_shipment_num(i),
139             p_source           => p_source,
140             p_action           => 'CANCEL',
141             p_action_date      => p_cancel_date,
142             p_cancel_reason    => p_cancel_reason,
143             p_cancel_reqs_flag => p_cancel_reqs_flag,
144             p_print_flag       => p_print_flag,
145             p_note_to_vendor   => p_note_to_vendor);
146 
147     IF (x_return_status = FND_API.g_ret_sts_error) THEN
148         RAISE FND_API.g_exc_error;
149     ELSIF (x_return_status = FND_API.g_ret_sts_unexp_error) THEN
150         RAISE FND_API.g_exc_unexpected_error;
151     END IF;
152 
153 END LOOP;
154 
155 EXCEPTION
156     WHEN FND_API.G_EXC_ERROR THEN
157         FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
158         x_return_status := FND_API.G_RET_STS_ERROR;
159     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
160         FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
161         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
162     WHEN OTHERS THEN
163         FND_MSG_PUB.add_exc_msg(G_PKG_NAME, l_api_name || '.' || l_progress);
164         FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
165         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
166 
167 END cancel_document;
168 
169 
170 -----------------------------------------------------------------------------
171 --Start of Comments
172 --Name: cancel_document
173 --Function:
174 --  Wrapper for WIP to Update Requisition. Calls Requisition Update Group API
175 --Notes:
176 -- Detailed comments maintained in the Package Body PO_REQ_DOCUMENT_UPDATE_PVT.update_requisition
177 --End of Comments
178 -----------------------------------------------------------------------------
179 PROCEDURE update_requisition (
180     p_api_version            IN NUMBER,
181     p_req_changes            IN OUT NOCOPY PO_REQ_CHANGES_REC_TYPE,
182     p_update_source          IN VARCHAR2,
183     x_return_status          OUT NOCOPY VARCHAR2,
184     x_msg_count              OUT NOCOPY NUMBER,
185     x_msg_data               OUT NOCOPY VARCHAR2
186 ) IS
187 
188 BEGIN
189 
190 --Call the group procedure to update requisition
191 PO_REQ_DOCUMENT_UPDATE_GRP.update_requisition(
192     p_api_version => p_api_version,
193     p_req_changes => p_req_changes,
194     p_update_source => p_update_source,
195     x_return_status  => x_return_status,
196     x_msg_count  => x_msg_count,
197     x_msg_data  => x_msg_data);
198 
199 END update_requisition;
200 
201 -- Wrapper for WIP to Cancel Requisition
202 -- Detailed comments maintained in the Package Body PO_REQ_DOCUMENT_CANCEL_PVT.cancel_requisition
203 PROCEDURE cancel_requisition (
204     p_api_version            IN NUMBER,
205     p_req_header_id          IN PO_TBL_NUMBER,
206     p_req_line_id            IN PO_TBL_NUMBER,
207     p_cancel_date            IN DATE,
208     p_cancel_reason          IN VARCHAR2,
209     p_source                 IN VARCHAR2,
210     x_return_status          OUT NOCOPY  VARCHAR2,
211     x_msg_count              OUT NOCOPY  NUMBER,
212     x_msg_data               OUT NOCOPY  VARCHAR2
213 ) IS
214 
215 BEGIN
216 
217 --Call the group procedure to cancel requisition
218 PO_REQ_DOCUMENT_CANCEL_GRP.cancel_requisition(
219     p_api_version => 1.0,
220     p_req_header_id => p_req_header_id,
221     p_req_line_id => p_req_line_id,
222     p_cancel_date => p_cancel_date,
223     p_cancel_reason => p_cancel_reason,
224     p_source => p_source,
225     x_return_status  => x_return_status,
226     x_msg_count  => x_msg_count,
227     x_msg_data  => x_msg_data);
228 
229 END cancel_requisition;
230 
231 END PO_WIP_INTEGRATION_GRP;