1 PACKAGE CSTPSCHK AUTHID CURRENT_USER AS
2 /* $Header: CSTSCHKS.pls 120.2 2010/06/04 20:40:33 hyu ship $ */
3
4 /*-------------------------------------------------------------+
5 | Public variable |
6 +-------------------------------------------------------------*/
7 g_cat_acc_level VARCHAR2(2) := '00';
8
9 -- FUNCTION
10 -- std_cost_dist_hook Cover routine to allow users to customize.
11 -- They will be able to circumvent the
12 -- standard cost distribution process. This is
13 -- called by inltcp.ppc.
14 --
15 -- INPUT PARAMETERS
16 -- I_ORG_ID
17 -- I_TXN_ID
18 -- I_USER_ID
19 -- I_LOGIN_ID
20 -- I_REQ_ID
21 -- I_PRG_APPL_ID
22 -- I_PRG_ID
23 -- O_Err_Num
24 -- O_Err_Code
25 -- O_Err_Msg
26 --
27 -- RETURN VALUES
28 -- integer 1 Hook has been used.
29 -- 0 Continue cost distribution for this transaction
30 -- as ususal.
31 --
32 FUNCTION std_cost_dist_hook(
33 I_ORG_ID IN NUMBER,
34 I_TXN_ID IN NUMBER,
35 I_USER_ID IN NUMBER,
36 I_LOGIN_ID IN NUMBER,
37 I_REQ_ID IN NUMBER,
38 I_PRG_APPL_ID IN NUMBER,
39 I_PRG_ID IN NUMBER,
40 O_Err_Num OUT NOCOPY NUMBER,
41 O_Err_Code OUT NOCOPY VARCHAR2,
42 O_Err_Msg OUT NOCOPY VARCHAR2
43 )
44 return integer ;
45
46
47
48 -- FUNCTION
49 -- std_cost_update_hook Cover routine to allow users to customize.
50 -- They will be able to circumvent the
51 -- standard cost update process. This is
52 -- called by cmlicu.ppc.
53 --
54 -- INPUT PARAMETERS
55 -- i_org_id
56 -- i_cost_update_id
57 -- i_user_id
58 -- i_login_id
59 -- i_req_id
60 -- i_prg_appl_id
61 -- i_prg_id
62 -- o_err_num
63 -- o_err_code
64 -- o_err_msg
65 --
66 -- RETURN VALUES
67 -- integer 1 Hook has been used.
68 -- 0 Continue cost distribution for this transaction
69 -- as ususal.
70 --
71 FUNCTION std_cost_update_hook(
72 i_org_id IN NUMBER,
73 i_cost_update_id IN NUMBER,
74 i_user_id IN NUMBER,
75 i_login_id IN NUMBER,
76 i_req_id IN NUMBER,
77 i_prg_appl_id IN NUMBER,
78 i_prg_id IN NUMBER,
79 o_err_num OUT NOCOPY NUMBER,
80 o_err_code OUT NOCOPY VARCHAR2,
81 o_err_msg OUT NOCOPY VARCHAR2
82 )
83 RETURN integer ;
84
85
86 -- FUNCTION
87 -- std_get_account_id Cover routine to allow users the flexbility
88 -- in determining the account they want to
89 -- post the inventory transaction to.
90 --
91 -- INPUT PARAMETERS
92 -- I_ORG_ID
93 -- I_TXN_ID
94 -- I_DEBIT_CREDIT 1 for debit and -1 for credit.
95 -- I_ACCT_LINE_TYPE The accounting line type.
96 -- I_COST_ELEMENT_ID
97 -- I_RESOURCE_ID
98 -- I_SUBINV The subinventory involved if there is one.
99 -- I_CG_ID The cost group involved.
100 -- I_EXP Indicates that the cost distributor is looking
101 -- for an expense account. 1 is exp account and 0
102 -- is asset account.
103 -- I_SND_RCV_ORG Indicates whether this is an sending or
104 -- receiving organization for interorg txns.
105 -- 1 is send and 2 is recv.
106 -- I_USER_ID
107 -- I_LOGIN_ID
108 -- I_REQ_ID
109 -- I_PRG_APPL_ID
110 -- I_PRG_ID
111 -- O_Err_Num
112 -- O_Err_Code
113 -- O_Err_Msg
114 --
115 -- RETURN VALUES
116 -- integer >0 Workflow returned account
117 -- -1 Use the default account for distribution:.
118 --
119 function std_get_account_id(
120 I_ORG_ID IN NUMBER,
121 I_TXN_ID IN NUMBER,
122 I_DEBIT_CREDIT IN NUMBER,
123 I_ACCT_LINE_TYPE IN NUMBER,
124 I_COST_ELEMENT_ID IN NUMBER,
125 I_RESOURCE_ID IN NUMBER,
126 I_SUBINV IN VARCHAR2,
127 I_CG_ID IN NUMBER,
128 I_EXP IN NUMBER,
129 I_SND_RCV_ORG IN NUMBER,
130 O_Err_Num OUT NOCOPY NUMBER,
131 O_Err_Code OUT NOCOPY VARCHAR2,
132 O_Err_Msg OUT NOCOPY VARCHAR2
133 )
134 return integer;
135
136 -- FUNCTION
137 -- std_get_update_acct_id Cover routine to allow users the flexbility
138 -- in determining the account they want to
139 -- post the inventory transaction to.
140 --
141 -- INPUT PARAMETERS
142 -- I_ORG_ID
143 -- I_UPDATE_ID
144 -- I_DEBIT_CREDIT 1 for debit and -1 for credit.
145 -- I_ACCT_LINE_TYPE The accounting line type.
146 -- I_COST_ELEMENT_ID
147 -- I_SUBINV The subinventory involved if there is one.
148 -- I_CG_ID The cost group involved.
149 -- I_EXP Indicates that the cost distributor is looking
150 -- for an expense account. 1 is exp account and 0
151 -- is asset account.
152 -- I_SND_RCV_ORG Indicates whether this is an sending or
153 -- receiving organization for interorg txns.
154 -- 1 is send and 2 is recv.
155 -- I_USER_ID
156 -- I_LOGIN_ID
157 -- I_REQ_ID
158 -- I_PRG_APPL_ID
159 -- I_PRG_ID
160 -- O_Err_Num
161 -- O_Err_Code
162 -- O_Err_Msg
163 --
164 -- RETURN VALUES
165 -- integer >0 User selected account number
166 -- -1 Use the default account for distribution.
167 --
168 function std_get_update_acct_id(
169 I_ORG_ID IN NUMBER,
170 I_TXN_ID IN NUMBER,
171 I_TXN_TYPE_ID IN NUMBER,
172 I_TXN_ACT_ID IN NUMBER,
173 I_TXN_SRC_TYPE_ID IN NUMBER,
174 I_ITEM_ID IN NUMBER,
175 I_UPDATE_ID IN NUMBER,
176 I_DEBIT_CREDIT IN NUMBER,
177 I_ACCT_LINE_TYPE IN NUMBER,
178 I_COST_ELEMENT_ID IN NUMBER,
179 I_RESOURCE_ID IN NUMBER,
180 I_SUBINV IN VARCHAR2,
181 I_CG_ID IN NUMBER,
182 I_EXP IN NUMBER,
183 I_SND_RCV_ORG IN NUMBER,
184 O_Err_Num OUT NOCOPY NUMBER,
185 O_Err_Code OUT NOCOPY VARCHAR2,
186 O_Err_Msg OUT NOCOPY VARCHAR2
187 )
188 return integer;
189
190 -- FUNCTION
191 -- std_get_update_scrap_acct_id Routine to allow users to select the account
192 -- to be used for posting scrap adjustments in the
193 -- std cost update process for standard lot based jobs
194 --
195 -- INPUT PARAMETERS
196 -- I_ORG_ID
197 -- I_UPDATE_ID
198 -- I_WIP_ENTITY_ID wip_entity_id of the work order
199 -- I_DEPT_ID department_id of the department that runs the operation
200 -- I_OPERATION_SEQ_NUM operation sequence number of the operation
201 --
202 -- RETURN VALUES
203 -- integer -1 Use the department scrap account
204 -- else use the value returned by this function
205 --
206 -- NOTE THE USE OF RESTRICT_REFERERENCES PRAGMA
207 -- This pragma is needed because this function is being called directly in a SQL statement
208
209 function std_get_update_scrap_acct_id(
210 I_ORG_ID IN NUMBER,
211 I_UPDATE_ID IN NUMBER,
212 I_WIP_ENTITY_ID IN NUMBER,
213 I_DEPT_ID IN NUMBER,
214 I_OPERATION_SEQ_NUM IN NUMBER
215 )
216 return integer;
217
218 -- FUNCTION
219 -- std_get_est_scrap_rev_acct_id Routine to allow users to select the account
220 -- to be used for posting estimated scrap reversal in the
221 -- Operation Yield Processor for scrap transactions.
222 --
223 -- INPUT PARAMETERS
224 -- I_ORG_ID
225 -- I_WIP_ENTITY_ID wip_entity_id of the work order
226 -- I_DEPT_ID department_id of the department that runs the operation
227 -- I_OPERATION_SEQ_NUM operation sequence number of the operation
228 --
229 -- RETURN VALUES
230 -- integer -1 Use the department scrap account
231 -- else use the value returned by this function
232 --
233
234 function std_get_est_scrap_rev_acct_id(
235 I_ORG_ID IN NUMBER,
236 I_WIP_ENTITY_ID IN NUMBER,
237 I_OPERATION_SEQ_NUM IN NUMBER
238 )
239 return integer;
240
241 -- Removing this restriction. This is not neccessary for database version 8i and higher.
242 -- PRAGMA RESTRICT_REFERENCES (std_get_update_scrap_acct_id, WNDS);
243
244
245 --
246 -- OPM INVCONV umoogala Process-Discrete Xfers Enh.
247 -- Hook to get transfer price
248 --
249 procedure Get_xfer_price_user_hook
250 ( p_api_version IN NUMBER
251 , p_init_msg_list IN VARCHAR2
252
253 , p_transaction_uom IN VARCHAR2
254 , p_inventory_item_id IN NUMBER
255 , p_transaction_id IN NUMBER
256 , p_from_organization_id IN NUMBER
257 , p_to_organization_id IN NUMBER
258 , p_from_ou IN NUMBER
259 , p_to_ou IN NUMBER
260
261 , x_return_status OUT NOCOPY NUMBER
262 , x_msg_data OUT NOCOPY VARCHAR2
263 , x_msg_count OUT NOCOPY NUMBER
264
265 , x_transfer_price OUT NOCOPY NUMBER
266 , x_currency_code OUT NOCOPY VARCHAR2
267 )
268 ;
269
270 /*----------------------------------------------------------------------------*
271 | PUBLIC FUNCTION |
272 | FUNCTION cg_or_subinv RETURN VARCHAR2 |
273 | |
274 | DESCRIPTION |
275 | This hook controls the value return to mtl_category_accounts join |
276 | Condition for Subledger Accounting part of the enhancement to |
277 | permanent invnetory accounting for PJM and WMS organizations |
278 | |
279 | The logic is: |
280 | ------------- |
281 | For inventory organizations using perpectual actual cost method |
282 | (average or fifo) the join condition to get category accounts is |
283 | based on Cost Group |
284 | |
285 | For inventory organizations using perpectual standard cost method |
286 | the join condition to get the category accounts is |
287 | based on Cost Group under the following setup: |
288 | 1) The organization is Project Reference-able - PJM organization |
289 | 2) The PJM organization Cost Group Option is by Project |
290 | 3) The Profile Option "CST: Category Account Level" is Cost Group |
291 | |
292 | If the above setup is different, for standard costing organization |
293 | the category account join condition is base on sub-inventories for |
294 | backward compatibility reason to 11i Global Accounting Engine |
295 | |
296 | PARAMETERS: |
297 | INPUT: |
298 | p_organization_id organization id of the material transaction |
299 | being accounted |
300 | p_primary_cost_method costing method of the organization |
301 | p_wms_enabled Indicator of Warehouse management organization |
302 | p_pjm_reference Indicator of project reference-organization |
303 | p_cost_group_accounting Indicator of accounting by project or inventory|
304 | p_cost_group_id Cost Group Identifier |
305 | p_subinv Subinventory code |
306 | p_ship_recv For interorg transaction accounting |
307 | this flag will tell data passed is for |
308 | TRANSFER_ORGANIZATION_ID or |
309 | ORGANIZATION_ID |
313 | CALLED FROM |
310 | p_mmt_id Material transaction being accounted Identifier|
311 | |
312 | |
314 | CST SLA extract cst_xla_inv_headers_v and cst_xla_pla_category_ref_v |
315 | |
316 | RETURN: |
317 | Either: Cost Group ID or SUNINV_CODE |
318 | HISTORY |
319 | 04-Jun-2010 Herve Yu Created |
320 *----------------------------------------------------------------------------*/
321 FUNCTION cg_or_subinv
322 (p_organization_id IN NUMBER
323 ,p_primary_cost_method IN NUMBER
324 ,p_wms_enabled IN VARCHAR2
325 ,p_pjm_reference IN NUMBER
326 ,p_cost_group_accounting IN NUMBER
327 ,p_cost_group_id IN NUMBER
328 ,p_subinv IN VARCHAR2
329 ,p_ship_recv IN VARCHAR2
330 ,p_mmt_id IN NUMBER DEFAULT NULL)
331 RETURN VARCHAR2;
332
333 END CSTPSCHK;