Symptom
You are creating a service contract and would like to link the Quote in the document flow either via odata or via custom development. But you received the below error message.
Updating Contract failed; reference is invalid::Create not possible; source object inconsistent Diagnosis If the source object is, for example, a product, then a schedule line cannot be created for this sales order item, because the product is missing in the master data. System Response Possible Solutions in Master Data Check, and create the required source object, if necessary. Procedure Procedure for System Administration
Environment
SAP Business ByDesign
Reproducing the Issue
Below is the code used.
//link document
var currlink = this.BusinessTransactionDocumentReference.Where(n => n.BusinessTransactionDocumentReference.TypeCode == "30");
lqueryParams.Clear();
lqueryParams.Add(lquery.ID.content, "I", "EQ", this.QuoteReference);
var lqueryResults = lquery.Execute(lqueryParams);
if ((!currlink.GetFirst().IsSet()) && (lqueryResults.Count() > 0))
{
var flink : elementsof this.BusinessTransactionDocumentReference;
flink.BusinessTransactionDocumentReference.ID.content = this.QuoteReference;
flink.BusinessTransactionDocumentReference.TypeCode = "30";
flink.BusinessTransactionDocumentRelationshipRoleCode = "1";
flink.BusinessTransactionDocumentReference.UUID
this.BusinessTransactionDocumentReference.Create(flink);
}
Cause
RelationshipRoleCode = "1" represents the predecessor and RelationshipRoleCode 2 represents a successor. If you wants to create a link with a document as a predecessor than it is currently not possible. The current functionality only allows to create a successor link.
Resolution
Kindly use the RelationshipRoleCode 2 as below to create a successor link.
flinkI.BusinessTransactionDocumentRelationshipRoleCode = "2"
Keywords
BusinessTransactionDocument; Updating Contract failed; , KBA , AP-CCP-CC , Customer Contract , Problem