Create attachments and attach them to Sales Order Header or Order Lines

Use the API below to create the attachment. This could be a limited text that you want on the order header or line.
OE_FND_ATTACHMENTS_PUB.CREATE_SHORT_TEXT_DOCUMENT
(1.0, --version
P_SHORT_TEXT, --Text to be added as attachment
P_CATEGORY_ID, -- Attachment category id
P_DESCRIPTION, -- Attachment description
NULL,
V_SECURITY_ID, --The value is 4 for no security
NULL,
'Y',
'O', -- One time usage
SYSDATE,
NULL,
NULL,
V_DOCUMENT_ID, -- Document id returned by the API
V_RETURN_STATUS_CS,
V_MSG_COUNT_CS,
V_MSG_DATA_CS);

Pass V_DOCUMENT_ID from above API into below second API

OE_FND_ATTACHMENTS_PUB.ADD_ATTACHMENT(1.0,
P_ENTITY_NAME, --Value of this parameter would be 'OE_ORDER_HEADERS' for header level attachment
-- and 'OE_ORDER_LINES' for line level attachment
P_PK1_VALUE, --line id or header id (For line level or header level attachment)
NULL,
NULL,
NULL,
NULL,
'N',
NULL,
V_DOCUMENT_ID, --Document id from above api
V_ATTACHMENT_ID, -- output attachment id
V_RETURN_STATUS_AT,
V_MSG_COUNT_AT,
V_MSG_DATA_AT);


commit;

Query your Sales Order Header or Line and your attachment should be visible. 

If you already have a document created, you can just use the second half of the code to attach the document to order header or line.

Found this code on OTN.

https://community.oracle.com/thread/656954?start=0&tstart=0

Comments

Popular posts from this blog

Ora 28113 : Policy Predicate has Error