[Home] [Help]
PACKAGE BODY: APPS.JG_RX_FAREG_MULTIREPTS
Source
1 PACKAGE BODY JG_RX_FAREG_MULTIREPTS AS
2 /* $Header: jgrxfrmb.pls 115.5 2002/11/18 14:16:58 arimai ship $ */
3
4 PROCEDURE get_format(errbuf OUT NOCOPY VARCHAR2,
5 retcode OUT NOCOPY NUMBER,
6 p_asset_concurr_name VARCHAR2,
7 p_asset_report_id NUMBER,
8 p_asset_attribute_set VARCHAR2,
9 p_rtmnt_concurr_name VARCHAR2,
10 p_rtmnt_report_id NUMBER,
11 p_rtmnt_attribute_set VARCHAR2,
12 p_book VARCHAR2,
13 p_from_period VARCHAR2,
14 p_to_period VARCHAR2,
15 p_dummy NUMBER,
16 p_major_category VARCHAR2,
17 p_minor_category VARCHAR2,
18 p_debug_flag VARCHAR2,
19 p_sql_trace VARCHAR2)
20 IS
21
22 req_data VARCHAR2(10);
23 r NUMBER;
24 i NUMBER := 0;
25 this_request_id NUMBER;
26 report_complex_flag VARCHAR2(1);
27 X_asset_report_id NUMBER;
28 X_rtmnt_report_id NUMBER;
29
30 BEGIN
31 --
32 -- Read the value from REQUEST_DATA. IF this is the
33 -- first run of the program, THEN this value will be null.
34 -- OtherwISe, this will be the value that we passed to
35 -- SET_REQ_GLOBALS on the previous run.
36 --
37 req_data := FND_CONC_GLOBAL.request_data;
38 IF (req_data IS NOT NULL) THEN
39 errbuf := 'Done!';
40 retcode := 0 ;
41 return;
42 END IF;
43
44 this_request_id := FND_GLOBAL.conc_request_id;
45 report_complex_flag := 'N';
46
47
48
49 --
50 -- Submit the child request. The sub_request parameter
51 -- must be set to 'Y'.
52 --
53
54 -- ***********************************************************
55 -- First section ASSET
56
57
58 -- Find report_id for asset
59 SELECT R.report_id
60 INTO X_asset_report_id
61 FROM fnd_concurrent_programs c,
62 fnd_application a,
63 fa_rx_reports r
64 WHERE c.application_id = a.application_id
65 AND a.application_short_name ='JG'
66 AND c.concurrent_program_name=p_asset_concurr_name
67 AND c.application_id = r.application_id
68 AND r.concurrent_program_id = c.concurrent_program_id;
69
70
71 i := i + 1;
72 r := FND_REQUEST.submit_request(
73 'JG',
74 'RXJGFAAX',
75 'Multiformat ' || to_char(i),
76 NULL,
77 TRUE,
78 p_book ,
79 p_from_period ,
80 p_to_period ,
81 p_dummy ,
82 p_major_category ,
83 p_minor_category ,
84 'ASSET' ,
85 p_debug_flag ,
86 p_sql_trace
87 );
88
89 IF r = 0 THEN
90 --
91 -- If request submission failed, exit with error.
92 --
93 errbuf := FND_MESSAGE.get;
94 retcode := 2;
95 RETURN;
96 END IF;
97
98 INSERT INTO fa_rx_multiformat_reps (
99 request_id,
100 sub_request_id,
101 sub_attribute_set,
102 sub_report_id,
103 seq_number,
104 complex_flag,
105 last_update_date,
106 last_updated_by,
107 creation_date,
108 created_by
109 )
110 VALUES (
111 this_request_id,
112 r,
113 p_asset_attribute_set,
114 X_asset_report_id,
115 i,
116 report_complex_flag,
117 sysdate,
118 1,
119 sysdate,
120 1
121 );
122
123
124 -- ***********************************************************
125 -- Second section RETIREMENT
126 -- Find report_id for Retirement
127
128 SELECT R.report_id
129 INTO X_rtmnt_report_id
130 FROM fnd_concurrent_programs c,
131 fnd_application a,
132 fa_rx_reports r
133 WHERE c.application_id = a.application_id
134 AND a.application_short_name ='JG'
135 AND c.concurrent_program_name=p_rtmnt_concurr_name
136 AND c.application_id = r.application_id
137 AND r.concurrent_program_id = c.concurrent_program_id;
138
139 i := i + 1;
140 r := FND_REQUEST.submit_request(
141 'JG',
142 'RXJGFARX',
143 'Multiformat ' || to_char(i),
144 NULL,
145 TRUE,
146 p_book ,
147 p_from_period ,
148 p_to_period ,
149 p_dummy ,
150 p_major_category ,
151 p_minor_category ,
152 'RTRMNT' ,
153 p_debug_flag ,
154 p_sql_trace
155 );
156
157 IF r = 0 THEN
158 --
159 -- If request submission failed, exit with error.
160 --
161 errbuf := FND_MESSAGE.get;
162 retcode := 2;
163 RETURN;
164 END IF;
165
166
167 INSERT INTO fa_rx_multiformat_reps (
168 request_id,
169 sub_request_id,
170 sub_attribute_set,
171 sub_report_id,
172 seq_number,
173 complex_flag,
174 last_update_date,
175 last_updated_by,
176 creation_date,
177 created_by
178 )
179 VALUES (
180 this_request_id,
181 r,
182 p_rtmnt_attribute_set,
183 X_rtmnt_report_id,
184 i,
185 report_complex_flag,
186 sysdate,
187 1,
188 sysdate,
189 1
190 );
191
192 --
193 -- Here we set the globals to put the program into the
194 -- PAUSED status on exit, and to save the state in
195 -- request_data.
196 --
197 FND_CONC_GLOBAL.set_req_globals(conc_status => 'PAUSED',
198 request_data => to_char(i)) ;
199 errbuf := 'Sub-Request submitted!';
200 retcode := 0 ;
201
202 RETURN;
203
204 END get_format;
205
206 END JG_RX_FAREG_MULTIREPTS;