111:
112: ---FND_FILE.PUT_NAMES('gmfcprc.log','gmfcprc.out','/sqlcom/log/dom1151');
113:
114:
115: gmf_util.msg_log( 'GMF_CPRC_START' );
116: gmf_util.msg_log( 'GMF_CPRC_SRCPARAM', nvl(TO_CHAR(pi_organization_id_from), ' '), nvl(pi_calendar_code_from, ' '), nvl(pi_period_code_from, ' '), nvl(TO_CHAR(pi_cost_type_id_from), ' '), nvl(pi_resource_class, ' '));
117: gmf_util.msg_log( 'GMF_CPRC_TGTPARAM', nvl(TO_CHAR(pi_organization_id_to), ' '), nvl(pi_calendar_code_to, ' '), nvl(pi_period_code_to, ' '), nvl(TO_CHAR(pi_cost_type_id_to), ' '));
118:
119: IF ((pi_period_code_to IS NULL) AND ((pi_all_periods_from IS NOT NULL) OR (pi_all_periods_to IS NOT NULL))) THEN
112: ---FND_FILE.PUT_NAMES('gmfcprc.log','gmfcprc.out','/sqlcom/log/dom1151');
113:
114:
115: gmf_util.msg_log( 'GMF_CPRC_START' );
116: gmf_util.msg_log( 'GMF_CPRC_SRCPARAM', nvl(TO_CHAR(pi_organization_id_from), ' '), nvl(pi_calendar_code_from, ' '), nvl(pi_period_code_from, ' '), nvl(TO_CHAR(pi_cost_type_id_from), ' '), nvl(pi_resource_class, ' '));
117: gmf_util.msg_log( 'GMF_CPRC_TGTPARAM', nvl(TO_CHAR(pi_organization_id_to), ' '), nvl(pi_calendar_code_to, ' '), nvl(pi_period_code_to, ' '), nvl(TO_CHAR(pi_cost_type_id_to), ' '));
118:
119: IF ((pi_period_code_to IS NULL) AND ((pi_all_periods_from IS NOT NULL) OR (pi_all_periods_to IS NOT NULL))) THEN
120: gmf_util.msg_log('GMF_CPRC_PERIODS_RANGE', nvl(pi_all_periods_from, ' '), nvl(pi_all_periods_to, ' '), nvl(pi_calendar_code_to, ' ')) ;
113:
114:
115: gmf_util.msg_log( 'GMF_CPRC_START' );
116: gmf_util.msg_log( 'GMF_CPRC_SRCPARAM', nvl(TO_CHAR(pi_organization_id_from), ' '), nvl(pi_calendar_code_from, ' '), nvl(pi_period_code_from, ' '), nvl(TO_CHAR(pi_cost_type_id_from), ' '), nvl(pi_resource_class, ' '));
117: gmf_util.msg_log( 'GMF_CPRC_TGTPARAM', nvl(TO_CHAR(pi_organization_id_to), ' '), nvl(pi_calendar_code_to, ' '), nvl(pi_period_code_to, ' '), nvl(TO_CHAR(pi_cost_type_id_to), ' '));
118:
119: IF ((pi_period_code_to IS NULL) AND ((pi_all_periods_from IS NOT NULL) OR (pi_all_periods_to IS NOT NULL))) THEN
120: gmf_util.msg_log('GMF_CPRC_PERIODS_RANGE', nvl(pi_all_periods_from, ' '), nvl(pi_all_periods_to, ' '), nvl(pi_calendar_code_to, ' ')) ;
121: END IF ;
116: gmf_util.msg_log( 'GMF_CPRC_SRCPARAM', nvl(TO_CHAR(pi_organization_id_from), ' '), nvl(pi_calendar_code_from, ' '), nvl(pi_period_code_from, ' '), nvl(TO_CHAR(pi_cost_type_id_from), ' '), nvl(pi_resource_class, ' '));
117: gmf_util.msg_log( 'GMF_CPRC_TGTPARAM', nvl(TO_CHAR(pi_organization_id_to), ' '), nvl(pi_calendar_code_to, ' '), nvl(pi_period_code_to, ' '), nvl(TO_CHAR(pi_cost_type_id_to), ' '));
118:
119: IF ((pi_period_code_to IS NULL) AND ((pi_all_periods_from IS NOT NULL) OR (pi_all_periods_to IS NOT NULL))) THEN
120: gmf_util.msg_log('GMF_CPRC_PERIODS_RANGE', nvl(pi_all_periods_from, ' '), nvl(pi_all_periods_to, ' '), nvl(pi_calendar_code_to, ' ')) ;
121: END IF ;
122:
123: l_ins_rows := 0;
124: l_upd_rows := 0;
136: l_period_id_from := NULL;
137: END;
138:
139: IF (l_period_id_from IS NULL) THEN
140: gmf_util.msg_log ('GMF_CP_NO_ROWS');
141: RAISE e_no_cost_rows;
142: END IF;
143: IF (pi_period_code_to IS NOT NULL) THEN
144: BEGIN
154: pi_period_id_to := NULL;
155: END;
156:
157: IF (pi_period_id_to IS NULL) THEN
158: gmf_util.msg_log ('GMF_CP_NO_ROWS');
159: RAISE e_no_cost_rows;
160: END IF;
161: END IF;
162:
163: --jboppana has to uncomment after testing
164: --l_num_src_rows := do_costs_exist( pi_organization_id_from, l_period_id_from, pi_resource_class);
165:
166: IF (l_num_src_rows <= 0) THEN
167: gmf_util.msg_log ('GMF_CP_NO_ROWS');
168: RAISE e_no_cost_rows;
169: END IF;
170:
171: l_sql_rsrc := '' ;
192: END IF ;
193:
194: l_sql_rsrc := l_sql_rsrc || ' ORDER BY ' || ' d.resources' ;
195:
196: gmf_util.trace( 'Resource Query : ' || l_sql_rsrc, 1 ) ;
197:
198: /**************************************************************************
199: * Build SQL to get target Orgs when from/to orgns are not null. *
200: * IF (pi_all_orgn_from IS NOT NULL) AND (pi_all_orgn_to IS NOT NULL) THEN *
258: END IF ;
259:
260: END IF;
261:
262: gmf_util.trace( 'Periods Query : ' || l_sql_periods, 1 ) ;
263: gmf_util.trace( 'Orgn Query : ' || l_sql_orgn, 1 ) ;
264:
265: /*********************************************************************************
266: * Do not pass the l_from_range and l_to_range if resource class is not specified *
259:
260: END IF;
261:
262: gmf_util.trace( 'Periods Query : ' || l_sql_periods, 1 ) ;
263: gmf_util.trace( 'Orgn Query : ' || l_sql_orgn, 1 ) ;
264:
265: /*********************************************************************************
266: * Do not pass the l_from_range and l_to_range if resource class is not specified *
267: *********************************************************************************/
309:
310: FETCH cv_orgn INTO l_organization_id_to ;
311: EXIT WHEN cv_orgn%NOTFOUND ;
312:
313: gmf_util.trace( 'Values : ' || rec_rsrc_dtl.resources || ' - ' || rec_rsrc_dtl.usage_uom || ' - ' || to_char(rec_rsrc_dtl.nominal_cost), 1 );
314: gmf_util.msg_log('GMF_CPRC_ORGPRD', nvl(TO_CHAR(l_organization_id_to), ' '), nvl(TO_CHAR(l_period_id_to),' '));
315:
316: UPDATE cm_rsrc_dtl
317: SET usage_uom = rec_rsrc_dtl.usage_uom,
310: FETCH cv_orgn INTO l_organization_id_to ;
311: EXIT WHEN cv_orgn%NOTFOUND ;
312:
313: gmf_util.trace( 'Values : ' || rec_rsrc_dtl.resources || ' - ' || rec_rsrc_dtl.usage_uom || ' - ' || to_char(rec_rsrc_dtl.nominal_cost), 1 );
314: gmf_util.msg_log('GMF_CPRC_ORGPRD', nvl(TO_CHAR(l_organization_id_to), ' '), nvl(TO_CHAR(l_period_id_to),' '));
315:
316: UPDATE cm_rsrc_dtl
317: SET usage_uom = rec_rsrc_dtl.usage_uom,
318: nominal_cost = rec_rsrc_dtl.nominal_cost,
328:
329: IF SQL%ROWCOUNT > 0 THEN
330:
331: l_upd_rows := l_upd_rows + SQL%ROWCOUNT;
332: gmf_util.trace( 'Updated ' || TO_CHAR(SQL%ROWCOUNT) || ' rows', 1 );
333:
334: ELSE
335:
336: INSERT INTO cm_rsrc_dtl
368: 0
369: );
370:
371: l_ins_rows := l_ins_rows + SQL%ROWCOUNT;
372: gmf_util.trace( 'Inserted ' || TO_CHAR(SQL%ROWCOUNT) || ' rows', 1 );
373:
374: END IF;
375: END LOOP; -- end of cursor for loop for Orgs
376: END LOOP; -- end of cursor for loop for periods
375: END LOOP; -- end of cursor for loop for Orgs
376: END LOOP; -- end of cursor for loop for periods
377: END LOOP; -- end of cursor for loop for resources
378:
379: gmf_util.msg_log( 'GMF_CP_ROWS_SELECTED', TO_CHAR(l_ins_rows + l_upd_rows) );
380: gmf_util.msg_log( 'GMF_CP_ROWS_UPDINS', TO_CHAR(l_upd_rows), TO_CHAR(l_ins_rows) );
381: gmf_util.log;
382: gmf_util.msg_log( 'GMF_CPRC_END' );
383:
376: END LOOP; -- end of cursor for loop for periods
377: END LOOP; -- end of cursor for loop for resources
378:
379: gmf_util.msg_log( 'GMF_CP_ROWS_SELECTED', TO_CHAR(l_ins_rows + l_upd_rows) );
380: gmf_util.msg_log( 'GMF_CP_ROWS_UPDINS', TO_CHAR(l_upd_rows), TO_CHAR(l_ins_rows) );
381: gmf_util.log;
382: gmf_util.msg_log( 'GMF_CPRC_END' );
383:
384: po_retcode := 0;
377: END LOOP; -- end of cursor for loop for resources
378:
379: gmf_util.msg_log( 'GMF_CP_ROWS_SELECTED', TO_CHAR(l_ins_rows + l_upd_rows) );
380: gmf_util.msg_log( 'GMF_CP_ROWS_UPDINS', TO_CHAR(l_upd_rows), TO_CHAR(l_ins_rows) );
381: gmf_util.log;
382: gmf_util.msg_log( 'GMF_CPRC_END' );
383:
384: po_retcode := 0;
385: po_errbuf := NULL;
378:
379: gmf_util.msg_log( 'GMF_CP_ROWS_SELECTED', TO_CHAR(l_ins_rows + l_upd_rows) );
380: gmf_util.msg_log( 'GMF_CP_ROWS_UPDINS', TO_CHAR(l_upd_rows), TO_CHAR(l_ins_rows) );
381: gmf_util.log;
382: gmf_util.msg_log( 'GMF_CPRC_END' );
383:
384: po_retcode := 0;
385: po_errbuf := NULL;
386: end_copy('NORMAL', NULL);