这两天一直在研究Oracle ADF,做了一个小Demo,实现对数据的增删查改(CRUD)操作。主界面如图所示,界面也比较简单,纯粹是为了了解ADF开发流程的Demo。开发工具:JDeveloper Studio 11.1.1.6.0。
源码地址:http://pan.baidu.com/s/1gd8OazD ,提取密码请加微信订阅号“LLKU”,直接在订阅号输入:“ADF”。
EBS Form导出Excel格式数据
有时候客户需要将类似日记账信息直接从主界面通过系统自动的导出功能导出数据到本地,系统本身提供的导出格式是"csv",当然这个格式通过其他阅读器也是可以正常打开,只是不能像通过Excel打开一样对数据进行直接加工。因此希望通过更改系统本身的配置文件和首选项相关项的设置直接生成Excel数据输出。具体方法如下两步(注意记录修改前数据):
1. 将配置文件名 "导出 MIME 类型"的地点层数据由"text/tab-separated-values"更改为"application/vnd.ms-excel";
2. 修改首选项中"客户机字符编码"为"简体中文(GB2312)",原本是Unicode(UTF-8)
说明:暂不明修改上述两项后对其他功能的影响,待实际应用过程中检验.
Oracle EBS HR解除员工雇佣
–说明:以下代码已经经过本人测试,建议在实际应用时再次测试
declare
–常量定义
l_terminate_emp_flag varchar2(1) := 'N';
l_terminate_msg varchar2(600);
–select t.person_id, t.last_name from per_people_f t;
l_person_id number := 1383;
l_le_terminate_emp_exception exception;
–DECLARE variables for HR_EX_EMPLOYEE_WORKER_API.actual_termination_emp
–IN variables
l_effective_date date;
–离职原因,需根据系统定义的参数输入 select distinct t.leaving_reason from hr.PER_PERIODS_OF_SERVICE t;
l_termination_reason per_periods_of_service.leaving_reason%type := 'EMP_TRANS';
–当执行时显示:Error validating API: hr_ex_employee_api.actual_termination_emp : ORA-20001: 必须指定具有系统人员类型 EX_EMP 的人员类型。
–运行下面命令找出 select t.person_type_id from hr.per_person_types t where t.system_person_type = 'EX_EMP';得出'9'
l_person_type_id per_person_types.person_type_id%type := 9;
l_period_of_service_id per_periods_of_service.period_of_service_id%type;
l_actual_termination_date per_periods_of_service.actual_termination_date%type := trunc(sysdate);
l_last_standard_process_date per_periods_of_service.last_standard_process_date%type := trunc(sysdate + 10);
l_object_version_number per_periods_of_service.object_version_number%type;
l_start_date per_periods_of_service.date_start%type;
l_notif_term_date date;
–OUT variables
l_supervisor_warning boolean := false;
l_event_warning boolean := false;
l_interview_warning boolean := false;
l_review_warning boolean := false;
l_recruiter_warning boolean := false;
l_asg_future_changes_warning boolean := false;
l_entries_changed_warning varchar2(300);
l_pay_proposal_warning boolean := false;
l_dod_warning boolean := false;
l_alu_change_warning varchar2(300);
–DECLARE variables for HR_EX_EMPLOYEE_WORKER_API.final_process_emp
–IN variables
l_final_process_date per_periods_of_service.final_process_date%type;
–OUT variables
l_org_now_no_manager_warning boolean := false;
l_f_asg_future_changes_warning boolean := false;
l_f_entries_changed_warning varchar2(300);
—
begin
begin
select pos.period_of_service_id, pos.object_version_number, date_start
into l_period_of_service_id, l_object_version_number, l_start_date
from per_periods_of_service pos
where pos.person_id = l_person_id;
exception
when others then
l_terminate_msg := 'Error while selecting employee details : ' ||
substr(sqlerrm, 1, 150);
raise l_le_terminate_emp_exception;
end;
–保存点
savepoint terminate_employee_s1;
begin
/*
* This API terminates an employee.
* This API converts a person of type Employee >to a person of type
* Ex-Employee. The person's period of service and any employee assignments are ended.
*/
hr_ex_employee_api.actual_termination_emp(p_validate => false –l_validate
,
p_effective_date => trunc(sysdate),
p_period_of_service_id => l_period_of_service_id,
p_object_version_number => l_object_version_number,
p_actual_termination_date => l_actual_termination_date,
p_last_standard_process_date => l_last_standard_process_date,
p_person_type_id => l_person_type_id,
p_leaving_reason => l_termination_reason
–Out
,
p_supervisor_warning => l_supervisor_warning,
p_event_warning => l_event_warning,
p_interview_warning => l_interview_warning,
p_review_warning => l_review_warning,
p_recruiter_warning => l_recruiter_warning,
p_asg_future_changes_warning => l_asg_future_changes_warning,
p_entries_changed_warning => l_entries_changed_warning,
p_pay_proposal_warning => l_pay_proposal_warning,
p_dod_warning => l_dod_warning,
p_alu_change_warning => l_alu_change_warning);
if l_object_version_number is null then
l_terminate_emp_flag := 'N';
l_terminate_msg := 'Warning validating API: hr_ex_employee_api.actual_termination_emp';
raise l_le_terminate_emp_exception;
end if;
l_terminate_emp_flag := 'Y';
exception
when others then
l_terminate_msg := 'Error validating API: hr_ex_employee_api.actual_termination_emp : ' ||
substr(sqlerrm, 1, 150);
raise l_le_terminate_emp_exception;
end;
— hr_ex_employee_api.actual_termination_emp
if l_terminate_emp_flag = 'Y' then
begin
if l_start_date > trunc(sysdate) then
l_notif_term_date := l_start_date + 1;
else
l_notif_term_date := trunc(sysdate);
end if;
/*
* This API updates employee termination information.
* The ex-employee must exist in the relevant business group
*/
apps.hr_ex_employee_api.update_term_details_emp(p_validate => false –l_validate
,
p_effective_date => trunc(sysdate),
p_period_of_service_id => l_period_of_service_id,
p_notified_termination_date => l_notif_term_date,
p_projected_termination_date => l_notif_term_date
–In/Out
,
p_object_version_number => l_object_version_number);
exception
when others then
l_terminate_msg := 'Error validating API: hr_ex_employee_api.update_term_details_emp : ' ||
substr(sqlerrm, 1, 150);
l_terminate_emp_flag := 'N';
raise l_le_terminate_emp_exception;
end; –hr_ex_employee_api.update_term_details_emp
begin
/*
* This API set the final process date for a terminated employee.
* This API covers the second step in terminating a period of service and all
* current assignments for an employee. It updates the period of service
* details and date-effectively deletes all employee assignments as of the final process date.
*/
apps.hr_ex_employee_api.final_process_emp(p_validate => false –l_validate
,
p_period_of_service_id => l_period_of_service_id
–Out
,
p_object_version_number => l_object_version_number,
p_final_process_date => l_final_process_date,
p_org_now_no_manager_warning => l_org_now_no_manager_warning,
p_asg_future_changes_warning => l_f_asg_future_changes_warning,
p_entries_changed_warning => l_f_entries_changed_warning);
exception
when others then
l_terminate_msg := 'Error validating API: hr_ex_employee_api.final_process_emp : ' ||
substr(sqlerrm, 1, 150);
raise l_le_terminate_emp_exception;
end; –hr_ex_employee_api.final_process_emp
end if;
commit;
exception
when l_le_terminate_emp_exception then
dbms_output.put_line(l_terminate_msg);
rollback to terminate_employee_s1;
when others then
dbms_output.put_line('Terminate Employee. Error OTHERS while validating: ' ||
sqlerrm);
rollback to terminate_employee_s1;
end;
关于Oracle E-Business Suite并发处理机制(Current Processing)
很好的一篇理解Oracle的并并发处理机制的文章
获取银行分行所在的省、市信息
之前在做一个银行抽盘文件的时候,需要获取到供应商对应维护的银行分行所在的省市信息,于是记录下获取的sql命令,如下:
记录银行信息的界面:
–银行分行的地址行1和城市数据
SELECT HP.ADDRESS1, HP.CITY
FROM AP_SUPPLIERS ASP,
IBY_EXT_BANK_ACCOUNTS_V IEB,
IBY_EXTERNAL_PAYEES_ALL IEP,
IBY_PMT_INSTR_USES_ALL USES,
IBY_ACCOUNT_OWNERS IAO,
AP_SUPPLIER_SITES_ALL ASS,
HZ_PARTIES HP
WHERE 1 = 1
AND HP.PARTY_ID = IEB.branch_party_id
AND IEP.EXT_PAYEE_ID = USES.EXT_PMT_PARTY_ID
AND IEP.PAYMENT_FUNCTION = 'PAYABLES_DISB'
AND USES.INSTRUMENT_ID = IEB.EXT_BANK_ACCOUNT_ID
AND IEP.PAYEE_PARTY_ID = ASP.PARTY_ID
AND ASP.ENABLED_FLAG = 'Y'
AND ASP.SUMMARY_FLAG = 'N'
AND IEP.PARTY_SITE_ID IS NULL
AND IEP.SUPPLIER_SITE_ID IS NULL
AND IEP.ORG_ID IS NULL
AND (USES.END_DATE IS NULL OR USES.END_DATE > SYSDATE)
AND (IEB.END_DATE IS NULL OR IEB.END_DATE > SYSDATE)
AND (ASP.END_DATE_ACTIVE IS NULL OR ASP.END_DATE_ACTIVE > SYSDATE)
AND (ASS.INACTIVE_DATE IS NULL OR ASS.INACTIVE_DATE > SYSDATE)
AND ASS.VENDOR_ID = ASP.VENDOR_ID
AND USES.INSTRUMENT_TYPE = 'BANKACCOUNT'
AND IAO.ACCOUNT_OWNER_PARTY_ID = ASP.PARTY_ID
AND IAO.EXT_BANK_ACCOUNT_ID(+) = IEB.ext_bank_account_id
–AND IEB.BANK_ACCOUNT_ID = P_BANK_ACC_ID –银行ID
–AND ASP.VENDOR_ID = P_VENDOR_ID –供应商ID
–AND ASS.VENDOR_SITE_ID = P_VENDOR_SITE_ID –供应商地点ID
ORDER BY ASP.VENDOR_TYPE_LOOKUP_CODE;