Below given query will give you details for short text document attachment details.
In this query i passed 2 parameter p_entity_name and p_prim_key_id.
One can pass p_entity_name parameter value as "OE_ORDER_HEADERS" then we must pass p_prim_key_id parameter value as header_id from OE_ORDER_HEADERS_ALL table.
Similarly you can pass p_entity_name value as 'PO_HEADERS', 'PO_LINES', 'OE_ORDER_HEADERS', 'OE_ORDER_LINES','AP_INVOICES','AP_CHECKS' etc. to get details for short text attached to this entity.
Query :
SELECT fad.seq_num,
fdct.user_name,
fdot.title,
fdot.description,
fdst.short_text,
fad.entity_name,
fdct.user_name
FROM fnd_attached_documents fad,
fnd_documents fdob,
fnd_documents_tl fdot,
fnd_document_categories_tl fdct,
fnd_documents_short_text fdst
WHERE fad.document_id = fdob.document_id
AND fad.document_id = fdot.document_id
AND fdob.document_id = fdot.document_id
AND fdob.category_id = fdct.category_id
AND fdot.language = userenv('LANG')
AND fdct.language = userenv('LANG')
AND fad.entity_name = &p_entity_name
AND fad.pk1_value = TO_CHAR(&p_prim_key_id)
AND fdst.media_id = fdob.media_id;
Screenshot for sample attachment :
In this query i passed 2 parameter p_entity_name and p_prim_key_id.
One can pass p_entity_name parameter value as "OE_ORDER_HEADERS" then we must pass p_prim_key_id parameter value as header_id from OE_ORDER_HEADERS_ALL table.
Similarly you can pass p_entity_name value as 'PO_HEADERS', 'PO_LINES', 'OE_ORDER_HEADERS', 'OE_ORDER_LINES','AP_INVOICES','AP_CHECKS' etc. to get details for short text attached to this entity.
Query :
SELECT fad.seq_num,
fdct.user_name,
fdot.title,
fdot.description,
fdst.short_text,
fad.entity_name,
fdct.user_name
FROM fnd_attached_documents fad,
fnd_documents fdob,
fnd_documents_tl fdot,
fnd_document_categories_tl fdct,
fnd_documents_short_text fdst
WHERE fad.document_id = fdob.document_id
AND fad.document_id = fdot.document_id
AND fdob.document_id = fdot.document_id
AND fdob.category_id = fdct.category_id
AND fdot.language = userenv('LANG')
AND fdct.language = userenv('LANG')
AND fad.entity_name = &p_entity_name
AND fad.pk1_value = TO_CHAR(&p_prim_key_id)
AND fdst.media_id = fdob.media_id;
Screenshot for sample attachment :
Thank you! This was very helpful to me.
ReplyDeletethanks. It works fine.
ReplyDelete