|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
在ERP的报表开发中,可以用PL/SQL和Report开发,我在公司做过N个报表,90%的报表都是用PL/SQL开发的,PL/SQL功能强大,灵活处理。经过一段时间的总结我总结可用PL/SQL开发报表的一些经验,现在分享给大家。
1.一个报表一个PL/SQL包,包名的命名规范为 cux_ar01_report(其中cux为客户化开发,ar01为AR模块中的第一个报表,Report代表第一个报表)
2.在print函数中进行输出。
3.cursor的定义放在包体的最前面。
4.do函数为该函数的入口地址
5.屏蔽不在包体外调用的函数声明。
6.入口函数的特点为:前两个的定义必须为errbuf OUT VARCHAR2, retcode OUT NUMBER,否则报错。
procedure do(errbuf OUT VARCHAR2, retcode OUT NUMBER);
create or replace package cux_other01_report is
-- Author : Wanjun Hu
-- Created : 2004-7-9 下午 01:44:57
-- Purpose : other01 用户,职责表
procedure do(errbuf OUT VARCHAR2, retcode OUT NUMBER);
end cux_other01_report;
create or replace package body cux_other01_report is
cursor cursor_user_role is
select c.user_name as login_name,
d.full_name as employee_name,
f.name as department_name,
a.user_id as user_id,
a.responsibility_id as responsibility_id,
b.RESPONSIBILITY_NAME as RESPONSIBILITY_NAME
from FND_USER_RESP_GROUPS a,
FND_RESPONSIBILITY_VL b,
fnd_user c,
hr_employees d,
per_assignments_f e,
hr_all_organization_units_tl f
where a.user_id = c.user_id
and c.employee_id = d.employee_id
and c.employee_id = e.PERSON_ID
and e.ORGANIZATION_ID = f.organization_id
and a.responsibility_id = b.RESPONSIBILITY_ID
and sysdate > e.EFFECTIVE_START_DATE
and sysdate < e.EFFECTIVE_END_DATE
order by c.description, c.user_name, a.responsibility_id
;
-- Author : Wanjun Hu
-- Created : 2004-8-24 下午 01:47:23
-- Purpose : 在控制台输出和在报表中输出
procedure print(content varchar2) is
begin
dbms_output.put_line(content);
fnd_file.put_line(fnd_file.output, content);
end print;
procedure do(errbuf OUT VARCHAR2, retcode OUT NUMBER) is
p_row_cursor_user_role cursor_user_role%rowtype;
begin
open cursor_user_role;
loop
--循环
fetch cursor_user_role
into p_row_cursor_user_role;
EXIT WHEN cursor_user_role%NOTFOUND OR cursor_user_role%NOTFOUND IS NULL;
print(p_row_cursor_user_role.login_name || ',' ||
replace(p_row_cursor_user_role.employee_name, ',', '') || ',' ||
p_row_cursor_user_role.department_name || ',' ||
p_row_cursor_user_role.user_id || ',' ||
p_row_cursor_user_role.responsibility_id || ',' ||
p_row_cursor_user_role.RESPONSIBILITY_NAME);
end loop;
close cursor_user_role;
end do;
end cux_other01_report;
[upload=pck]viewFile.asp?ID=4[/upload] |
-
-
NnYivhWg.pck
2.2 KB, 下载次数: 125, 下载积分: 努力值 -5 点
偶的PL/SQL报表程序格式
|