DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_CUSTOM_SUBMISSION_CHECK_PVT

Source


1 PACKAGE BODY PO_CUSTOM_SUBMISSION_CHECK_PVT AS
2   /* $Header: PO_CUSTOM_SUBMISSION_CHECK_PVT.plb 120.0.12010000.2 2009/01/12 07:04:20 mugoel noship $*/
3 
4   ------------------------------------------------------------------------------
5   -- Define private package constants.
6   ------------------------------------------------------------------------------
7   g_pkg_name CONSTANT VARCHAR2(50) := 'PO_CUSTOM_SUBMISSION_CHECK_PVT';
8 
9   d_do_pre_submission_check CONSTANT VARCHAR2(100) :=
10     po_log.get_subprogram_base(po_log.get_package_base(g_pkg_name),
11                                'do_pre_submission_check');
12 
13   d_do_post_submission_check CONSTANT VARCHAR2(100) :=
14     po_log.get_subprogram_base(po_log.get_package_base(g_pkg_name),
15                                'do_post_submission_check');
16 
17   ------------------------------------------------------------------------------
18   -- Define public procedures.
19   ------------------------------------------------------------------------------
20 
21   /**
22    * Public Procedure: do_pre_submission_check
23    * Requires:
24    *   IN PARAMETERS:
25    *     p_api_version:       Version number of API that caller expects.
26    *     p_document_id:       Id of the document to validate
27    *     p_action_requested:  The action to perform
28    *     p_document_type:     The type of the document to perform
29    *                          the submission check on.
30    *     p_document_subtype:  The subtype of the document.
31    *     p_document_level:    The type of id that is being passed.
32    *     p_document_level_id: Id of the doc level type on which to perform the
33    *                          check.
34    *     p_requested_changes: This object contains all the requested changes to
35    *                          the document.
36    *     p_check_asl:         Determines whether or not to perform the checks:
37    *                          PO_SUB_ITEM_NOT_APPROVED/PO_SUB_ITEM_ASL_DEBARRED
38    *     p_req_chg_initiator: Caller of the change request if its a change
39    *                          request.
40    *     p_online_report_id:  Id to be used when inserting records into
41    *                          PO_ONLINE_REPORT_TEXT_GT table.
42    *     p_user_id:           User performing the action
43    *     p_login_id:          Last update login_id
44    *     p_sequence:          Sequence number of last reported error
45    *
46    * Modifies: None. [The custom code has to be written by customer.]
47    * Effects:  This procedure runs the custom document submission checks on
48    *           passed in document.
49    * Returns:
50    *  x_return_status:  FND_API.G_RET_STS_SUCCESS if API succeeds
51    *                    FND_API.G_RET_STS_UNEXP_ERROR if unexpected error occurs
52    *
53    * NOTE: For writing custom code, please refer to the instructions given at
54    *       the top of this file.
55    */
56   PROCEDURE do_pre_submission_check(
57     p_api_version                    IN             NUMBER,
58     p_document_id                    IN             NUMBER,
59     p_action_requested               IN             VARCHAR2,
60     p_document_type                  IN             VARCHAR2,
61     p_document_subtype               IN             VARCHAR2,
62     p_document_level                 IN             VARCHAR2,
63     p_document_level_id              IN             NUMBER,
64     p_requested_changes              IN             PO_CHANGES_REC_TYPE,
65     p_check_asl                      IN             BOOLEAN,
66     p_req_chg_initiator              IN             VARCHAR2,
67     p_origin_doc_id                  IN             NUMBER,
68     p_online_report_id               IN             NUMBER,
69     p_user_id                        IN             NUMBER,
70     p_login_id                       IN             NUMBER,
71     p_sequence                       IN OUT NOCOPY  NUMBER,
72     x_return_status                  OUT NOCOPY     VARCHAR2
73   )
74   IS
75     l_api_name    CONSTANT varchar2(50)  := 'do_pre_submission_check';
76     l_api_version CONSTANT NUMBER        := 1.0;
77     d_mod         CONSTANT VARCHAR2(100) := d_do_pre_submission_check;
78     d_position    NUMBER := 0;
79 
80   BEGIN
81     IF po_log.d_proc
82     THEN
83       po_log.proc_begin(d_mod, 'p_api_version', p_api_version);
84       po_log.proc_begin(d_mod, 'p_action_requested', p_action_requested);
85       po_log.proc_begin(d_mod, 'p_document_type', p_document_type);
86       po_log.proc_begin(d_mod, 'p_document_subtype', p_document_subtype);
87       po_log.proc_begin(d_mod, 'p_document_level', p_document_level);
88       po_log.proc_begin(d_mod, 'p_document_level_id', p_document_level_id);
89       po_log.proc_begin(d_mod, 'p_check_asl', p_check_asl);
90       po_log.proc_begin(d_mod, 'p_req_chg_initiator', p_req_chg_initiator);
91       po_log.proc_begin(d_mod, 'p_origin_doc_id', p_origin_doc_id);
92       po_log.proc_begin(d_mod, 'p_online_report_id', p_online_report_id);
93       po_log.proc_begin(d_mod, 'p_user_id', p_user_id);
94       po_log.proc_begin(d_mod, 'p_login_id', p_login_id);
95       po_log.proc_begin(d_mod, 'p_sequence', p_sequence);
96     END IF;
97 
98     -- Standard call to check for call compatibility
99     IF NOT FND_API.compatible_api_call(l_api_version, p_api_version, l_api_name,
100                                        g_pkg_name)
101     THEN
102       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
103     END IF;
104     d_position := 10;
105 
106     -- TODO: Add custom code here.
107 
108     -- *** Sample Code START ***
109     --
110     -- * Insert errors into PO_ONLINE_REPORT_TEXT_GT table *
111     --INSERT INTO po_online_report_text_gt
112     --           (online_report_id,
113     --           last_update_login,
114     --            last_updated_by,
115     --            last_update_date,
116     --            created_by,
117     --            creation_date,
118     --            line_num,
119     --            shipment_num,
120     --            distribution_num,
121     --            SEQUENCE,
122     --            text_line,
123     --            message_name)
124     --SELECT p_online_report_id,
125     --       p_login_id,
126     --       p_user_id,
127     --       SYSDATE,
128     --       p_user_id,
129     --       SYSDATE,
130     --       pol.line_num,
131     --       0,
132     --       0,
133     --       p_sequence + ROWNUM,
134     --       SUBSTR(FND_MESSAGE.GET_STRING('PO', 'MESSAGE_NAME'),1,240),
135     --       'MESSAGE_NAME'
136     --FROM   po_headers_gt poh,
137     --       po_lines_gt pol
138     --WHERE  poh.po_header_id = p_document_id
139     --       AND pol.po_header_id = poh.po_header_id
140     --       AND 1=2;
141     --
142     -- * Increment the p_sequence with number of errors reported in last query *
143     --p_sequence := p_sequence + SQL%ROWCOUNT;
144     --
145     -- *** Sample Code END ***
146 
147     x_return_status := FND_API.G_RET_STS_SUCCESS;
148     d_position := 100;
149 
150   EXCEPTION
151     WHEN OTHERS
152     THEN
153       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
154       IF po_log.d_exc
155       THEN
156         PO_LOG.exc(d_mod, d_position, SQLCODE || ': ' || SQLERRM);
157         PO_LOG.proc_end(d_mod, 'd_position', d_position);
158         PO_LOG.proc_end(d_mod, 'x_return_status', x_return_status);
159         PO_LOG.proc_end(d_mod);
160       END IF;
161 
162   END do_pre_submission_check;
163 
164   /**
165    * Public Procedure: do_post_submission_check
166    * Requires:
167    *   IN PARAMETERS:
168    *     p_api_version:       Version number of API that caller expects.
169    *     p_document_id:       Id of the document to validate
170    *     p_action_requested:  The action to perform
171    *     p_document_type:     The type of the document to perform
172    *                          the submission check on.
173    *     p_document_subtype:  The subtype of the document.
174    *     p_document_level:    The type of id that is being passed.
175    *     p_document_level_id: Id of the doc level type on which to perform the
176    *                          check.
177    *     p_requested_changes: This object contains all the requested changes to
178    *                          the document.
179    *     p_check_asl:         Determines whether or not to perform the checks:
180    *                          PO_SUB_ITEM_NOT_APPROVED/PO_SUB_ITEM_ASL_DEBARRED
181    *     p_req_chg_initiator: Caller of the change request if its a change
182    *                          request.
183    *     p_online_report_id:  Id to be used when inserting records into
184    *                          PO_ONLINE_REPORT_TEXT_GT table.
185    *     p_user_id:           User performing the action
186    *     p_login_id:          Last update login_id
187    *     p_sequence:          Sequence number of last reported error
188    *
189    * Modifies: None. [The custom code has to be written by customer.]
190    * Effects:  This procedure runs the custom document submission checks on
191    *           passed in document.
192    * Returns:
193    *  x_return_status:  FND_API.G_RET_STS_SUCCESS if API succeeds
194    *                    FND_API.G_RET_STS_UNEXP_ERROR if unexpected error occurs
195    *
196    * NOTE: For writing custom code, please refer to the instructions given at
197    *       the top of this file.
198    */
199   PROCEDURE do_post_submission_check(
200     p_api_version                    IN             NUMBER,
201     p_document_id                    IN             NUMBER,
202     p_action_requested               IN             VARCHAR2,
203     p_document_type                  IN             VARCHAR2,
204     p_document_subtype               IN             VARCHAR2,
205     p_document_level                 IN             VARCHAR2,
206     p_document_level_id              IN             NUMBER,
207     p_requested_changes              IN             PO_CHANGES_REC_TYPE,
208     p_check_asl                      IN             BOOLEAN,
209     p_req_chg_initiator              IN             VARCHAR2,
210     p_origin_doc_id                  IN             NUMBER,
211     p_online_report_id               IN             NUMBER,
212     p_user_id                        IN             NUMBER,
213     p_login_id                       IN             NUMBER,
214     p_sequence                       IN OUT NOCOPY  NUMBER,
215     x_return_status                  OUT NOCOPY     VARCHAR2
216   )
217   IS
218     l_api_name    CONSTANT varchar2(50)  := 'do_post_submission_check';
219     l_api_version CONSTANT NUMBER        := 1.0;
220     d_mod         CONSTANT VARCHAR2(100) := d_do_post_submission_check;
221     d_position    NUMBER := 0;
222 
223   BEGIN
224     IF po_log.d_proc
225     THEN
226       po_log.proc_begin(d_mod, 'p_api_version', p_api_version);
227       po_log.proc_begin(d_mod, 'p_action_requested', p_action_requested);
228       po_log.proc_begin(d_mod, 'p_document_type', p_document_type);
229       po_log.proc_begin(d_mod, 'p_document_subtype', p_document_subtype);
230       po_log.proc_begin(d_mod, 'p_document_level', p_document_level);
231       po_log.proc_begin(d_mod, 'p_document_level_id', p_document_level_id);
232       po_log.proc_begin(d_mod, 'p_check_asl', p_check_asl);
233       po_log.proc_begin(d_mod, 'p_req_chg_initiator', p_req_chg_initiator);
234       po_log.proc_begin(d_mod, 'p_origin_doc_id', p_origin_doc_id);
235       po_log.proc_begin(d_mod, 'p_online_report_id', p_online_report_id);
236       po_log.proc_begin(d_mod, 'p_user_id', p_user_id);
237       po_log.proc_begin(d_mod, 'p_login_id', p_login_id);
238       po_log.proc_begin(d_mod, 'p_sequence', p_sequence);
239     END IF;
240 
241     -- Standard call to check for call compatibility
242     IF NOT FND_API.compatible_api_call(l_api_version, p_api_version, l_api_name,
243                                        g_pkg_name)
244     THEN
245       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
246     END IF;
247     d_position := 10;
248 
249     -- TODO: Add custom code here.
250 
251     x_return_status := FND_API.G_RET_STS_SUCCESS;
252     d_position := 100;
253 
254   EXCEPTION
255     WHEN OTHERS
256     THEN
257       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258       IF po_log.d_exc
259       THEN
260         PO_LOG.exc(d_mod, d_position, SQLCODE || ': ' || SQLERRM);
261         PO_LOG.proc_end(d_mod, 'd_position', d_position);
262         PO_LOG.proc_end(d_mod, 'x_return_status', x_return_status);
263         PO_LOG.proc_end(d_mod);
264       END IF;
265 
266   END do_post_submission_check;
267 
268 END PO_CUSTOM_SUBMISSION_CHECK_PVT;