DBA Data[Home] [Help]

PACKAGE: APPS.PO_CHANGE_API1_S

Source


1 PACKAGE PO_CHANGE_API1_S AS
2 /* $Header: POXCHN1S.pls 120.4 2006/08/23 21:58:54 bao noship $*/
3 /*#
4  * This package contains procedures that enables you to record supplier
5  * acceptance of your purchase orders and lets you create purchase
6  * order revisions with changes to order quantity and/or price and/or
7  * promised date of delivery.
8  *
9  * The procedure can be used to import change order data from other
10  * legacy applications or to record acceptance or change orders from
11  * your suppliers's applications.  All necessary validations are
12  * performed before revising the purchase order with the changes.
13  *
14  * @rep:scope public
15  * @rep:product PO
16  * @rep:displayname Purchase Order Change APIs
17  */
18 
19 /*===================================================================
20  * FUNCTION record_acceptance
21  * API that records acceptance or rejection information
22  * Parameters:
23  * - x_po_number: PO Number of a document
24  * - x_release_number: Release number of the doc. Null if not a release
25  * - x_revision_number:  Revision of the doc the action is recorded against
26  * - x_action: action
27  * - x_action_date: action date
28  * - x_employee_id: if it is null, then API uses agent_id from document
29  * - x_accepted_flag: 'Y' or 'N'
30  * - x_acceptance_lookup_code: must exist in PO_LOOKUP_CODES
31  * - x_note: Free text
32  * - x_interface_type: Default to 'CHANGEPO' if NULL
33  * - x_transaction_id: default to PO_INTERFACE_ERRORS_S.nextval if NULL
34  * - x_version: Version Checking
35  *==================================================================*/
36 
37 /*#
38  * Record the acceptance or rejection of a purchase order by a supplier
39  *
40  * @param x_po_number Purchase order document
41  * @rep:paraminfo {@rep:required}
42  *
43  * @param x_release_number Release number of the doc.
44  * Null if not a release
45  * @rep:paraminfo {@rep:required}
46  *
47  * @param x_revision_number  The revision of the purchase order/release
48  * is being acted upon
49  * @rep:paraminfo {@rep:required}
50  *
51  * @param x_action Indicates the action to take.  The value must be NEW
52  * @rep:paraminfo {@rep:required}
53  *
54  * @param x_action_date Indicates the date of follow-up action.
55  * Provide a value in the format of MM/DD/YY or MM-DD-YY.  Its
56  * default value is TRUNC(SYSDATA)
57  *
58  * @param x_employee_id The fnd_global.user_id of the buyer
59  * @rep:paraminfo {@rep:required}
60  *
61  * @param x_accepted_flag Indicate if purchase is accepted.
62  * Must be 'Y' or 'N'
63  * @rep:paraminfo {@rep:required}
64  *
65  * @param x_acceptance_lookup_code Type of acceptance, its value must
66  * be corresponding to the LOOKUP_CODE in PO_LOOKUP_CODES table with
67  * LOOKUP_TYPE of ACCEPTANCE TYPE. The possible values are: Accepted
68  * Terms, Accepted All Terms, On Schedule, Unacceptable Changes, and
69  * REJECTED.
70  * @rep:paraminfo {@rep:required}
71  *
72  * @param x_note Free text
73  *
74  * @param x_interface_type Used to fetch any error messages recorded in
75  * PO_INTERFACE_ERRORS table if the process fails. If not provided, a
76  * default value will be used.
77  *
78  * @param x_transaction_id Used to fetch any error messages recorded in
79  * PO_INTERFACE_ERRORS table if the process fails. If not provided, a
80  * default value will be used.
81  *
82  * @param version Version of the current API (currently 1.0)
83  * @rep:paraminfo {@rep:required}
84  *
85  * @param p_org_id  Internal ID for Operating Unit to which document
86  * belongs. Not required if the document belongs to Current operating Unit
87  * or to the the Default Operating.
88  * @rep:paraminfo {@rep:innertype PO_HEADERS_ALL.org_id}
89  *
90  * @rep:displayname API that record the acceptance or rejection of
91  * a purchase order by a supplier
92  *
93  * @rep:category BUSINESS_ENTITY PO_BLANKET_PURCHASE_AGREEMENT
94  * @rep:category BUSINESS_ENTITY PO_CONTRACT_PURCHASE_AGREEMENT
95  * @rep:category BUSINESS_ENTITY PO_GLOBAL_BLANKET_AGREEMENT
96  * @rep:category BUSINESS_ENTITY PO_GLOBAL_CONTRACT_AGREEMENT
97  * @rep:category BUSINESS_ENTITY PO_STANDARD_PURCHASE_ORDER
98  * @rep:category BUSINESS_ENTITY PO_BLANKET_RELEASE
99  * @rep:category BUSINESS_ENTITY PO_PLANNED_PURCHASE_ORDER
100  * @rep:category BUSINESS_ENTITY PO_PLANNED_RELEASE
101  */
102 FUNCTION record_acceptance
103 (
104   X_PO_NUMBER			VARCHAR2,
105   X_RELEASE_NUMBER		NUMBER,
106   X_REVISION_NUMBER		NUMBER,
107   X_ACTION			VARCHAR2,
108   X_ACTION_DATE			DATE,
109   X_EMPLOYEE_ID			NUMBER,
110   X_ACCEPTED_FLAG		VARCHAR2,
111   X_ACCEPTANCE_LOOKUP_CODE	VARCHAR2,
112   X_NOTE			LONG,
113   X_INTERFACE_TYPE      	VARCHAR2,
114   X_TRANSACTION_ID      	NUMBER,
115   VERSION			VARCHAR2,
116   p_org_id          IN NUMBER DEFAULT NULL
117 ) RETURN NUMBER;
118 
119 /*===================================================================
120  * FUNCTION validate_acceptance
121  * Verify that recording acceptance can be performed on this document
122  * Parameters:
123  * - X_po_header_id: po_header_id of the document
124  * - X_po_release_id: po_release_id of a release
125  * - X_employee_id: Employee that is passed in
126  * - x_revision_num: revision of the document
127  * - x_interface_type: for error logging
128  * - x_transaction_id: for error logging
129  *==================================================================*/
130 FUNCTION validate_acceptance
131 ( X_po_header_id 	IN	NUMBER,
132   X_po_release_id 	IN	NUMBER,
133   X_employee_id 	IN OUT	NOCOPY NUMBER,
134   X_revision_num	IN	NUMBER,
135   X_current_revision	IN OUT	NOCOPY NUMBER,
136   X_interface_type	IN	VARCHAR2,
137   X_transaction_id 	IN	NUMBER
138 ) RETURN NUMBER;
139 
140 /*===================================================================
141  * FUNCTION check_mandatory_params
142  * Check the presence of necessary parameters (po_number and revision_number),
143  * as well as the version the caller is having
144  *==================================================================*/
145 FUNCTION check_mandatory_params (
146   X_PO_NUMBER			VARCHAR2,
147   X_REVISION_NUMBER		NUMBER,
148   VERSION			VARCHAR2,
149   X_INTERFACE_TYPE		VARCHAR2,
150   X_TRANSACTION_ID		NUMBER
151 ) RETURN NUMBER;
152 
153 /*=================================================================
154  * PROCEDURE insert_error
155  * insert seeded po error
156  * Parameters:
157  * p_interface_type: type of transaction
158  * p_transaction_id: identifier of the transaction
159  * p_table_name: table where the error comes from
160  * p_message_name: seeded message name in PO
161  * p_token_name: token for error
162  * p_token_value: token value for error
163  *=================================================================*/
164 PROCEDURE insert_error
165 ( X_INTERFACE_TYPE	IN	VARCHAR2,
166   X_transaction_id	IN	NUMBER,
167   X_column_name		IN	VARCHAR2,
168   X_TABLE_NAME		IN	VARCHAR2,
169   X_MESSAGE_NAME	IN	VARCHAR2,
170   X_token_name		IN	VARCHAR2,
171   X_token_value		IN	VARCHAR2
172 );
173 
174 -- <PO_CHANGE_API FPJ>
175 -- In file version 115.6, removed the X_INTERFACE_TYPE and X_TRANSACTION_ID
176 -- parameters from UPDATE_PO and added an X_API_ERRORS parameter, because
177 -- the PO Change API will no longer write error messages to the
178 -- PO_INTERFACE_ERRORS table. Instead, it will return all of the errors
179 -- in the x_api_errors object.
180 
181 /*=====================================================================
182  * FUNCTION update_po
183  * API that updates qty, price or/and promised_date of a document.
184  * Parameters:
185  * - x_PO_NUMBER: po number of the document
186  * - x_RELEASE_NUMBER: Null if not a release, otherwise, release number
187  * - x_REVISION_NUMBER: should be the latest revision
188  * - x_LINE_NUMBER: Line number of the doc.
189  * - x_SHIPMENT_NUMBER: Shipment number
190  * - NEW_QUANTITY : desired new quantity for a line/shipment
191  * - NEW_PRICE    : desired new price for a line/shipment
192  * - NEW_PROMISED_DATE: desired new promised date for a shipment
193  * - NEW_NEED_BY_DATE: desired new need-by date for a shipment
194  * - LAUNCH_APPROVALS_FLAG: determines whether approval workflow is
195  *                            executed or not after update
196  * - UPDATE_SOURCE: for future usage
197  * - p_VERSION: version of the API that is intended to be used
198  * - p_OVERRIDE_DATE: If funds are reserved for the document, this
199  *                    parameter is to speicify the date that is used
200  *                    to unreserve the doc. It's meaningless if
201  *                    encumbrance is not used.
202  * - X_API_ERRORS: If the return value is 0, this object will contain all
203  *                 of the error messages.
204  * - p_BUYER_NAME:  Added as a part of bug fix 2986718.
205  *                  If you want to launch approval through somebody other
206  *                  than the person who prepared the document then you
207  *                  can use this parameter.
208  * Returns:
209  *   1 if the API completed successfully;
210  *   0 if there will any errors.
211  *======================================================================*/
212 
213 /*#
214  * Update a standard purchase order or release changes of
215  * quantity, price and promise date
216  *
217  * @param x_PO_NUMBER Purchase order number
218  * @rep:paraminfo {@rep:required}
219  *
220  * @param x_RELEASE_NUMBER Required if the purchase order is a release.
221  * @rep:paraminfo {@rep:required}
222  *
223  * @param x_REVISION_NUMBER Which revision of the purchase
224  * order/release is being acted upon.
225  * @rep:paraminfo {@rep:required}
226  *
227  * @param x_LINE_NUMBER Purchase order line number to update.
228  * @rep:paraminfo {@rep:required}
229  *
230  * @param x_SHIPMENT_NUMBER If provided, indicates the update occurs at
231  * shipment level, otherwise, it is at line leve.
232  *
233  * @param NEW_QUANTITY Indicates the new value of quantity ordered that
234  * the order should be updated to.
235  * @rep:paraminfo {@rep:required}
236  *
237  * @param NEW_PRICE Indicates the new value of unit price that the
238  * order should be updated to.
239  * @rep:paraminfo {@rep:required}
240  *
241  * @param NEW_PROMISED_DATE Indicates the new value of promised date
242  * that the order should be updated to. Must be in the format of
243  * 'MM/DD/YY' or 'MM-DD-YY'.
244  * @rep:paraminfo {@rep:required}
245  *
246  * @param NEW_NEED_BY_DATE Indicates the new value of need-by date
247  * that the order should be updated to. Must be in the format of
248  * 'MM/DD/YY' or 'MM-DD-YY'.
249  * @rep:paraminfo {@rep:required}
250  *
251  * @param LAUNCH_APPROVALS_FLAG Indicates if you want to launch
252  * APPROVAL workflow after the update. Its value could be either 'Y' or
253  * 'N'. If not provided, the default value is 'N'.
254  * @rep:paraminfo {@rep:required}
255  *
256  * @param UPDATE_SOURCE Reserved for future use to record the source of
257  * the update.
258  *
259  * @param VERSION Version of the current API (currently 1.0).
260  * @rep:paraminfo {@rep:required}
261  *
262  * @param X_OVERRIDE_DATE If the document is encumbered, this is the
263  * date that will be used to un-reserve the document.
264  *
265  * @param X_API_ERRORS Holds the error messages if the update process
266  * fails.
267  *
268  * @param p_BUYER_NAME Buyer Name whose approval path should be used
269  * while submitting the document for approval.
270  *
271  * @param p_secondary_quantity New secondary quantity for the line or
272  * shipment
273  *
274  * @param p_preferred_grade Preferred grade for the line or shipment
275  *
276  * @param p_org_id  Internal ID for Operating Unit to which document
277  * belongs. Not required if the document belongs to Current operating Unit
278  * or to the the Default Operating.
279  * @rep:paraminfo {@rep:innertype PO_HEADERS_ALL.org_id}
280  *
281  * @rep:displayname API that update a standard purchase order
282  * or release changes
283  *
284  * @rep:category BUSINESS_ENTITY PO_STANDARD_PURCHASE_ORDER
285  * @rep:category BUSINESS_ENTITY PO_BLANKET_RELEASE
286  * @rep:category BUSINESS_ENTITY PO_PLANNED_PURCHASE_ORDER
287  * @rep:category BUSINESS_ENTITY PO_PLANNED_RELEASE
288  */
289 FUNCTION update_po
290 (
291   X_PO_NUMBER			VARCHAR2,
292   X_RELEASE_NUMBER		NUMBER,
293   X_REVISION_NUMBER		NUMBER,
294   X_LINE_NUMBER			NUMBER,
295   X_SHIPMENT_NUMBER		NUMBER,
296   NEW_QUANTITY			NUMBER,
297   NEW_PRICE			NUMBER,
298   NEW_PROMISED_DATE		DATE,
299   NEW_NEED_BY_DATE              DATE := NULL,
300   LAUNCH_APPROVALS_FLAG		VARCHAR2,
301   UPDATE_SOURCE			VARCHAR2,
302   VERSION			VARCHAR2,
303   X_OVERRIDE_DATE		DATE := NULL,
304   -- <PO_CHANGE_API FPJ START>
305   X_API_ERRORS                  OUT NOCOPY PO_API_ERRORS_REC_TYPE,
306   -- <PO_CHANGE_API FPJ END>
307   p_BUYER_NAME                  VARCHAR2  default NULL,
308   -- <INVCONV R12 START>
309   p_secondary_quantity          NUMBER    ,
310   p_preferred_grade             VARCHAR2,
311     -- <INVCONV R12 END>
312   p_org_id          IN NUMBER DEFAULT NULL
313 ) RETURN NUMBER;
314 
315 
316 END PO_CHANGE_API1_S;