110: p_params IN conc_params,
111: x_request_id OUT NOCOPY NUMBER
112: ) IS
113: BEGIN
114: fnd_file.put_line(fnd_file.log, 'Conc_submit BatchId = ' || p_batch_id);
115:
116: x_request_id := fnd_request.submit_request(application => 'CN',
117: program => p_conc_program,
118: description => p_description,
122: argument4 => p_org_id
123: );
124: IF x_request_id = 0
125: THEN
126: fnd_file.put_line(fnd_file.log, 'Failed to create concurrent request for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id);
127: fnd_file.put_line(fnd_file.log, 'Conc_submit: ' || fnd_message.get);
128: raise fnd_api.G_EXC_ERROR;
129: ELSE
130: fnd_file.put_line(fnd_file.log, 'Concurrent request, ID = ' || x_request_id || ', for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id );
123: );
124: IF x_request_id = 0
125: THEN
126: fnd_file.put_line(fnd_file.log, 'Failed to create concurrent request for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id);
127: fnd_file.put_line(fnd_file.log, 'Conc_submit: ' || fnd_message.get);
128: raise fnd_api.G_EXC_ERROR;
129: ELSE
130: fnd_file.put_line(fnd_file.log, 'Concurrent request, ID = ' || x_request_id || ', for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id );
131: END IF;
126: fnd_file.put_line(fnd_file.log, 'Failed to create concurrent request for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id);
127: fnd_file.put_line(fnd_file.log, 'Conc_submit: ' || fnd_message.get);
128: raise fnd_api.G_EXC_ERROR;
129: ELSE
130: fnd_file.put_line(fnd_file.log, 'Concurrent request, ID = ' || x_request_id || ', for (payrun_id,batch_id) = ' || p_payrun_id ||','|| p_batch_id );
131: END IF;
132:
133: EXCEPTION
134: WHEN OTHERS THEN
131: END IF;
132:
133: EXCEPTION
134: WHEN OTHERS THEN
135: fnd_file.put_line(fnd_file.log, 'Conc_submit err:' || SQLERRM);
136: RAISE;
137: END conc_submit;
138:
139:
2104: --
2105: -- API body
2106: --
2107: l_start_time := SYSDATE;
2108: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
2109: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
2110: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2111:
2112: l_worksheet_rec.payrun_id := p_payrun_id;
2105: -- API body
2106: --
2107: l_start_time := SYSDATE;
2108: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
2109: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
2110: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2111:
2112: l_worksheet_rec.payrun_id := p_payrun_id;
2113: l_worksheet_rec.org_id := p_org_id;
2106: --
2107: l_start_time := SYSDATE;
2108: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
2109: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
2110: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2111:
2112: l_worksheet_rec.payrun_id := p_payrun_id;
2113: l_worksheet_rec.org_id := p_org_id;
2114: l_worksheet_rec.call_from := cn_payment_worksheet_pvt.concurrent_program_call;
2122: -- Run create worksheet for this salesrep.
2123: l_worksheet_rec.salesrep_id := emp.salesrep_id;
2124: l_worksheet_rec.call_from := cn_payment_worksheet_pvt.concurrent_program_call;
2125:
2126: fnd_file.put_line(fnd_file.log, ' Create worksheet for = ' || l_worksheet_rec.salesrep_id || ' salesrepID');
2127:
2128: cn_payment_worksheet_pvt.create_worksheet(p_api_version => 1.0,
2129: p_init_msg_list => 'T',
2130: p_commit => 'F',
2139: IF x_return_status <> fnd_api.g_ret_sts_success
2140: THEN
2141: l_error_count := l_error_count + 1;
2142: cn_message_pkg.debug('Error when creating Worksheet for : ' || l_worksheet_rec.salesrep_id);
2143: fnd_file.put_line(fnd_file.log, 'Failed to create worksheet for ' || l_worksheet_rec.salesrep_id);
2144: FOR i IN 1 .. x_msg_count
2145: LOOP
2146: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
2147: END LOOP;
2142: cn_message_pkg.debug('Error when creating Worksheet for : ' || l_worksheet_rec.salesrep_id);
2143: fnd_file.put_line(fnd_file.log, 'Failed to create worksheet for ' || l_worksheet_rec.salesrep_id);
2144: FOR i IN 1 .. x_msg_count
2145: LOOP
2146: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
2147: END LOOP;
2148: fnd_file.put_line(fnd_file.log, '+------------------------------+');
2149: ROLLBACK;
2150: ELSE
2144: FOR i IN 1 .. x_msg_count
2145: LOOP
2146: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
2147: END LOOP;
2148: fnd_file.put_line(fnd_file.log, '+------------------------------+');
2149: ROLLBACK;
2150: ELSE
2151: COMMIT;
2152: END IF;
2157: IF l_error_count <> 0
2158: THEN
2159: retcode := 2;
2160: errbuf := ' Batch# '||p_batch_id||' : Creation of worksheets was not successful for some resources. Count = ' || to_char(l_error_count) ;
2161: fnd_file.put_line(fnd_file.log,errbuf) ;
2162: END IF;
2163:
2164: fnd_file.put_line(fnd_file.log, ' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2165: fnd_file.put_line(fnd_file.log, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
2160: errbuf := ' Batch# '||p_batch_id||' : Creation of worksheets was not successful for some resources. Count = ' || to_char(l_error_count) ;
2161: fnd_file.put_line(fnd_file.log,errbuf) ;
2162: END IF;
2163:
2164: fnd_file.put_line(fnd_file.log, ' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2165: fnd_file.put_line(fnd_file.log, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
2166:
2167: EXCEPTION
2168: WHEN OTHERS THEN
2161: fnd_file.put_line(fnd_file.log,errbuf) ;
2162: END IF;
2163:
2164: fnd_file.put_line(fnd_file.log, ' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
2165: fnd_file.put_line(fnd_file.log, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
2166:
2167: EXCEPTION
2168: WHEN OTHERS THEN
2169: fnd_file.put_line(fnd_file.log, 'Unexpected exception in processing the (payrun_id,batch) = ' || p_payrun_id || ',' || p_batch_id);
2165: fnd_file.put_line(fnd_file.log, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
2166:
2167: EXCEPTION
2168: WHEN OTHERS THEN
2169: fnd_file.put_line(fnd_file.log, 'Unexpected exception in processing the (payrun_id,batch) = ' || p_payrun_id || ',' || p_batch_id);
2170: fnd_file.put_line(fnd_file.log, SQLERRM);
2171: RAISE;
2172: END create_multiple_worksheets;
2173:
2166:
2167: EXCEPTION
2168: WHEN OTHERS THEN
2169: fnd_file.put_line(fnd_file.log, 'Unexpected exception in processing the (payrun_id,batch) = ' || p_payrun_id || ',' || p_batch_id);
2170: fnd_file.put_line(fnd_file.log, SQLERRM);
2171: RAISE;
2172: END create_multiple_worksheets;
2173:
2174:
2241: AND cnspa.org_id = cnp.org_id)));
2242:
2243: l_has_access BOOLEAN;
2244: BEGIN
2245: fnd_file.put_line(fnd_file.log, 'Entering create_mult_worksheet_conc ');
2246: retcode := 0;
2247: --Added for R12 payment security check begin.
2248: l_has_access := cn_payment_security_pvt.get_security_access(cn_payment_security_pvt.g_type_wksht, cn_payment_security_pvt.g_access_wksht_create);
2249: --Get the salesrep batch size from profile option.
2247: --Added for R12 payment security check begin.
2248: l_has_access := cn_payment_security_pvt.get_security_access(cn_payment_security_pvt.g_type_wksht, cn_payment_security_pvt.g_access_wksht_create);
2249: --Get the salesrep batch size from profile option.
2250: l_batch_sz := nvl(fnd_profile.value('CN_PMT_SRP_BATCH_SIZE'),251);
2251: fnd_file.put_line(fnd_file.log,'Batch size : ' ||l_batch_sz);
2252:
2253: IF l_batch_sz < 1
2254: THEN
2255: errmsg := 'The batch size should be greater than zero.';
2252:
2253: IF l_batch_sz < 1
2254: THEN
2255: errmsg := 'The batch size should be greater than zero.';
2256: fnd_file.put_line(fnd_file.log, errmsg);
2257: raise_application_error(-20000, errmsg);
2258: END IF;
2259:
2260: IF (l_has_access = FALSE) THEN
2272: CLOSE get_payrun_id_curs;
2273: IF l_status <> 'UNPAID'
2274: THEN
2275: errmsg := 'Worksheets can only be created for payruns in UNPAID status.';
2276: fnd_file.put_line(fnd_file.log, errmsg);
2277: raise_application_error(-20000, errmsg);
2278: END IF;
2279: cn_message_pkg.begin_batch(x_process_type => 'WKSHT',
2280: x_process_audit_id => l_proc_audit_id,
2340:
2341: EXCEPTION
2342: WHEN no_data_found THEN
2343: errmsg := 'No salesreps found that were eligible for worksheet creation in the payrun : ';
2344: fnd_file.put_line(fnd_file.log, errmsg);
2345: retcode := 2;
2346: errbuf := errmsg;
2347: RAISE ;
2348: WHEN OTHERS THEN
2345: retcode := 2;
2346: errbuf := errmsg;
2347: RAISE ;
2348: WHEN OTHERS THEN
2349: fnd_file.put_line(fnd_file.log, 'Unexpected exception in cn_payment_worksheet_pvt.create_mult_worksheet_conc');
2350: fnd_file.put_line(fnd_file.log, errmsg);
2351: fnd_file.put_line(fnd_file.log, SQLERRM);
2352: RAISE;
2353: END;
2346: errbuf := errmsg;
2347: RAISE ;
2348: WHEN OTHERS THEN
2349: fnd_file.put_line(fnd_file.log, 'Unexpected exception in cn_payment_worksheet_pvt.create_mult_worksheet_conc');
2350: fnd_file.put_line(fnd_file.log, errmsg);
2351: fnd_file.put_line(fnd_file.log, SQLERRM);
2352: RAISE;
2353: END;
2354:
2347: RAISE ;
2348: WHEN OTHERS THEN
2349: fnd_file.put_line(fnd_file.log, 'Unexpected exception in cn_payment_worksheet_pvt.create_mult_worksheet_conc');
2350: fnd_file.put_line(fnd_file.log, errmsg);
2351: fnd_file.put_line(fnd_file.log, SQLERRM);
2352: RAISE;
2353: END;
2354:
2355:
2352: RAISE;
2353: END;
2354:
2355:
2356: fnd_file.put_line(fnd_file.log, errbuf);
2357: fnd_file.put_line(fnd_file.log, 'Count of worksheets to be created = ' || salesrep_t.COUNT);
2358: fnd_file.put_line(fnd_file.log, 'Completed create worksheet process....');
2359:
2360: IF l_return_status <> fnd_api.g_ret_sts_success
2353: END;
2354:
2355:
2356: fnd_file.put_line(fnd_file.log, errbuf);
2357: fnd_file.put_line(fnd_file.log, 'Count of worksheets to be created = ' || salesrep_t.COUNT);
2358: fnd_file.put_line(fnd_file.log, 'Completed create worksheet process....');
2359:
2360: IF l_return_status <> fnd_api.g_ret_sts_success
2361: THEN
2354:
2355:
2356: fnd_file.put_line(fnd_file.log, errbuf);
2357: fnd_file.put_line(fnd_file.log, 'Count of worksheets to be created = ' || salesrep_t.COUNT);
2358: fnd_file.put_line(fnd_file.log, 'Completed create worksheet process....');
2359:
2360: IF l_return_status <> fnd_api.g_ret_sts_success
2361: THEN
2362: retcode := 2;
4138: BEGIN
4139: -- Standard Start of API savepoint
4140: SAVEPOINT generic_conc_processor;
4141: -- SUBMIT BATCHES
4142: fnd_file.put_line(fnd_file.LOG,'Start the batching process for payrun_id = ' || p_payrun_id);
4143: l_org_id := p_org_id;
4144: BEGIN
4145: -- lock payrun when when batching
4146: BEGIN
4151: FOR UPDATE NOWAIT;
4152:
4153: EXCEPTION
4154: WHEN NO_DATA_FOUND THEN
4155: fnd_file.put_line(fnd_file.LOG,'Invalid payrun. Could not find payrun with ID = ' || l_payrun_id);
4156: cn_message_pkg.debug('Invalid payrun. Could not find payrun with ID = ' || l_payrun_id);
4157: RAISE ;
4158: END;
4159:
4163: SELECT cn_process_batches_s2.NEXTVAL
4164: INTO l_logical_batch_id
4165: FROM sys.dual;
4166:
4167: fnd_file.put_line(fnd_file.LOG,'Logical Batch ID in cn_process_batches_all = ' || l_logical_batch_id);
4168:
4169: FOR currbatch IN 1 .. l_max_batch_id
4170: LOOP
4171:
4226: /***************** Launching Threads ***********************/
4227: l_job_count := l_job_count + 1;
4228:
4229: -- SUBMIT BATCHES
4230: fnd_file.put_line(fnd_file.LOG,' Now submit physical batch id ' || l_physical_batch_id);
4231:
4232: conc_submit(p_conc_program => p_params.conc_program_name,
4233: p_description => 'Runner physical batch ID ' || l_physical_batch_id,
4234: p_logical_batch_id => l_logical_batch_id,
4236: p_org_id => l_org_id,
4237: p_payrun_id => l_payrun_id,
4238: x_request_id => l_request_id,
4239: p_params => p_params);
4240: fnd_file.put_line(fnd_file.LOG,' Created child concurrent request. ID = ' || l_request_id);
4241:
4242: END LOOP; --currbatch
4243:
4244: EXCEPTION
4250: err_num := SQLCODE;
4251: IF err_num = -54
4252: THEN
4253: errmsg := 'This payrun is already involved in another process. Please try again later.';
4254: fnd_file.put_line(fnd_file.log, errmsg);
4255: x_errbuf := errmsg ;
4256: raise_application_error(-20000, errmsg);
4257: ELSE
4258: RAISE;
4282: LOOP
4283: l_error_count := l_error_count + 1;
4284: IF l_error_count = 1
4285: THEN
4286: fnd_file.put_line(fnd_file.log, 'ERRORED REQUESTS');
4287: fnd_file.put_line(fnd_file.log, '================');
4288: END IF;
4289: fnd_file.put_line(fnd_file.LOG,' ' || rs_errors.request_id || ' @ ' || rs_errors.actual_completion_date || ' due to ' || rs_errors.completion_text);
4290: END LOOP;
4283: l_error_count := l_error_count + 1;
4284: IF l_error_count = 1
4285: THEN
4286: fnd_file.put_line(fnd_file.log, 'ERRORED REQUESTS');
4287: fnd_file.put_line(fnd_file.log, '================');
4288: END IF;
4289: fnd_file.put_line(fnd_file.LOG,' ' || rs_errors.request_id || ' @ ' || rs_errors.actual_completion_date || ' due to ' || rs_errors.completion_text);
4290: END LOOP;
4291:
4285: THEN
4286: fnd_file.put_line(fnd_file.log, 'ERRORED REQUESTS');
4287: fnd_file.put_line(fnd_file.log, '================');
4288: END IF;
4289: fnd_file.put_line(fnd_file.LOG,' ' || rs_errors.request_id || ' @ ' || rs_errors.actual_completion_date || ' due to ' || rs_errors.completion_text);
4290: END LOOP;
4291:
4292: -- Count the warning batches
4293: l_warning_count := 0;
4297: FROM fnd_concurrent_requests fcr
4298: WHERE parent_request_id = l_conc_request_id
4299: AND upper(status_code) = 'G';
4300:
4301: fnd_file.put_line(fnd_file.log, 'WARNING REQUESTS: ' || l_warning_count);
4302: EXCEPTION
4303: WHEN no_data_found THEN
4304: NULL;
4305: WHEN OTHERS THEN
4302: EXCEPTION
4303: WHEN no_data_found THEN
4304: NULL;
4305: WHEN OTHERS THEN
4306: fnd_file.put_line(fnd_file.log, 'Error getting warnings: ' || SQLERRM);
4307: END;
4308:
4309: duration := (SYSDATE - mysysdate) * 1440;
4310:
4326: EXCEPTION
4327: WHEN OTHERS THEN
4328: x_retcode := 2;
4329: x_errbuf := x_errbuf || '. Error processing payrun ID = ' || l_payrun_id ;
4330: fnd_file.put_line(fnd_file.log, x_errbuf);
4331: RAISE ;
4332: END generic_conc_processor;
4333:
4334: --============================================================================
4375: AND wk.payrun_id = c_payrun_id
4376: AND wk.org_id = mo_global.get_current_org_id);
4377:
4378: BEGIN
4379: fnd_file.put_line(fnd_file.log, 'Input Parameters Payrun_Name =' || p_name);
4380: l_has_access := cn_payment_security_pvt.get_security_access(cn_payment_security_pvt.g_type_wksht, cn_payment_security_pvt.g_access_payrun_refresh);
4381: --Get the salesrep batch size from profile option.
4382: l_batch_sz := nvl(fnd_profile.value('CN_PMT_SRP_BATCH_SIZE'),251);
4383: fnd_file.put_line(fnd_file.log, 'Batch Size =' || to_char(l_batch_sz));
4379: fnd_file.put_line(fnd_file.log, 'Input Parameters Payrun_Name =' || p_name);
4380: l_has_access := cn_payment_security_pvt.get_security_access(cn_payment_security_pvt.g_type_wksht, cn_payment_security_pvt.g_access_payrun_refresh);
4381: --Get the salesrep batch size from profile option.
4382: l_batch_sz := nvl(fnd_profile.value('CN_PMT_SRP_BATCH_SIZE'),251);
4383: fnd_file.put_line(fnd_file.log, 'Batch Size =' || to_char(l_batch_sz));
4384:
4385: IF l_batch_sz < 1
4386: THEN
4387: errmsg := 'The batch size should be greater than zero.';
4384:
4385: IF l_batch_sz < 1
4386: THEN
4387: errmsg := 'The batch size should be greater than zero.';
4388: fnd_file.put_line(fnd_file.log, errmsg);
4389: raise_application_error(-20000, errmsg);
4390: END IF;
4391:
4392: -- TODO Handle error message
4397: CLOSE get_payrun_id_curs;
4398: EXCEPTION
4399: WHEN NO_DATA_FOUND THEN
4400: errmsg := 'Invalid payrun name. Could not find payrun with the name = ' || p_name;
4401: fnd_file.put_line(fnd_file.log, errmsg);
4402: raise_application_error(-20000, errmsg);
4403: END;
4404:
4405: IF l_status NOT IN ('UNPAID')
4441:
4442: EXCEPTION
4443: WHEN no_data_found THEN
4444: errmsg := 'No salesreps found that were eligible for worksheet creation in the payrun : ';
4445: fnd_file.put_line(fnd_file.log, errmsg);
4446: retcode := 2;
4447: errbuf := errmsg;
4448: RAISE ;
4449: END;
4447: errbuf := errmsg;
4448: RAISE ;
4449: END;
4450:
4451: fnd_file.put_line(fnd_file.log, errbuf);
4452: fnd_file.put_line(fnd_file.LOG,' Count of worksheets to be refreshed = ' || salesrep_t.COUNT);
4453: fnd_file.put_line(fnd_file.log,' Completed refresh worksheet process....');
4454:
4455: EXCEPTION
4448: RAISE ;
4449: END;
4450:
4451: fnd_file.put_line(fnd_file.log, errbuf);
4452: fnd_file.put_line(fnd_file.LOG,' Count of worksheets to be refreshed = ' || salesrep_t.COUNT);
4453: fnd_file.put_line(fnd_file.log,' Completed refresh worksheet process....');
4454:
4455: EXCEPTION
4456: WHEN OTHERS THEN
4449: END;
4450:
4451: fnd_file.put_line(fnd_file.log, errbuf);
4452: fnd_file.put_line(fnd_file.LOG,' Count of worksheets to be refreshed = ' || salesrep_t.COUNT);
4453: fnd_file.put_line(fnd_file.log,' Completed refresh worksheet process....');
4454:
4455: EXCEPTION
4456: WHEN OTHERS THEN
4457: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in cn_payment_worksheet_pvt.refresh_worksheet_parent');
4453: fnd_file.put_line(fnd_file.log,' Completed refresh worksheet process....');
4454:
4455: EXCEPTION
4456: WHEN OTHERS THEN
4457: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in cn_payment_worksheet_pvt.refresh_worksheet_parent');
4458: fnd_file.put_line(fnd_file.log, errmsg);
4459: fnd_file.put_line(fnd_file.log, SQLERRM);
4460: RAISE;
4461: END refresh_worksheet_parent;
4454:
4455: EXCEPTION
4456: WHEN OTHERS THEN
4457: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in cn_payment_worksheet_pvt.refresh_worksheet_parent');
4458: fnd_file.put_line(fnd_file.log, errmsg);
4459: fnd_file.put_line(fnd_file.log, SQLERRM);
4460: RAISE;
4461: END refresh_worksheet_parent;
4462:
4455: EXCEPTION
4456: WHEN OTHERS THEN
4457: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in cn_payment_worksheet_pvt.refresh_worksheet_parent');
4458: fnd_file.put_line(fnd_file.log, errmsg);
4459: fnd_file.put_line(fnd_file.log, SQLERRM);
4460: RAISE;
4461: END refresh_worksheet_parent;
4462:
4463: --============================================================================
4487: l_error_count NUMBER := 0;
4488: l_ovn cn_payment_worksheets.object_version_number%TYPE;
4489: BEGIN
4490: l_start_time := SYSDATE;
4491: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
4492: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
4493: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4494:
4495: l_worksheet_rec.payrun_id := p_payrun_id;
4488: l_ovn cn_payment_worksheets.object_version_number%TYPE;
4489: BEGIN
4490: l_start_time := SYSDATE;
4491: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
4492: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
4493: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4494:
4495: l_worksheet_rec.payrun_id := p_payrun_id;
4496: l_worksheet_rec.org_id := p_org_id;
4489: BEGIN
4490: l_start_time := SYSDATE;
4491: fnd_file.put_line(fnd_file.log, ' Input Parameters Payrun_id = ' || p_payrun_id);
4492: fnd_file.put_line(fnd_file.log, ' Input Parameters Batch_id = ' || p_batch_id);
4493: fnd_file.put_line(fnd_file.log, ' Current time = ' || to_char(l_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4494:
4495: l_worksheet_rec.payrun_id := p_payrun_id;
4496: l_worksheet_rec.org_id := p_org_id;
4497:
4510: WHERE wk.payrun_id = l_worksheet_rec.payrun_id
4511: AND wk.salesrep_id = l_worksheet_rec.salesrep_id
4512: AND quota_id IS NULL;
4513:
4514: fnd_file.put_line(fnd_file.log,'Refresh worksheet for = ' || l_worksheet_rec.salesrep_id || ' salesrepID');
4515:
4516: cn_payment_worksheet_pvt.update_worksheet(p_api_version => 1.0,
4517: p_init_msg_list => 'T',
4518: p_commit => 'F',
4534: l_error_count := l_error_count + 1;
4535:
4536: --ROLLBACK TO create_single_worksheet;
4537: cn_message_pkg.debug('Error when refreshing Worksheet for : ' || l_worksheet_rec.salesrep_id);
4538: fnd_file.put_line(fnd_file.log,'Failed to refresh worksheet for ' || l_worksheet_rec.salesrep_id);
4539:
4540: FOR i IN 1 .. x_msg_count
4541: LOOP
4542: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
4538: fnd_file.put_line(fnd_file.log,'Failed to refresh worksheet for ' || l_worksheet_rec.salesrep_id);
4539:
4540: FOR i IN 1 .. x_msg_count
4541: LOOP
4542: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
4543: END LOOP;
4544: fnd_file.put_line(fnd_file.log, '+------------------------------+');
4545: ROLLBACK;
4546:
4540: FOR i IN 1 .. x_msg_count
4541: LOOP
4542: fnd_file.put_line(fnd_file.log, 'msg: ' || fnd_msg_pub.get(i, 'F'));
4543: END LOOP;
4544: fnd_file.put_line(fnd_file.log, '+------------------------------+');
4545: ROLLBACK;
4546:
4547: ELSE
4548:
4552: IF l_error_count <> 0
4553: THEN
4554: retcode := 2;
4555: errbuf := ' Batch# ' || p_batch_id || ' : Refresh of worksheets was not successful for some resources. Count = ' || to_char(l_error_count);
4556: fnd_file.put_line(fnd_file.log, errbuf);
4557: END IF;
4558:
4559: fnd_file.put_line(fnd_file.LOG,' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4560: fnd_file.put_line(fnd_file.LOG, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
4555: errbuf := ' Batch# ' || p_batch_id || ' : Refresh of worksheets was not successful for some resources. Count = ' || to_char(l_error_count);
4556: fnd_file.put_line(fnd_file.log, errbuf);
4557: END IF;
4558:
4559: fnd_file.put_line(fnd_file.LOG,' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4560: fnd_file.put_line(fnd_file.LOG, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
4561:
4562: EXCEPTION
4563: WHEN OTHERS THEN
4556: fnd_file.put_line(fnd_file.log, errbuf);
4557: END IF;
4558:
4559: fnd_file.put_line(fnd_file.LOG,' Finish time = ' || to_char(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS'));
4560: fnd_file.put_line(fnd_file.LOG, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
4561:
4562: EXCEPTION
4563: WHEN OTHERS THEN
4564: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in processing the (payrun_id,batch) = ' ||p_payrun_id || ',' || p_batch_id);
4560: fnd_file.put_line(fnd_file.LOG, ' Batch time = ' || (SYSDATE - l_start_time) * 1400 || ' minutes ');
4561:
4562: EXCEPTION
4563: WHEN OTHERS THEN
4564: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in processing the (payrun_id,batch) = ' ||p_payrun_id || ',' || p_batch_id);
4565: fnd_file.put_line(fnd_file.log, SQLERRM);
4566: RAISE;
4567:
4568: END refresh_worksheet_child;
4561:
4562: EXCEPTION
4563: WHEN OTHERS THEN
4564: fnd_file.put_line(fnd_file.LOG,'Unexpected exception in processing the (payrun_id,batch) = ' ||p_payrun_id || ',' || p_batch_id);
4565: fnd_file.put_line(fnd_file.log, SQLERRM);
4566: RAISE;
4567:
4568: END refresh_worksheet_child;
4569: