SAP Knowledge Base Article - Public

3051640 - Unable to Create Instances in Party Node via Add-On

Symptom

You are trying to create an instance for a party node in a standard business object using cloud application studio add-on solution. However the instance is not created and the node is returning empty.

Examples for standard business objects are Opportunity, Service Orders etc.

Environment

SAP Cloud Application Studio

SAP Business By Design

SAP Cloud for Customer

Reproducing the Issue

  1. Login to SDK
  2. Open the relevant solution and navigate to the respective XBO.
  3. You have added a code in the XBO for creating an instance.
  4. However the instance is not getting created.

You can verify this by debugging the code written. The variable returns empty after the instance creation statement.

Cause

The instance for party node is not getting created via code is because you are trying to create an empty party instance without any role code or values and then trying to add the data.

Resolution

You need to pass the role code and values to the Create query for Party node instance creation. You can refer to the sample code below for the opportunity BO and adapt your code accordingly:-

var opportunity:BusinessObject::Opportunity;

var refOrgParty:BusinessObject::Opportunity.Party;

var elOppParty:elementsof opportunity.Party;

opportunity = Opportunity.Retrieve(this.OpportunityID);

if (bp.IsSet()) {

elOppParty.RoleCode = "ZSALES0100";

elOppParty.PartyKey.PartyID.content = bp.InternalID;

refOrgParty = opportunity.Party.Create(elOppParty);

}

See Also

Programmatically writing Involved Parties in ABSL Code | SAP Community

Keywords

node creation failed, unable to create instance in party node, party node in oppotunity, party node in service order , KBA , party node creation via sdk , instances in party node creation failed , involved parties in absl code , AP-RC-BDS-BO , ByDesign Studio BO definition/generation , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , Problem

Product

SAP Business ByDesign all versions ; SAP Cloud Applications Studio all versions ; SAP Cloud for Customer add-ins all versions