DBA Data[Home] [Help]

PACKAGE BODY: APPS.CST_PRJMFG_ACCT_HOOK

Source


1 PACKAGE BODY CST_PRJMFG_ACCT_HOOK as
2 /* $Header: CSTPMHKB.pls 120.0.12010000.2 2010/02/18 01:24:35 ipineda ship $*/
3 /* FND Logging Constants */
4 G_PKG_NAME           CONSTANT VARCHAR2(30) := 'CST_XLA_PVT';
5 G_DEBUG              CONSTANT VARCHAR2(1)  :=  NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6 G_LOG_HEAD           CONSTANT VARCHAR2(40) := 'cst.plsql.'||G_PKG_NAME;
7 G_LOG_LEVEL          CONSTANT NUMBER       := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
8 
9 
10 /*----------------------------------------------------------------------------*
11  |  PRIVATE FUNCTION/PROCEDURES                                               |
12  *----------------------------------------------------------------------------*/
13 
14 
15 
16 /*----------------------------------------------------------------------------*
17  | PUBLIC FUNCTION                                                            |
18  |    pm_use_hook_acct                                                        |
19  |                                                                            |
20  | DESCRIPTION                                                                |
21  |    This function is an indicator to the cost collector program as to       |
22  |    whether the accounting hook is to be used or not.  In order to use      |
23  |    the accounting hook, this function should return the value 'TRUE'       |
24  |    and code should be written. The function should never pass NULL values  |
25  |    to the OUT arguments. 						      |
26  |							                      |
27  | PARAMETERS                                                                 |
28  |       p_transaction_id,                                                    |
29  |       p_transaction_action_id,	                                      |
30  |       p_transaction_source_type_id,                                        |
31  |       p_organization_id,                                                   |
32  |       p_inventory_item_id,                                                 |
33  |       p_cost_element_id,                                                   |
34  |       p_resource_id,                                                       |
35  |	 p_primary_quantity,						      |
36  |	 p_transfer_organization_id,					      |
37  |	 p_fob_point,						              |
38  |	 p_wip_entity_id, 						      |
39  |	 p_basis_resource_id,						      |
40  |	 O_dr_code_combination_id,					      |
41  |	 O_cr_code_combination_id					      |
42  |                                                                            |
43  |                                                                            |
44  | CALLED FROM							              |
45  |	 CST_PRJMFG_COST_COLLECTOR.PM_PROCESS_TXN_MMT                         |
46  |	 CST_PRJMFG_COST_COLLECTOR.PM_PROCESS_TXN_WT                          |
47  | HISTORY                                                                    |
48  |    	 30-JUL-97  Hemant Gosain Created.                                    |
49  *----------------------------------------------------------------------------*/
50   FUNCTION  pm_use_hook_acct (  p_transaction_id 		NUMBER,
51 				p_transaction_action_id		NUMBER,
52 				p_transaction_source_type_id	NUMBER,
53 				p_organization_id		NUMBER,
54 				p_inventory_item_id		NUMBER,
55 				p_cost_element_id		NUMBER,
56 				p_resource_id			NUMBER,
57 				p_primary_quantity		NUMBER,
58 				p_transfer_organization_id	NUMBER,
59 				p_fob_point			NUMBER,
60 				p_wip_entity_id			NUMBER,
61 				p_basis_resource_id		NUMBER,
62 				O_dr_code_combination_id IN OUT NOCOPY	NUMBER,
63 				O_cr_code_combination_id IN OUT NOCOPY NUMBER)
64   RETURN BOOLEAN
65   IS
66   BEGIN
67 	/* ----- PUT YOUR CODE HERE and RETURN TRUE ---------*/
68 	/* ----- END YOUR CODE HERE and RETURN TRUE ---------*/
69   	RETURN FALSE;
70   END pm_use_hook_acct;
71 
72 
73 /*----------------------------------------------------------------------------*
74  | PUBLIC FUNCTION                                                            |
75  |    blueprint_sla_hook                                                      |
76  |                                                                            |
77  | DESCRIPTION                                                                |
78  |    This client extension is a function that works as an indicator to the   |
79  |    cost manager program as to whether the accounting events in SLA should  |
80  |    be created or not when Blue Print configuration takes place. This will  |
81  |    be accomplished by customer extending this function using their custom  |
82  |    logic to determine if a particular transaction should have the events   |
83  |    created or not which will enable the Create Accounting for that specific|
84  |    transaction.                                                            |
85  |							                      |
86  | PARAMETERS:                                                                |
87  |       INPUT:                                                               |
88  |       -p_transaction_id     Transaction ID                                 |
89  |       -p_table_source       String identifying the source table of the     |
90  |                             transaction that is calling the hook, the      |
91  |                             possible values are:                           |
92  |                             "MMT" for transaction belonging to table       |
93  |                              MTL_MATERIAL_TRANSACTIONS                     |
94  |                             "WCTI"  for transactions belonging to table    |
95  |                              WIP_COST_TXN_INTERFACE for normal WIP         |
96  |                              transactions                                  |
97  |                              "WT" for wip transactions belonging to WIP    |
98  |                               transactions table, but this will only be    |
99  |                               called during the WIP Cost update accounting |
100  |                               which is the only case were WT will exist    |
101  |                               at the time the hook has been used, in other |
102  |                               cases only WCTI will be there                |
103  |       OUTPUT:                                                              |
104  |	 -x_return_status_call						      |
105  |	 -x_msg_count_call      					      |
106  |	 -x_msg_data_call        					      |
107  |                                                                            |
108  |                                                                            |
109  | CALLED FROM							              |
110  |	 CST_XLA_PVT.Create_INVXLAEvent                                       |
111  |	 CST_XLA_PVT.Create_WIPXLAEvent                                       |
112  |	                                                                      |
113  | RETURN VALUES                                                              |
114  |       integer    1   Create SLA events in blue print org for this txn      |
115  |                 -1   Error in the hook                                     |
116  |                  0 or any other number                                     |
117  |                      Do not create SLA events in blue print org for this   |
118  |                      transaction  (Default)                                |
119  | HISTORY                                                                    |
120  |    	 04-Jan-2010   Ivan Pineda   Created                                  |
121  *----------------------------------------------------------------------------*/
122   FUNCTION  blueprint_sla_hook(p_transaction_id	                    NUMBER,
123                                p_table_source                       VARCHAR2,
124                                x_return_status       OUT NOCOPY     VARCHAR2,
125                                x_msg_count           OUT NOCOPY     NUMBER,
126                                x_msg_data            OUT NOCOPY     VARCHAR2)
127 
128   RETURN integer IS
129   l_action_id NUMBER :=0;
130   l_item_id NUMBER :=0;
131   l_txn_type_mmt NUMBER :=0;
132   l_txn_type_wt NUMBER :=0;
133   l_api_name   	CONSTANT VARCHAR2(30)   := 'blueprint_sla_hook';
134   l_api_version CONSTANT NUMBER         := 1.0;
135     /* FND Logging */
136    l_module   CONSTANT VARCHAR2(100)        := G_LOG_HEAD ||'.'||l_api_name;
137    l_unexpLog CONSTANT BOOLEAN := (FND_LOG.LEVEL_UNEXPECTED >= G_LOG_LEVEL) AND FND_LOG.TEST(FND_LOG.LEVEL_UNEXPECTED, l_module);
138    l_errorLog CONSTANT BOOLEAN := l_unexpLog and (FND_LOG.LEVEL_ERROR >= G_LOG_LEVEL);
139    l_eventLog CONSTANT BOOLEAN := l_errorLog and (FND_LOG.LEVEL_EVENT >= G_LOG_LEVEL);
140    l_procLog  CONSTANT BOOLEAN := l_eventLog and (FND_LOG.LEVEL_PROCEDURE >= G_LOG_LEVEL);
141    l_stmtLog  CONSTANT BOOLEAN := l_procLog  and (FND_LOG.LEVEL_STATEMENT >= G_LOG_LEVEL);
142 
143   BEGIN
144      x_return_status := fnd_api.g_ret_sts_success;
145 
146      IF l_stmtLog THEN
147         FND_LOG.string(FND_LOG.LEVEL_STATEMENT, l_module,
148                       'Transaction: '||p_transaction_id||
149                       ': Source table: '||p_table_source );
150       END IF;
151 
152      IF (p_table_source = 'MMT') THEN
153      /* EXTEND  YOUR CODE FOR MATERIAL TRANSACTIONS IN MMT AND RETURN HERE*/
154           return 0;
155      ELSIF  (p_table_source = 'WCTI') THEN
156      /* EXTEND YOUR CODE FOR WIP TRANSACTIONS IN WCTI AND RETURN HERE*/
157            return 0;
158      ELSIF  (p_table_source = 'WT') THEN
159       /* EXTEND YOUR CODE FOR WIP TRANSACTIONS IN WT AND RETURN HERE
160         ONLY IN THE CASE OF  WIP COST UPDATE ACCOUNTING WT WILL EXIST
161         AT THE TIME OF CALLING THIS HOOK, FOR OTHER TRANSACTIONS WCTI
162         SHOULD BE USED*/
163           return 0;
164       END IF;
165 
166       RETURN 0;
167   EXCEPTION
168       WHEN OTHERS THEN
169       x_return_status := FND_API.g_ret_sts_unexp_error;
170       x_msg_data := SQLERRM;
171       FND_MSG_PUB.count_and_get(p_count => x_msg_count,
172                                 p_data  => x_msg_data);
173        --IF l_stmtLog THEN
174        -- FND_LOG.string(FND_LOG.LEVEL_STATEMENT, l_module,
175        --                'ERROR IN cst_blueprint_create_SLA');
176       -- END IF;
177       -- raise;
178       fnd_file.put_line(FND_FILE.LOG,'Error in: CST_PRJMFG_ACCT_HOOK.blueprint_sla_hook');
179       raise_application_error(-20200, 'Error in: CST_PRJMFG_ACCT_HOOK.blueprint_sla_hook');
180   END blueprint_sla_hook;
181 
182 END CST_PRJMFG_ACCT_HOOK;