Sunday, November 15, 2009

Importing Expense Report Attachments into Payables

Is there any way to get expense report attachments into Payables?

Yes there is. You can use standard Oracle Apps routine to copy attachments from one entity to another. You can copy attachments from ER header to Invoice header, ER line to Invoice Dist or copy all attachments from ER header/lines to AP invoice headers. You can also control which type of attachments should be copied.

Sample code below copies header level expense report attachments to the AP Invoice.

BEGIN
 fnd_attached_documents2_pkg.copy_attachments(
  x_from_entity_name  => 'OIE_HEADER_ATTACHMENTS' -- From Expense Report Header
 ,x_from_pk1_value    => '115000'                 -- From Expense Report Header Id
 ,x_to_entity_name    => 'AP_INVOICES'            -- To AP Invoice Header
 ,x_to_pk1_value      => '1085333'                -- To Invoice Id
 ,x_to_category_id    => 1                        -- Category Id for Attachments
);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
 dbms_output.put_line('SQLERR ' || SQLERRM);
 ROLLBACK;
END;

.

Cheers

No comments: