DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_DRILLDOWN_PUB_PKG

Source


1 PACKAGE BODY PO_DRILLDOWN_PUB_PKG AS
2 /* $Header: PO_DRILLDOWN_PUB_PKG.plb 120.3.12020000.3 2013/02/10 21:13:15 vegajula ship $ */
3 G_PACKAGE_NAME CONSTANT VARCHAR2(30) := 'PO_DRILLDOWN_PUB_PKG';
4 
5 -- Logging global constants
6 D_PACKAGE_BASE CONSTANT VARCHAR2(100) := PO_LOG.get_package_base(G_PACKAGE_NAME);
7 
8 -----------------------------------------------------------------------------
9 --Start of Comments
10 --Name: DRILLDOWN
11 --Pre-reqs:
12 --  This would work for commited transactions
13 --Modifies:
14 --  n/a
15 --Locks:
16 --  n/a
17 --Function:
18 --  Provides drilldown from Subledger journal entry/inquiry to the
19 --  PO Transactions.
20 --Parameters:
21 --IN:
22 --p_application_id
23 --  Subledger application internal identifier
24 --p_ledger_id
25 --  Event ledger identifier
26 --p_legal_entity_id
27 --  Legal entity identifier
28 --p_entity_code
29 --  Event entity internal code
30 --p_event_class_code
31 --  Event class internal code
32 --p_event_type_code
33 --  Event type internal code
34 --p_source_id_int_1
35 --  Generic system transaction identifiers
36 --p_source_id_int_2
37 --  Generic system transaction identifiers
38 --p_source_id_int_3
39 --  Generic system transaction identifiers
40 --p_source_id_int_4
41 --  Generic system transaction identifiers
42 --p_source_id_char_1
43 --  Generic system transaction identifiers
44 --p_source_id_char_2
45 --  Generic system transaction identifiers
46 --p_source_id_char_3
47 --  Generic system transaction identifiers
48 --p_source_id_char_4
49 --  Generic system transaction identifiers
50 --p_security_id_int_1
51 --  Generic system transaction identifiers
52 --p_security_id_int_2
53 --  Generic system transaction identifiers
54 --p_security_id_int_3
55 --  Generic system transaction identifiers
56 --p_security_id_char_1
57 --  Generic system transaction identifiers
58 --p_security_id_char_2
59 --  Generic system transaction identifiers
60 --p_security_id_char_3
61 --  Generic system transaction identifiers
62 --p_valuation_method
63 --  Valuation Method internal identifier
64 --IN/OUT:
65 --p_user_interface_type
66 --  Determines the user interface type. Possible values:
67 --  FORM - indicates that the source transaction is
68 --  displayed using an Oracle*Forms based user
69 --  interface
70 --  HTML- indicates that the source transaction is
71 --  displayed using HTML based user interface
72 --  NONE- Use if the drill down is not supported
73 --  for an event class or event type.
74 --p_function_name
75 --  Name of the Oracle Application Object Library function defined to open the
76 --  transaction form; used only if the page is a FORM page
77 --p_parameters
78 --  An Oracle Application Object Library Function can have its own arguments or
79 --  parameters. Subledger Accounting expectsdevelopers to return these arguments
80 --  via p_parameters. This string can take any number of parameters and you can
81 --  also use it to set some of the parameters dynamically.
82 --  The additional parameters must be passed in the appropriate format. For the
83 --  Oracle*Forms based UI the parameters must be space delimited
84 --  (for example, "param1=value1 param2=value2").
85 --  For the HTML based UI, the parameters must be separated with '&'
86 --  (for example,/OA_HTML/OA.jsp?OAFunc=function_name'&'||param1=value1||'&'||parma2||'&'||value2).
87 --
88 --Notes:
89 --  n/a
90 --End of Comments
91 -----------------------------------------------------------------------------
92 PROCEDURE DRILLDOWN(p_application_id      IN INTEGER,
93                     p_ledger_id           IN INTEGER,
94                     p_legal_entity_id     IN INTEGER DEFAULT NULL,
95                     p_entity_code         IN VARCHAR2,
96                     p_event_class_code    IN VARCHAR2,
97                     p_event_type_code     IN VARCHAR2,
98                     p_source_id_int_1     IN INTEGER DEFAULT NULL,
99                     p_source_id_int_2     IN INTEGER DEFAULT NULL,
100                     p_source_id_int_3     IN INTEGER DEFAULT NULL,
101                     p_source_id_int_4     IN INTEGER DEFAULT NULL,
102                     p_source_id_char_1    IN VARCHAR2 DEFAULT NULL,
103                     p_source_id_char_2    IN VARCHAR2 DEFAULT NULL,
104                     p_source_id_char_3    IN VARCHAR2 DEFAULT NULL,
105                     p_source_id_char_4    IN VARCHAR2 DEFAULT NULL,
106                     p_security_id_int_1   IN INTEGER DEFAULT NULL,
107                     p_security_id_int_2   IN INTEGER DEFAULT NULL,
108                     p_security_id_int_3   IN INTEGER DEFAULT NULL,
109                     p_security_id_char_1  IN VARCHAR2 DEFAULT NULL,
110                     p_security_id_char_2  IN VARCHAR2 DEFAULT NULL,
111                     p_security_id_char_3  IN VARCHAR2 DEFAULT NULL,
112                     p_valuation_method    IN VARCHAR2 DEFAULT NULL,
113                     p_user_interface_type IN OUT NOCOPY VARCHAR2,
114                     p_function_name       IN OUT NOCOPY VARCHAR2,
115                     p_parameters          IN OUT NOCOPY VARCHAR2) IS
116 l_document_id NUMBER;
117 l_module_name CONSTANT VARCHAR2(100) := 'DRILLDOWN';
118 d_module_base CONSTANT VARCHAR2(100) := PO_LOG.get_subprogram_base( D_PACKAGE_BASE, l_module_name);
119 d_progress NUMBER;
120 l_global_agreement_flag PO_HEADERS_ALL.global_agreement_flag%type;
121 l_document_subtype PO_HEADERS_ALL.type_lookup_code%type;
122 l_bpa_header_id  PO_RELEASES_ALL.po_header_id%type;
123 l_federal_flag po_requisition_headers_all.FEDERAL_FLAG%type;
124 BEGIN
125   d_progress :=0;
126   IF (PO_LOG.d_proc) THEN
127     PO_LOG.proc_begin(d_module_base);
128     PO_LOG.proc_begin(d_module_base,'p_application_id',p_application_id);
129     PO_LOG.proc_begin(d_module_base,'p_ledger_id',p_ledger_id);
130     PO_LOG.proc_begin(d_module_base,'p_legal_entity_id',p_legal_entity_id);
131     PO_LOG.proc_begin(d_module_base,'p_entity_code',p_entity_code);
132     PO_LOG.proc_begin(d_module_base,'p_event_class_code',p_event_class_code);
133     PO_LOG.proc_begin(d_module_base,'p_event_type_code',p_event_type_code);
134     PO_LOG.proc_begin(d_module_base,'p_source_id_int_1',p_source_id_int_1);
135     PO_LOG.proc_begin(d_module_base,'p_source_id_int_2',p_source_id_int_2);
136     PO_LOG.proc_begin(d_module_base,'p_source_id_int_3',p_source_id_int_3);
137     PO_LOG.proc_begin(d_module_base,'p_source_id_int_4',p_source_id_int_4);
138     PO_LOG.proc_begin(d_module_base,'p_source_id_char_1',p_source_id_char_1);
139     PO_LOG.proc_begin(d_module_base,'p_source_id_char_2',p_source_id_char_2);
140     PO_LOG.proc_begin(d_module_base,'p_source_id_char_3',p_source_id_char_3);
141     PO_LOG.proc_begin(d_module_base,'p_source_id_char_4',p_source_id_char_4);
142     PO_LOG.proc_begin(d_module_base,'p_security_id_int_1',p_security_id_int_1);
143     PO_LOG.proc_begin(d_module_base,'p_security_id_int_2',p_security_id_int_2);
144     PO_LOG.proc_begin(d_module_base,'p_security_id_int_3',p_security_id_int_3);
145     PO_LOG.proc_begin(d_module_base,'p_security_id_char_1',p_security_id_char_1);
146     PO_LOG.proc_begin(d_module_base,'p_security_id_char_2',p_security_id_char_2);
147     PO_LOG.proc_begin(d_module_base,'p_security_id_char_3',p_security_id_char_3);
148     PO_LOG.proc_begin(d_module_base,'p_valuation_method',p_valuation_method);
149     PO_LOG.proc_begin(d_module_base,'p_user_interface_type',p_user_interface_type);
150     PO_LOG.proc_begin(d_module_base,'p_function_name',p_function_name);
151     PO_LOG.proc_begin(d_module_base,'p_parameters',p_parameters);
152   END IF;
153   d_progress :=10;
154   l_document_id :=p_source_id_int_1;
155   d_progress :=20;
156   IF (p_application_id = 201) THEN
157     d_progress :=30;
158     IF (p_event_class_code IN ('REQUISITION')) THEN
159     d_progress :=35;
160     Begin
161       SELECT nvl(FEDERAL_FLAG,'N')
162       INTO   l_federal_flag
163       FROM po_requisition_headers_all
164       WHERE requisition_header_id = p_source_id_int_1;
165    Exception
166       WHEN NO_DATA_FOUND Then
167       l_federal_flag := 'N';
168       WHEN OTHERS THEN
169       l_federal_flag := 'N';
170    End;
171     d_progress :=36;
172      IF l_federal_flag = 'Y' THEN
173         p_user_interface_type := 'HTML';
174         p_parameters          := '/OA_HTML/OA.jsp?OAFunc=ICX_POR_REQMGMT_DETAIL'||'&'||'reqHeaderId=' || to_char(l_document_id)||'&'||'porMode=viewOnly';
175      ELSE
176       p_user_interface_type := 'FORM'; -- Forms based UI
177       p_function_name       := 'XLA_POXRQVRQ';
178       p_parameters          := 'FORM_USAGE_MODE = GL_DRILLDOWN POXDOCON_ACCESS=N TRANSACTION_ID = '||to_char(l_document_id);
179      END IF;
180     ELSIF (p_event_class_code = 'PO_PA') THEN
181       d_progress :=40;
182       SELECT nvl(global_agreement_flag,'N'),
183              type_lookup_code
184       INTO   l_global_agreement_flag,
185              l_document_subtype
186       FROM po_headers_all
187       WHERE po_header_id=p_source_id_int_1;
188       d_progress :=50;
189       IF(l_document_subtype ='STANDARD')THEN
190         d_progress :=60;
191         p_user_interface_type := 'HTML';
192         p_parameters          := '/OA_HTML/OA.jsp?OAFunc=PO_ORDER'||'&'||'poHeaderId=' || to_char(l_document_id)||'&'||'poMode=viewOnly'||'&'||'poHideUpdate=Y';
193       ELSIF(l_document_subtype ='BLANKET' AND l_global_agreement_flag='Y')THEN
194         d_progress :=70;
195         p_user_interface_type := 'HTML';
196         p_parameters          := '/OA_HTML/OA.jsp?OAFunc=PO_BLANKET'||'&'||'poHeaderId=' || to_char(l_document_id)||'&'||'poMode=viewOnly'||'&'||'poHideUpdate=Y';
197       ELSIF((l_document_subtype='BLANKET' AND l_global_agreement_flag='N')
198              OR l_document_subtype='PLANNED')THEN
199         d_progress :=80;
200         p_user_interface_type := 'FORM'; -- Forms based UI
201         p_function_name       := 'XLA_POXPOVPO';
202         p_parameters          := 'FORM_USAGE_MODE = GL_DRILLDOWN ACCESS_LEVEL_CODE= VIEW_ONLY TRANSACTION_ID= ' || to_char(l_document_id) ;
203       END IF;
204     ELSIF (p_event_class_code = 'RELEASE') THEN
205         d_progress :=90;
206         select po_header_id
207         into l_bpa_header_id
208         from po_releases_all
209         where po_release_id=l_document_id;
210         d_progress :=100;
211         p_user_interface_type := 'FORM'; -- Forms based UI
212         p_function_name       := 'XLA_POXPOVPO';
213         p_parameters          := 'FORM_USAGE_MODE = GL_DRILLDOWN ACCESS_LEVEL_CODE= VIEW_ONLY PO_RELEASE_ID= ' || to_char(l_document_id||' TRANSACTION_ID=' ||to_char(l_bpa_header_id));
214     ELSE
215       d_progress :=110;
216       p_user_interface_type := 'NONE';
217     END IF;
218 
219   END IF;
220 
221   IF (PO_LOG.d_proc) THEN
222     PO_LOG.proc_end(d_module_base);
223     PO_LOG.proc_end(d_module_base,'p_user_interface_type',p_user_interface_type);
224     PO_LOG.proc_end(d_module_base,'p_function_name',p_function_name);
225     PO_LOG.proc_end(d_module_base,'p_parameters',p_parameters);
226   END IF;
227 EXCEPTION
228 WHEN OTHERS THEN
229   IF (PO_LOG.d_exc) THEN
230     PO_LOG.exc(d_module_base, d_progress, SQLCODE || SQLERRM);
231     PO_LOG.exc(d_module_base,'p_user_interface_type',p_user_interface_type);
232     PO_LOG.exc(d_module_base,'p_function_name',p_function_name);
233     PO_LOG.exc(d_module_base,'p_parameters',p_parameters);
234   END IF;
235   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
236 END DRILLDOWN;
237 
238 END PO_DRILLDOWN_PUB_PKG;