Concurrent Programs in the same request set

At times there might be a requirement to spawn a concurrent request based on the output of another concurrent program in a request set.

However there are no api's to provide with the request set id.

There are ways to identify the request set because each request set launches a concurrent program which in turn launches the concurrent programs that are constituents of a request set.

For e.g if a request Set SET1 has the following programs that would fire in the order:
Program A
Program B
Program C

Launching the request set would launch the spawned process(request id 0) with the following requests for
Program A - request id 1 parent request id 0
Program B - request id 2 parent request id 0
Program C - request id 3 parent request id 0

Therefore the following code would help identify the request id of the programs that have executed as part of the same request set:

  FUNCTION get_peer_request_id
    p_request_id                NUMBER,
    p_peer_request_program_name VARCHAR2
    l_peer_request_id NUMBER;
    SELECT parent_req.request_id
      INTO l_peer_request_id
      FROM fnd_concurrent_requests    parent_req,
           fnd_concurrent_programs_vl fp,
           fnd_concurrent_requests    child
     WHERE parent_req.concurrent_program_id = fp.concurrent_program_id
       AND parent_req.parent_request_id = child.parent_request_id
       AND parent_req.request_id != child.request_id
       AND parent_req.parent_request_id != -1
       AND fp.concurrent_program_name = p_peer_request_program_name
       AND child.request_id = p_request_id;
    RETURN l_peer_request_id;
      l_peer_request_id := -1;
      RETURN l_peer_request_id;
  END get_peer_request_id;

Once we have the request id we can use the sql

select * from fnd_requests where request_id=p_request_id
to get information about the request.

No comments:

Post a Comment