Vous êtes sur la page 1sur 11

1.

PACKAGE CN_COLLECT_YONT_81_T AUTHID CURRENT_USER AS


2.
3. --
4. -- Procedure Name
5. -- collect
6. -- Purpose
7. -- Collection procedure for yont_81
8. -- History
9. -- 13-JUN-2018 14:10 APPS Created
10. --
11. PROCEDURE collect (errbuf OUT NOCOPY VARCHAR2, retcode OUT NOCOPY NUMBER,
x_org_id IN NUMBER );
12.
13. END;
********************************************************
1. PACKAGE BODY CN_COLLECT_YONT_81_T AS
2.
3. --
4. -- Procedure Name
5. -- collect
6. -- Purpose
7. -- Collection procedure for yont_81
8. -- History
9. -- 13-JUN-2018 14:10 APPS Created
10. --
11. PROCEDURE collect (errbuf OUT NOCOPY VARCHAR2, retcode OUT NOCOPY NUMBER,
x_org_id IN NUMBER ) IS
12. trx_count NUMBER := 0;
13. trx_line_count NUMBER := 0;
14. trx_sales_line_count NUMBER := 0;
15. trx_update_count NUMBER := 0;
16. trx_line_update_count NUMBER := 0;
17. trx_sales_line_update_count NUMBER := 0;
18. comm_lines_api_count NUMBER := 0;
19. comm_lines_api_update_count NUMBER := 0;
20. x_start_period_id NUMBER(15);
21. x_end_period_id NUMBER(15);
22. x_col_audit_id NUMBER;
23. x_proc_audit_id NUMBER;
24. x_conc_program_id NUMBER;
25. x_batch_id NUMBER;
26. x_rowid ROWID;
27. debug_pipe VARCHAR2(30);
28. debug_level NUMBER := 1 ;
29. dummy_num NUMBER ;
30. x_return_status VARCHAR2(1);
31. x_msg_count NUMBER;
32. x_msg_data VARCHAR(2000);
33. x_created_by NUMBER := to_number(fnd_global.user_id);
34. x_creation_date DATE := sysdate;
35. x_last_updated_by NUMBER := to_number(fnd_global.user_id);
36. x_last_update_date DATE := sysdate;
37. x_last_update_login NUMBER := to_number(fnd_global.login_id);
38.
39. CURSOR batches IS
40. SELECT DISTINCT batch_id
41. FROM cn_not_trx
42. WHERE collected_flag = 'N'
43. AND event_id = 1000
44. AND org_id = 81 ;
45.
46. BEGIN
47. IF (debug_pipe IS NOT NULL) THEN
48. cn_debug.init_pipe(debug_pipe, debug_level);
49. END IF;
50.
51.
52. x_proc_audit_id := NULL; -- Will get a value in the call below FOR
TESTING
53. cn_message_pkg.begin_batch(
54. x_parent_proc_audit_id => dummy_num
55. ,x_process_audit_id => x_proc_audit_id
56. ,x_request_id => fnd_global.conc_request_id
57. ,x_process_type => 'CUSTOM'
58. ,p_org_id => x_org_id );
59. x_col_audit_id := x_proc_audit_id;
60. cn_message_pkg.debug('collect>>');
61. fnd_file.put_line(fnd_file.Log, 'collect>>');
62. MO_GLOBAL.SET_POLICY_CONTEXT ('S',81);
63.
64.
65. --******** NOTIFICATION PROCESSING *********--
66. cn_message_pkg.debug('Inserting new transactions into CN_NOT_TRX.');
67. fnd_file.put_line(fnd_file.Log,'Inserting new transactions into
CN_NOT_TRX.');
68.
69. DECLARE -- Notification Insert Block
70. --*** Declaring user-defined Notification Parameters
71. fromdate cn_objects.object_value%TYPE;
72. todate cn_objects.object_value%TYPE;
73. BEGIN
74. --*** Initializing user-defined Notification Parameters
75. SELECT object_value
76. INTO fromdate
77. FROM cn_objects
78. WHERE object_id = 1110 --*** Object_Id for fromdate
79. AND org_id = 81;
80.
81. SELECT object_value
82. INTO todate
83. FROM cn_objects
84. WHERE object_id = 1111 --*** Object_Id for todate
85. AND org_id = 81;
86.
87.
88.
89. --*** User Code, Location: Pre-Notification
90. begin
91.
92. --Bring in Adjustments due to changes on Order Lines
93.
94. cn_global_var.initialize_instance_info(81);
95.
96. XXYH_OIC_COLL_UTILS.PRE_NOTIF_TRIGGER(fromDate, toDate, 2);
97.
98. end;
99. --*** End of User Code, Location: Pre-Notification
100.
101. --
102. -- Insert new lines into cn_not_trx
103. --
104. --CN_DB_PARALLEL_ENABLE :
105. INSERT INTO cn_not_trx (
106. not_trx_id,
107. batch_id,
108. notified_date,
109. notification_run_id,
110. collected_flag,
111. event_id,
112. source_trx_id,
113. source_trx_line_id,
114. source_doc_type,
115. org_id)
116. SELECT
117. cn_not_trx_s.NEXTVAL,
118. x_proc_audit_id,
119. SYSDATE,
120. x_proc_audit_id,
121. 'N',
122. 1000,
123. asoh.header_id, --*** Header Table Key Column
124. xoocsv10000.line_id, --*** Line Table Key Column
125. 'YONT', --*** Source Type
126. 81
127. FROM --*** Line and (optional) Header Table
128. xxyh_oic_om_coll_stg_v xoocsv10000,
129. aso_i_oe_order_headers_v asoh
130. WHERE --*** Header.Primary_Key = Line.Foreign_Key
131. asoh.header_id = xoocsv10000.header_id
132. --*** Any extra user-defined WHERE statement lines
133. AND (xoocsv10000.last_update_date between to_date(FromDate, 'DD-MON-
RRRR') AND TO_DATE(ToDate||' 23:59:59', 'DD-MON-RRRR HH24:MI:SS') or
asoh.booked_date between to_date(FromDate, 'DD-MON-RRRR') AND TO_DATE(ToDate||'
23:59:59', 'DD-MON-RRRR HH24:MI:SS'))
134. AND xoocsv10000.hold_flag ='N'
135. AND xoocsv10000.order_line_status NOT IN ('ENTERED', 'CANCELLED')
136. AND asoh.booked_date is not null
137. AND xoocsv10000.order_type_comm_flag = 'Y'
138. AND INSTR(xoocsv10000.sales_channel_code, 'SAMPLE', 1) = 0
139. --*** End of user-defined WHERE statement lines
140. AND NOT EXISTS (
141. SELECT 1
142. FROM cn_not_trx
143. WHERE source_trx_line_id = xoocsv10000.line_id --***
Line.Primary_Key
144. AND event_id = 1000
145. AND org_id = 81);
146. END; -- Notification Insert Block
147.
148. -- Commit the notification inserts - they are permanent even if
collection fails
149. COMMIT;
150.
151. --******** COLLECT AJUSTMENTS (NEGATE IN API) ********--
152. -- This will negate those adjusted trx in the API table
153. cn_not_trx_grp.col_adjustments(p_api_version => 1.0,
154. x_return_status => x_return_status,
155. x_msg_count => x_msg_count,
156. x_msg_data => x_msg_data,
157. p_org_id => 81);
158.
159.
160. --*** User Code, Location: Post-Notification
161. begin
162.
163. --Perform Gather Stats on Notification Table for Performance
164.
165. DBMS_STATS.GATHER_TABLE_STATS (ownname => 'CN'
166. , tabname => 'CN_NOT_TRX_ALL'
167. , cascade => true
168. , estimate_percent => 100);
169.
170. end;
171. --*** End of User Code, Location: Post-Notification
172.
173. --******** COLLECT PROCESS ********--
174.
175. cn_message_pkg.debug('collect: start collection process.');
176. x_conc_program_id := fnd_global.conc_program_id;
177. cn_message_pkg.debug('collect: entering cursor Batches loop.');
178. fnd_file.put_line(fnd_file.Log, 'collect: entering cursor Batches
loop.');
179.
180. FOR b IN batches LOOP
181.
182. x_batch_id := b.batch_id;
183.
184. x_proc_audit_id := NULL; -- Will get a value in the call below
185. cn_process_audits_pkg.insert_row(x_rowid, x_proc_audit_id,
x_col_audit_id,
186. 'COL','Collection run for batch ' || x_batch_id, NULL, NULL, NULL,
NULL, NULL, SYSDATE, NULL,81);
187.
188. BEGIN
189. SAVEPOINT start_transaction;
190.
191.
192. --******** INSERT CN_COMM_LINES_API *********--
193. cn_message_pkg.debug('Inserting into CN_COMM_LINES_API.');
194. fnd_file.put_line(fnd_file.Log, 'Inserting into
CN_COMM_LINES_API.');
195.
196. --
197. -- Insert new lines into CN_COMM_LINES_API
198. --
199. INSERT INTO cn_comm_lines_api (
200. comm_lines_api_id,
201. conc_batch_id,
202. process_batch_id,
203. org_id,
204. --*** Direct Mapping Destination Columns
205. ATTRIBUTE23, --site_use_id
206. ATTRIBUTE24, --teg_flag
207. ATTRIBUTE25, --vendor_id
208. ATTRIBUTE26, --craft_flag
209. ATTRIBUTE27, --category_level3
210. ATTRIBUTE28, --imp_or_dom
211. ATTRIBUTE29, --category_level2
212. ATTRIBUTE31, --DIVISION
213. ATTRIBUTE32, --party_id||'~'||xoocsv10000.org_id
214. ATTRIBUTE39, --'Y'
215. ATTRIBUTE40, --'Inside Sales'
216. ATTRIBUTE43, --'Inside Sales Rep'
217. ATTRIBUTE51, --sold_to
218. ATTRIBUTE52, -- concat_line_number
219. ATTRIBUTE53, -- 0
220. ATTRIBUTE54, -- order_type
221. ATTRIBUTE55, --order_type_comm_flag
222. ATTRIBUTE56, --federal_excise_tax
223. ATTRIBUTE57, --State_excise_tax
224. ATTRIBUTE58, --order_quantity_uom
225. ATTRIBUTE59, --customer_number
226. ATTRIBUTE60, --order_line_status
227. ATTRIBUTE61, --return_ref_order_num
228. ATTRIBUTE62, --return_ref_line_num
229. ATTRIBUTE63, --crv_charge
230. ATTRIBUTE64, --last_update_date
231. ATTRIBUTE65,
232. ATTRIBUTE66,
233. ATTRIBUTE68,
234. ATTRIBUTE69,
235. ATTRIBUTE70,
236. ATTRIBUTE71,
237. ATTRIBUTE72,
238. ATTRIBUTE74,
239. ATTRIBUTE75,
240. ATTRIBUTE76,
241. ATTRIBUTE77,
242. ATTRIBUTE78,
243. ATTRIBUTE79,
244. ATTRIBUTE80,
245. ATTRIBUTE81,
246. ATTRIBUTE83,
247. ATTRIBUTE84,
248. ATTRIBUTE85,
249. ATTRIBUTE89,
250. BOOKED_DATE,
251. CREATED_BY,
252. CREATION_DATE,
253. CUSTOMER_ID,
254. EMPLOYEE_NUMBER,
255. INVENTORY_ITEM_ID,
256. LAST_UPDATED_BY,
257. LAST_UPDATE_DATE,
258. ORDER_NUMBER,
259. PRESERVE_CREDIT_OVERRIDE_FLAG,
260. PROCESSED_DATE,
261. PROCESSED_PERIOD_ID,
262. QUANTITY,
263. REVENUE_TYPE,
264. ROLLUP_DATE,
265. SALESREP_ID,
266. SHIP_TO_ADDRESS_ID,
267. SOURCE_DOC_TYPE,
268. SOURCE_TRX_ID,
269. SOURCE_TRX_LINE_ID,
270. TRANSACTION_AMOUNT,
271. TRX_ID,
272. TRX_TYPE,
273. UOM_CODE
274. )
275. SELECT
276. cn_comm_lines_api_s.NEXTVAL,
277. x_conc_program_id,
278. x_batch_id,
279. 81,
280. --*** Direct Mapping Source Expressions
281. xoocsv10000.site_use_id||'~'||xoocsv10000.org_id,
282. xoocsv10000.teg_flag,
283. xoocsv10000.vendor_id,
284. xoocsv10000.craft_flag,
285. decode(xoocsv10000.category_level3, 'Sake', 'Y', 'N'),
286. decode(xoocsv10000.imp_or_dom, 'Imported', 'Y', 'N'),
287. UPPER(xoocsv10000.category_level2),
288. NVL((select 'DIVISION '||lkp.attribute2 from fnd_lookup_values_vl
lkp, apps.ap_suppliers aps where lkp.lookup_type = 'XXYH_CMN_SUPPLIER_CHAIN_DIV'
and lkp.lookup_code=aps.segment1 and aps.vendor_id=xoocsv10000.vendor_id),'DIVISION
3'),
289. (SELECT party_id||'~'||xoocsv10000.org_id from HZ_CUST_ACCOUNTS
WHERE CUST_ACCOUNT_ID = xoocsv10000.CUSTOMER_ID),
290.
Decode(NVL(xoocsv10000.RETURN_REF_ORDER_ORD_TYP,xoocsv10000.order_type),'CA-Tel
Sell Order','Y',NULL),
291.
Decode(NVL(xoocsv10000.RETURN_REF_ORDER_ORD_TYP,xoocsv10000.order_type),'CA-Tel
Sell Order','Inside Sales',NULL),
292.
Decode(NVL(xoocsv10000.RETURN_REF_ORDER_ORD_TYP,xoocsv10000.order_type),'CA-Tel
Sell Order','Inside Sales Rep',NULL),
293. xoocsv10000.sold_to,
294. xoocsv10000.concat_line_number,
295. '0',
296. xoocsv10000.order_type,
297. xoocsv10000.order_type_comm_flag,
298. DECODE(INSTR(UPPER(xoocsv10000.SALES_CHANNEL_CODE), 'MILITARY',
1), 0, DECODE(xoocsv10000.TRANSACTION_AMOUNT, 0, 0,
xoocsv10000.federal_excise_tax), 0),
299. DECODE(INSTR(UPPER(xoocsv10000.SALES_CHANNEL_CODE), 'MILITARY',
1), 0, DECODE(xoocsv10000.TRANSACTION_AMOUNT, 0, 0, xoocsv10000.state_excise_tax),
0),
300. xoocsv10000.order_quantity_uom,
301. xoocsv10000.customer_number,
302. xoocsv10000.order_line_status,
303. xoocsv10000.return_ref_order_num,
304. xoocsv10000.return_ref_line_num,
305. NVL(xoocsv10000.crv_charge,0),
306. TO_CHAR(xoocsv10000.last_update_date, 'MM/DD/YYYY HH24:MI:SS'),
307. xoocsv10000.return_reason_code,
308. NVL(xoocsv10000.dock_pickup_allowance,0),
309. xoocsv10000.ITEM_TYPE,
310. NVL(xoocsv10000.gallonage,0),
311. decode(xoocsv10000.category_level2, 'Wine',
xoocsv10000.category_level3||'.'||xoocsv10000.category_level4, null),
312. NVL(xoocsv10000.item_strength,0),
313. NVL(xoocsv10000.item_brand,0),
314. NVL(xoocsv10000.conversion_rate_case,1),
315. 1,
316. xoocsv10000.sales_channel_code,
317. UPPER(xoocsv10000.category_level2),
318. xoocsv10000.ordered_item,
319. xoocsv10000.item_description,
320. DECODE(xoocsv10000.order_quantity_uom, 'CS',
xoocsv10000.ordered_quantity,
round(xoocsv10000.ordered_quantity*xoocsv10000.conversion_rate_case, 4)),
321. xoocsv10000.ordered_quantity,
322. xoocsv10000.cancelled_flag,
323. upper(xoocsv10000.category_level3),
324. xoocsv10000.keg_charge,
325. nvl(xoocsv10000.sugar_tax,0),
326. asoh.booked_date,
327. FND_GLOBAL.USER_ID,
328. SYSDATE,
329. asoh.sold_to_org_id,
330. null,
331. xoocsv10000.inventory_item_id,
332. FND_GLOBAL.USER_ID,
333. SYSDATE,
334. asoh.order_number,
335.
Decode(NVL(xoocsv10000.RETURN_REF_ORDER_ORD_TYP,xoocsv10000.order_type),'CA-Tel
Sell Order','Y',NULL),
336. DECODE((SELECT COUNT(0) FROM cn_acc_period_statuses_v prd WHERE
asoh.booked_date between prd.start_date and prd.end_date and prd.period_status =
'O'), 0, TRUNC(cn_api.next_period(asoh.booked_date, xoocsv10000.org_id), 'MONTH'),
asoh.booked_date),
337. cn_api.get_acc_period_id((DECODE((SELECT COUNT(0) FROM
cn_acc_period_statuses_v prd WHERE asoh.booked_date between prd.start_date and
prd.end_date and prd.period_status = 'O'), 0,
TRUNC(cn_api.next_period(asoh.booked_date, xoocsv10000.org_id), 'MONTH'),
asoh.booked_date)), xoocsv10000.org_id),
338. NVL(xoocsv10000.ordered_quantity,0),
339. 'NONREVENUE',
340. DECODE((SELECT COUNT(0) FROM cn_acc_period_statuses_v prd WHERE
asoh.booked_date between prd.start_date and prd.end_date and prd.period_status =
'O'), 0, TRUNC(cn_api.next_period(asoh.booked_date, xoocsv10000.org_id), 'MONTH'),
asoh.booked_date),
341.
Decode(NVL(xoocsv10000.RETURN_REF_ORDER_ORD_TYP,xoocsv10000.order_type),'CA-Tel
Sell',asoh.salesrep_id,NULL),
342. cn_api.get_site_address_id(asoh.ship_to_org_id,
xoocsv10000.org_id),
343. cnt.source_doc_type,
344. cnt.source_trx_id,
345. cnt.source_trx_line_id,
346. NVL(xoocsv10000.transaction_amount,0),
347. cnt.not_trx_id,
348. DECODE(xoocsv10000.line_category_code, 'RETURN', 'RET', 'ORD'),
349. xoocsv10000.order_quantity_uom
350.
351. FROM --*** Line, (optional) Header, and any Extra Collection
Tables
352. xxyh_oic_om_coll_stg_v xoocsv10000,
353. aso_i_oe_order_headers_v asoh,
354. cn_not_trx cnt
355. WHERE
356. --*** Line.Primary_Key = cnt.source_trx_line_id AND (optional)
Header.Primary_Key = cnt.source_trx_id
357. xoocsv10000.line_id = cnt.source_trx_line_id
358. AND asoh.header_id = cnt.source_trx_id
359. --*** Any extra user-defined WHERE statement lines
360. AND 1 = 0
361. --*** End of user-defined WHERE statement lines
362. AND cnt.event_id = 1000
363. AND cnt.collected_flag = 'N'
364. AND cnt.batch_id = x_batch_id
365. AND cnt.org_id = 81 ;
366.
367. comm_lines_api_count := SQL%ROWCOUNT;
368.
369. cn_message_pkg.debug('Inserted ' || comm_lines_api_count || ' line
records into CN_COMM_LINES_API.');
370. fnd_file.put_line(fnd_file.Log,'Inserted ' || comm_lines_api_count
|| ' line records into CN_COMM_LINES_API.');
371.
372.
373. cn_message_pkg.debug('Updating collected_flag in CN_NOT_TRX .');
374. fnd_file.put_line(fnd_file.Log,'Updating collected_flag in
CN_NOT_TRX .');
375.
376. UPDATE cn_not_trx cnt
377. SET collected_flag = 'Y'
378. WHERE cnt.event_id = 1000
379. AND cnt.collected_flag = 'N'
380. AND cnt.batch_id = x_batch_id
381. AND cnt.org_id = 81 ;
382.
383. cn_message_pkg.debug('Updated collected_flag in cn_not_trx.');
384.
385.
386. --*** User Code, Location: Pre-Api-Update
387. --*** End of User Code, Location: Pre-Api-Update
388.
389.
390. --******** UPDATE CN_COMM_LINES_API ********--
391. --*** Update columns populated by all INDIRECT mappings
392.
393. cn_message_pkg.debug('For all INDIRECT mappings updated ' || SQL
%ROWCOUNT || ' rows in cn_comm_lines_api.');
394. fnd_file.put_line(fnd_file.Log, 'For all INDIRECT mappings updated '
|| SQL%ROWCOUNT || ' rows in cn_comm_lines_api.');
395.
396.
397. --*** User Code, Location: Pre-Api-Filter
398. --*** End of User Code, Location: Pre-Api-Filter
399.
400.
401. --******** FILTER PROCESSING *********--
402. cn_message_pkg.debug('Filtering unwanted transactions from
cn_comm_lines_api.');
403. fnd_file.put_line(fnd_file.Log, 'Filtering unwanted transactions
from cn_comm_lines_api.');
404.
405. --*** User-defined filter statements
406. --*** End of User-defined filter statements
407.
408. --*** User Code, Location: Post-Api-Filter
409. --*** End of User Code, Location: Post-Api-Filter
410.
411. cn_process_audits_pkg.update_row(x_proc_audit_id, NULL, SYSDATE, 0,
'Finished collection run for batch ' || x_batch_id);
412.
413. cn_message_pkg.debug('collect: inside loop<<');
414. fnd_file.put_line(fnd_file.Log, 'collect: inside loop<<');
415. cn_message_pkg.end_batch(x_proc_audit_id);
416. COMMIT;
417.
418. END;
419. END LOOP;
420.
421.
422. --*** User Code, Location: Post-Collection
423. begin
424.
425. --Update Territory Attributes
426.
427. UPDATE cn_comm_lines_api api
428. SET (api.attribute39,
429. api.attribute40,
430. api.attribute42,
431. api.attribute43,
432. api.terr_id,
433. api.terr_name) =
434. (SELECT apio.attribute39,
435. apio.attribute40,
436. apio.attribute42,
437. apio.attribute43,
438. apio.terr_id,
439. apio.terr_name
440. FROM cn_comm_lines_api apio
441. WHERE apio.source_trx_line_id = api.source_trx_line_id
442. AND apio.comm_lines_api_id = api.adj_comm_lines_api_id
443. AND apio.org_id = api.org_id
444. AND apio.terr_id IS NOT NULL),
445. last_update_date = SYSDATE,
446. last_updated_by = fnd_global.user_id
447. WHERE api.terr_id IS NULL
448. AND adjust_status = 'REVERSAL'
449. AND load_status = 'UNLOADED';
450.
451. end;
452. begin
453.
454. -- Reverse out Numeric attributes on Reversal Records
455.
456. UPDATE cn_comm_lines_api api
457. SET
458. (
459. api.attribute56,
460. api.attribute57,
461. api.attribute63,
462. api.attribute66,
463. api.attribute80,
464. api.attribute85,
465. api.attribute89
466. )
467. =
468. (SELECT SIGN(api.quantity)*apio.attribute56,
469. SIGN(api.quantity) *apio.attribute57,
470. SIGN(api.quantity) *apio.attribute63,
471. SIGN(api.quantity) *apio.attribute66,
472. SIGN(api.quantity) *apio.attribute80,
473. SIGN(api.quantity) *apio.attribute85,
474. SIGN(api.quantity) *apio.attribute89
475. FROM cn_comm_lines_api apio
476. WHERE apio.source_trx_line_id = api.source_trx_line_id
477. AND apio.comm_lines_api_id = api.adj_comm_lines_api_id
478. AND apio.org_id = api.org_id
479. ),
480. last_update_date = SYSDATE,
481. last_updated_by = fnd_global.user_id
482. WHERE adjust_status = 'REVERSAL'
483. AND load_status = 'UNLOADED';
484.
485. end;
486. begin
487.
488. --Update Processed Date, Processed Period ID, Rollup Date and Adjust Date for
Reversals
489.
490. UPDATE cn_comm_lines_api api
491. SET api.processed_date = DECODE((SELECT COUNT(0) FROM
cn_acc_period_statuses_v prd WHERE processed_date between prd.start_date and
prd.end_date and prd.period_status = 'O'), 0,
TRUNC(cn_api.next_period(processed_date, org_id), 'MONTH'), processed_date),
492. last_updated_by = fnd_global.user_id,
493. last_update_date = sysdate
494. WHERE adjust_status = 'REVERSAL' AND load_status = 'UNLOADED'
495. AND api.processed_period_id not in (select period_id from cn_period_statuses
where period_status = 'O');
496.
497. UPDATE cn_comm_lines_api api
498. SET api.processed_period_id = cn_api.get_acc_period_id (api.processed_date,
api.org_id),
499. api.rollup_date = api.processed_date,
500. last_updated_by = fnd_global.user_id,
501. last_update_date = sysdate
502. WHERE adjust_status = 'REVERSAL' AND load_status = 'UNLOADED'
503. AND api.processed_period_id not in (select period_id from cn_period_statuses
where period_status = 'O');
504.
505. end;
506. update cn_comm_lines_api_all
507. set processed_date = trunc(booked_date)
508. ,rollup_date = trunc(booked_date)
509. where processed_date = '01-MAY-2018'
510. and processed_date < trunc(booked_date);
511.
512. update cn_commission_headers_all
513. set processed_date = trunc(booked_date)
514. ,rollup_date = trunc(booked_date)
515. where processed_date = '01-MAY-2018'
516. and processed_date < trunc(booked_date)
517. and trx_type != 'GRP';
518.
519. update cn_commission_lines_all lines
520. set lines.processed_date = (select hdr.processed_date
521. from cn_commission_headers_all hdr
522. where hdr.commission_header_id =
lines.commission_header_id
523. )
524. where lines.processed_period_id = 2018005
525. and lines.processed_date = '01-MAY-2018'
526. and lines.trx_type != 'GRP';
527. --*** End of User Code, Location: Post-Collection
528.
529. COMMIT;
530.
531. x_proc_audit_id := x_col_audit_id;
532. cn_message_pkg.debug('collect<<');
533. fnd_file.put_line(fnd_file.Log, 'collect<<');
534. cn_message_pkg.end_batch(x_proc_audit_id);
535.
536.
537. END collect;
538.
539. END;