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.2 2006/09/05 06:21:35 asista noship $ */
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 BEGIN
124   d_progress :=0;
125   IF (PO_LOG.d_proc) THEN
126     PO_LOG.proc_begin(d_module_base);
127     PO_LOG.proc_begin(d_module_base,'p_application_id',p_application_id);
128     PO_LOG.proc_begin(d_module_base,'p_ledger_id',p_ledger_id);
129     PO_LOG.proc_begin(d_module_base,'p_legal_entity_id',p_legal_entity_id);
130     PO_LOG.proc_begin(d_module_base,'p_entity_code',p_entity_code);
131     PO_LOG.proc_begin(d_module_base,'p_event_class_code',p_event_class_code);
132     PO_LOG.proc_begin(d_module_base,'p_event_type_code',p_event_type_code);
133     PO_LOG.proc_begin(d_module_base,'p_source_id_int_1',p_source_id_int_1);
134     PO_LOG.proc_begin(d_module_base,'p_source_id_int_2',p_source_id_int_2);
135     PO_LOG.proc_begin(d_module_base,'p_source_id_int_3',p_source_id_int_3);
136     PO_LOG.proc_begin(d_module_base,'p_source_id_int_4',p_source_id_int_4);
137     PO_LOG.proc_begin(d_module_base,'p_source_id_char_1',p_source_id_char_1);
138     PO_LOG.proc_begin(d_module_base,'p_source_id_char_2',p_source_id_char_2);
139     PO_LOG.proc_begin(d_module_base,'p_source_id_char_3',p_source_id_char_3);
140     PO_LOG.proc_begin(d_module_base,'p_source_id_char_4',p_source_id_char_4);
141     PO_LOG.proc_begin(d_module_base,'p_security_id_int_1',p_security_id_int_1);
142     PO_LOG.proc_begin(d_module_base,'p_security_id_int_2',p_security_id_int_2);
143     PO_LOG.proc_begin(d_module_base,'p_security_id_int_3',p_security_id_int_3);
144     PO_LOG.proc_begin(d_module_base,'p_security_id_char_1',p_security_id_char_1);
145     PO_LOG.proc_begin(d_module_base,'p_security_id_char_2',p_security_id_char_2);
146     PO_LOG.proc_begin(d_module_base,'p_security_id_char_3',p_security_id_char_3);
147     PO_LOG.proc_begin(d_module_base,'p_valuation_method',p_valuation_method);
148     PO_LOG.proc_begin(d_module_base,'p_user_interface_type',p_user_interface_type);
149     PO_LOG.proc_begin(d_module_base,'p_function_name',p_function_name);
150     PO_LOG.proc_begin(d_module_base,'p_parameters',p_parameters);
151   END IF;
152   d_progress :=10;
153   l_document_id :=p_source_id_int_1;
154   d_progress :=20;
155   IF (p_application_id = 201) THEN
156     d_progress :=30;
157     IF (p_event_class_code IN ('REQUISITION')) THEN
158       p_user_interface_type := 'FORM'; -- Forms based UI
159       p_function_name       := 'PO_POXRQVRQ';
160       p_parameters          := 'FORM_USAGE_MODE = GL_DRILLDOWN POXDOCON_ACCESS=N TRANSACTION_ID = '||to_char(l_document_id);
161     ELSIF (p_event_class_code = 'PO_PA') THEN
162       d_progress :=40;
163       SELECT nvl(global_agreement_flag,'N'),
164              type_lookup_code
165       INTO   l_global_agreement_flag,
166              l_document_subtype
167       FROM po_headers_all
168       WHERE po_header_id=p_source_id_int_1;
169       d_progress :=50;
170       IF(l_document_subtype ='STANDARD')THEN
171         d_progress :=60;
172         p_user_interface_type := 'HTML';
173         p_parameters          := '/OA_HTML/OA.jsp?OAFunc=PO_ORDER'||'&'||'poHeaderId=' || to_char(l_document_id)||'&'||'poMode=viewOnly';
174       ELSIF(l_document_subtype ='BLANKET' AND l_global_agreement_flag='Y')THEN
175         d_progress :=70;
176         p_user_interface_type := 'HTML';
177         p_parameters          := '/OA_HTML/OA.jsp?OAFunc=PO_BLANKET'||'&'||'poHeaderId=' || to_char(l_document_id)||'&'||'poMode=viewOnly';
178       ELSIF((l_document_subtype='BLANKET' AND l_global_agreement_flag='N')
179              OR l_document_subtype='PLANNED')THEN
180         d_progress :=80;
181         p_user_interface_type := 'FORM'; -- Forms based UI
182         p_function_name       := 'PO_POXPOVPO';
183         p_parameters          := 'FORM_USAGE_MODE = GL_DRILLDOWN ACCESS_LEVEL_CODE= VIEW_ONLY TRANSACTION_ID= ' || to_char(l_document_id) ;
184       END IF;
185     ELSIF (p_event_class_code = 'RELEASE') THEN
186         d_progress :=90;
187         select po_header_id
188         into l_bpa_header_id
189         from po_releases_all
190         where po_release_id=l_document_id;
191         d_progress :=100;
192         p_user_interface_type := 'FORM'; -- Forms based UI
193         p_function_name       := 'PO_POXPOVPO';
194         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));
195     ELSE
196       d_progress :=110;
197       p_user_interface_type := 'NONE';
198     END IF;
199 
200   END IF;
201 
202   IF (PO_LOG.d_proc) THEN
203     PO_LOG.proc_end(d_module_base);
204     PO_LOG.proc_end(d_module_base,'p_user_interface_type',p_user_interface_type);
205     PO_LOG.proc_end(d_module_base,'p_function_name',p_function_name);
206     PO_LOG.proc_end(d_module_base,'p_parameters',p_parameters);
207   END IF;
208 EXCEPTION
209 WHEN OTHERS THEN
210   IF (PO_LOG.d_exc) THEN
211     PO_LOG.exc(d_module_base, d_progress, SQLCODE || SQLERRM);
212     PO_LOG.exc(d_module_base,'p_user_interface_type',p_user_interface_type);
213     PO_LOG.exc(d_module_base,'p_function_name',p_function_name);
214     PO_LOG.exc(d_module_base,'p_parameters',p_parameters);
215   END IF;
216   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
217 END DRILLDOWN;
218 
219 END PO_DRILLDOWN_PUB_PKG;