Monday, February 20, 2012

How to setup a defaulting DFF value of Default Type SQL Statement

If you need to repeat a value already part of the original transaction and automatically populate it in another area of the same transaction, in this case: the data is located on the AP Invoice header and it needs to be passed to the invoice line.

Then you need to create a DFF with a default type of 'SQL Statement' at the destination level and pass a bind variable into the 'where' clause of the select statement.

Here's an example: let's say there is a value (e.g. attribute4) in the AP invoice header that needs to be copied down to each AP invoice lines, you simply need to have the following default SQL statement for the DFF created at the invocie line level:

select aph.attribute4
from ap_invoice_lines_all apl, ap_invoices_all aph
where aph.invoice_id = apl.invoice_id
and apl.invoice_id = :INV_SUM_FOLDER.invoice_id

In order for the attribute4 from the invoice header to default automatically to the invoice lines, the last clause of the query above requires to pass a bind variable, in this case, it corresponds to ":INV_SUM_FOLDER.invoice_id"

To get the value above, Navigate to the form where the data is located, then extract the 'block'.'field' information by navigating to Help > Diagnostic > Examine

Prefix the combination of the 'block'.'field' with a " : "

My friend Cathy B. also pointed me to this excellent reference explaining Bind Variables: http://docs.oracle.com/cd/A60725_05/html/comnls/us/fnd/values19.htm