create or replace
package XXKWICONCSET authid current_user as
— this is exposed for conc manager
procedure XXKWI_REQUEST_SET_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2
);
procedure XXKWI_REQUEST_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2,
PARAM IN varchar2
);
end XXKWICONCSET;
/
Package Body:
create or replace
package body XXKWICONCSET as
— Concurrent child program
procedure XXKWI_REQUEST_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2,
PARAM IN varchar2
) is
begin
fnd_file.put_line(fnd_file.output,’Running job: ‘||param);
ERRBUF:=’Done Job…’;
RETCODE:=0;
end XXKWI_REQUEST_CONCUR;
— Concurrent Request Set
procedure XXKWI_REQUEST_SET_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2
) is
L_REQUEST_ID number;
L_REQ_DATA varchar2(10);
job_count number;
set_count number;
begin
L_REQ_DATA:=FND_CONC_GLOBAL.REQUEST_DATA; — get previous job data
if L_REQ_DATA is null then — first run set count to ‘0'
L_REQ_DATA:=’0';
end if;
set_count:=to_number(l_req_data)+1; — increment for every job
fnd_file.put_line(fnd_file.output,’Running set: ‘||to_char(set_count));
if set_count>2 then — stop after 2 jobs
ERRBUF:=’Done Set…’;
RETCODE:=0;
return;
end if;
— submit 3 child programs
for job_count in 1..2 loop
fnd_file.put_line(fnd_file.output,’Submitting job: ‘||to_char(job_count));
L_REQUEST_ID:=FND_REQUEST.SUBMIT_REQUEST(
APPLICATION=>’FND’,
program=>’XXKWI_REQUEST_CONCUR’,
DESCRIPTION=>to_char(job_count),
START_TIME=>null,
SUB_REQUEST=>true, — True = This is a child program
ARGUMENT1=>to_char(job_count) — data to job
);
end loop;
— Wait until done and save set count:
FND_CONC_GLOBAL.SET_REQ_GLOBALS(
CONC_STATUS=>’PAUSED’, — wait for child request to complete
REQUEST_DATA=>to_char(set_count) — save set data
);
Commit;
end XXKWI_REQUEST_SET_CONCUR;
end XXKWICONCSET;
/
package XXKWICONCSET authid current_user as
— this is exposed for conc manager
procedure XXKWI_REQUEST_SET_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2
);
procedure XXKWI_REQUEST_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2,
PARAM IN varchar2
);
end XXKWICONCSET;
/
Package Body:
create or replace
package body XXKWICONCSET as
— Concurrent child program
procedure XXKWI_REQUEST_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2,
PARAM IN varchar2
) is
begin
fnd_file.put_line(fnd_file.output,’Running job: ‘||param);
ERRBUF:=’Done Job…’;
RETCODE:=0;
end XXKWI_REQUEST_CONCUR;
— Concurrent Request Set
procedure XXKWI_REQUEST_SET_CONCUR (
ERRBUF OUT NOCOPY varchar2,
RETCODE OUT NOCOPY varchar2
) is
L_REQUEST_ID number;
L_REQ_DATA varchar2(10);
job_count number;
set_count number;
begin
L_REQ_DATA:=FND_CONC_GLOBAL.REQUEST_DATA; — get previous job data
if L_REQ_DATA is null then — first run set count to ‘0'
L_REQ_DATA:=’0';
end if;
set_count:=to_number(l_req_data)+1; — increment for every job
fnd_file.put_line(fnd_file.output,’Running set: ‘||to_char(set_count));
if set_count>2 then — stop after 2 jobs
ERRBUF:=’Done Set…’;
RETCODE:=0;
return;
end if;
— submit 3 child programs
for job_count in 1..2 loop
fnd_file.put_line(fnd_file.output,’Submitting job: ‘||to_char(job_count));
L_REQUEST_ID:=FND_REQUEST.SUBMIT_REQUEST(
APPLICATION=>’FND’,
program=>’XXKWI_REQUEST_CONCUR’,
DESCRIPTION=>to_char(job_count),
START_TIME=>null,
SUB_REQUEST=>true, — True = This is a child program
ARGUMENT1=>to_char(job_count) — data to job
);
end loop;
— Wait until done and save set count:
FND_CONC_GLOBAL.SET_REQ_GLOBALS(
CONC_STATUS=>’PAUSED’, — wait for child request to complete
REQUEST_DATA=>to_char(set_count) — save set data
);
Commit;
end XXKWI_REQUEST_SET_CONCUR;
end XXKWICONCSET;
/
No comments:
Post a Comment