Changing template dynamically AFTER request is submitted

Problem

Setting a template dynamically is well-documented.
fnd_request.add_layout(template_appl_name  => rec.argument1
                               ,template_code       => rec.argument2
                               ,template_language   => rec.argument3
                               ,template_territory  => rec.argument4
                               ,output_format       => rec.argument5

Then submit the request.
x_request_id := fnd_request.submit_request  ...

But what if the report is already running?

Solution


Use this code, you can put it in a separate procedure with pragama autonomous if you don't want the commit in your current code. If calling from Oracle reports, the best place for this is the afterreport trigger.

update fnd_conc_pp_actions
        set argument2 = 'TEMPLATE_SHORT_NAME'
        where concurrent_request_id = :P_CONC_REQUEST_ID and action_type = 6;
        commit;

Acknowledgement

http://faanwar.blogspot.co.uk/

Comments