Skip to Content

Adding Project/MA/RFx etc. in Document Links Section via Script.


In SAP Sourcing, one common question comes up every now and then which is related to Document Links section (MA, project etc.). For convenience, in this blog I am explaining the technical script involved in solving this issue.

What is a Document Links Section?

Under Header Section of a Business Document, we can see the Document Links Sections where the user can add another Business Document in relation to the current one.


While adding another Business Document, the following data needs to be populated.


Technical Scenario

Generally, based on some business requirement, we would require linking a previous Project (Business Document) to the current one. This can be achieved via scripting which is explained in this blog.

//Required imports




// Creating Document Links Home through DocumentLinkDefinitionIBeanHomeIfc


// For instance, let us assume that the document is project

// Creating Project  Home


// Finding the Project which needs to be added in Document Links section

projBean = projHome.findByUniqueDocName(“PROCAT-001–2014”);

// Find the Relationship with which the Project  should get added. Refer FCI-DocLinkDefList query to view all the relations present in the system.

documentLinkDef = docLinkHome.findUnique(“FCI-PROJECT PREVIOUS”);

// A line is added with empty fields in Document Links section

newDocumentLink = doc. getDocumentLinkList().create();

// Setting the Type of document which needs to be added (project, RFx, Auction etc.)

newDocumentLink.linkDefinitionType = new DocLinkDefinitionTypeEnumType(1);

// Setting the Relationship of the document which needs to be added (Previous Project, Future Project etc.)

newDocumentLink.linkDefinitionObjRef = documentLinkDef.objectReference;

// Setting the Object Reference of the document which needs to be added

newDocumentLink.LinkDocObjRef = projBean.objectReference;

//A Document is added in the Document Links Section

doc. getDocumentLinkList().add(newDocumentLink);

This Script can be used with any Document Life cycle event or toolbar based on Business requirement.



Be the first to leave a comment
You must be Logged on to comment or reply to a post.