Step 1: read the concurrent request data using fnd_conc_global.request_data
Step 2: If request data from step 1 is not null, then the program is restarting after the child requests are processed and the master has restarted. Go to step 7.
Step 3: If the request data is null submit child programs using fnd_request.submit_request with child request TRUE.
Step 4: When all the child programs are done submitting, set the request data of the concurrent request to some text, so that when the master is restarted the request data is not null
Step 5: Pause the master and allow the child requests to execute using fnd_conc_global.set_req_globals(conc_status => 'PAUSED',request_data => 'MASTER DONE')
Step 6: When the child requests are executed the master restarts and goes to Step 1
Step 7: Do post processing actions and exit.
Pseudo code below :
req_data :=
fnd_conc_global.request_data;
if (req_data is not null)
then
i := to_number(req_data);
i := i + 1;
if (i < 11 ) then
errbuf := 'Done!';
retcode := 0 ;
return;
end if;
else
i := 1;
end if;
req_id:=
fnd_request.submit_request('FND', 'CHILD',
'Child ' || to_char(i), NULL,
TRUE,
fnd_conc_global.printer);
if req_id = 0 then
--
-- If request submission
failed, exit with error.
--
errbuf := fnd_message.get;
retcode := 2;
else
--
-- Here we set the globals to
put the program into the
-- PAUSED status on exit, and
to save the state in
-- request_data.
--
fnd_conc_global.set_req_globals(conc_status
=> 'PAUSED',
request_data =>
to_char(i));
errbuf := 'Sub-Request
submitted!';
retcode := 0 ;
end if;
return;
end;