Skip to Content
Product Information
Author's profile photo Murthy V

Partner libraries for Parties Determined in CRM documents and libraries for Organizational Management data

Partners would need SAP Business ByDesign Cloud Studio reusable libraries for Territory Mapping functionality, which includes libraries to return parties determined in Customer Relationship Management (CRM) documents and libraries to read Organizational Management related information.

the Blog covers the following aspects:

  • Library to return Parties determined in Customer Relationship Management Documents
  • Library to read Sales Unit Hierarchy
  • Library to read Top most Sales Units
  • Library to read Employees reporting to sales Unit

the Demo Video covers the aspect of partner consuming released libraries in Cloud Studio and testing in SAP Business ByDesign.

Capabilities:

As part of 2102 SAP Busniess ByDesign delivered following libraries, which will enable partners to realize lot more functional scenarios like Territory Mapping:

  1. Library CRMDocumentPartyDetermination enables partners to read Parties determined in CRM documents listed below:
    • Sales Order
    • Service Order
    • Service Request
    • Sales Quote / Quote for Contract
    • Contract
    • Customer Return
  2. Enable partners to read Organizational management data as listed below
    • Library ReadSalesUnitHierarchy enables to  read sales unit Hierarchy
    • Library ReadEmployeesBySalesUnit enables to get Employees reporting to sales unit
    • Library ReadTopMostSalesUnits read Top most sales units

Benefits for Customers

  1. Partners enabled to read determined parties
  2. Partners enabled to read Organization management data

Note: This capability has been requested by partners to realize functional scenarios via partner add-on in SAP Business ByDesign cloud studio.

Details of Partner Libraries:

Library to return Parties determined in Customer Relationship Management Documents

Description : Library CRMDocumentPartyDetermination(AccountIDs,CRMDocumentType) Returns the parties determined by the specified account IDs for a particular document type.

  • CRMDocumentType parameter is optional and if not passed it is set to 114 ( Sales Order CRM document) by default. sample call would CRMDocumentPartyDetermination(AccountIDs)
  • CRMDocumentType Sample values:
    • for Sales Order pass value 114
    • for Service Order pass value 117
    • for Service Request pass value 118
    • for Sales Quote/Quote for Contract pass value 30
    • for Contract pass value 1092
    • for Customer Return pass value 32

Note: Multiple account IDs can be passed to the API. Number of account IDs passed is subject to system performance. We suggest that you pass an optimal number of account IDs.

 

var AccountID: PartyID;
var AccountIDs: collectionof PartyID;
var CRMDocumentType: BusinessTransactionDocumentTypeCode;
/*Multiple account IDs can be passed to the API. Number of account IDs passed is subject to system performance. 
It is suggested to pass an optimal number of account IDs.*/
// Account ID or Buyer ID 
AccountID.content = "MC9785";
AccountIDs.Add(AccountID);
/* CRMDocumentType Sample values: 114 Sales Order, 117 Service Order, 118 Service Request, 
30 Sales Quote/Quote for Contract, 1092 Contract, 32 Customer Return*/ 
// For Sales Order CRM document, CRMDocumentType optional parameter is set to 114 by default. 
CRMDocumentType = "114"; //Sales Order
// Input is always Account/Buyer IDs
var DeterminedParties = CustomerRelationshipManagmentUtilities.CRMDocumentPartyDetermination(AccountIDs,CRMDocumentType);
if (DeterminedParties.FailedIndicator == false) 
{
	foreach(var DeterminedParty in DeterminedParties.CRMDocumentDeterminedParty) 
        {
	
	    // Given Account/Buyer ID
	    var ForGivenAccount = DeterminedParty.AccountID.content;
	    // Determined Party ID
	    var DeterminedPartyID = DeterminedParty.Party.PartyID.content;
	    // Determined Party UUID
	    var DeterminedPartyUUID = DeterminedParty.PartyUUID.content;
	    // Party Type (Role Code determines the Party type. Examples:Sales Unit Party )
	    var PartyRoleCode = DeterminedParty.RoleCode;

            /* Sample Party Role Codes are listed below (Standard and Partner Defined Parties).
            Account/Buyer Party     : 1001
            Bill-To Party           : 8
            Ship-To Party           : 1005
            Payer Party             : 10
            Sales Unit Party        : 44
            Seller Party            : 2
            Invoicing Unit Party    : 1101
            Employee Responsible    : 39
            Service Execution Team  : 42
            Service Performer Party : 43
            Sales Partner Party     : 29
            Sales Employee Party    : 46
            Freight Forwarder Party : 47
            ZParty with ZRole Code  : Partner Defined Role Code*/
        }
}
else 
{ 
// Error occurred. This could be due to invalid account ID passed to API or invalid document type or technical error.
}

/* Sales Order: Sample Party Role Codes are listed below (Standard and Partner Defined Parties for CRMDocumentType = "114"; //Sales Order)
        Account/Buyer Party     : 1001
        Bill-To Party           : 10
        Ship-To Party           : 1005
        Payer Party             : 8
        Sales Unit Party        : 44
        Seller Party            : 2
        Invoicing Unit Party    : 1101
        Employee Responsible    : 39
        Service Execution Team  : 42
        Service Performer Party : 43
        Sales Partner Party     : 29
        Sales Employee Party    : 46
        Freight Forwarder Party : 47
        ZParty with ZRole Code  : Partner Defined Role Code
*/
/* Service Order: Sample Party Role Codes are listed below for CRMDocumentType = "117"; //Service Order
        Account/Buyer Party          : 1001
        Bill-To Party                : 10
        Ship-To Party                : 1005
        Invoicing Unit Party         : 1101
        Seller Party                 : 2
        Service and Support Team     : 28
        Processor Party              : 40
        Service Execution Team Party : 42
        Service Performer Party      : 43
        Sales Unit Party             : 44
        Freight Forwarder Party      : 47
        Supplier Party               : 6
        Payer Party                  : 8
        ZParty with ZRole Code       : Partner Defined Role Code
*/
/* Service Request: Sample Party Role Codes are listed below for CRMDocumentType = "118"; //Service Request
        Account/Buyer Party      : 1001
        Ship-To Party            : 1005
        Seller Party             : 2
        Service and Support Team : 28
        Processor Party          : 40
        Sales Unit Party         : 44
        ZParty with ZRole Code   : Partner Defined Role Code
*/
/* Sales Quote/Quote for Contract: Sample Party Role Codes are listed below for CRMDocumentType = "30"; //Customer Quote 
        Account/Buyer Party        : 1001
        Bill-To Party              : 10
        Ship-To Party              : 1005
        Seller Party               : 2
        Sales Partner Party        : 29
        Employee Responsible Party : 39
        Sales Unit Party           : 44
        Sales Employee Party       : 46
        Freight Forwarder Party    : 47
        Payer Party                : 8
        ZParty with ZRole Code     : Partner Defined Role Code
*/
/* Contract: Sample Party Role Codes are listed below for CRMDocumentType = "1092"; //Contract 
        Account /Buyer Party         : 1001
        Bill-To Party                : 10
        Ship-To Party                : 1005
        Invoicing Unit Party         : 1101
        Authorised Party             : 1020
        Contract Administrator Party : 1122
        Seller Party                 : 2
        Contracting Unit Party       : 204
        Sales Partner Party          : 29
        Employee Responsible Party   : 39
        Service Execution Team Party : 42
        Service Performer Party      : 43
        Sales Unit Party             : 44
        Payer Party                  : 8
        ZParty with ZRole Code       : Partner Defined Role Code
*/
/* Customer Return: Sample Party Role Codes are listed below for CRMDocumentType = "32"; //Customer Return
        Account/Buyer Party        : 1001
        Bill-To Party              : 10
        Ship-To Party              : 1005
        Invoicing Unit Party       : 1101
        Seller Party               : 2
        Service and Support Team   : 28
        Employee Responsible Party : 39
        Processor Party            : 40
        Sales Unit Party           : 44
        Payer Party                : 8
        ZParty with ZRole Code     : Partner Defined Role Code
*/

 

Library to read Sales Unit Hierarchy

Description : Library ReadSalesUnitHierarchy(RootOrgCenterID) returns the sales unit hierarchy pertaining to the sales unit ID (RootOrgCenterID), as on that date.

  • Variant 1: ReadSalesUnitHierarchy – With Sales Unit ID and Without Date
    • Returns the sales unit hierarchy pertaining to the sales unit ID (RootOrgCenterID), as on that date.
    • example: Sales unit hierarchy pertaining to the sales unit ID MC40000, as on that date.
  • //Get sales unit hierarchy with sales unit ID as input  
    var RootOrgCenterID: OrganisationalCentreID;
    RootOrgCenterID = "MC40000";
    var SalesUnitHierarchyForGivenID = OrganisationalManagementUtilities.ReadSalesUnitHierarchy(RootOrgCenterID);
    //Note: As no date is specified, current date is considered by default.
  • Variant 2: ReadSalesUnitHierarchy- With Sales Unit UUID and Without Date
    • Returns the sales unit hierarchy pertaining to the sales unit UUID (RootOrgCenterUUID), as on that date.
    • example: Sales unit hierarchy pertaining to the sales units UUID 00145EF588E602DBB8B3AE3B10E55944, as on that date.
  • //Get sales unit hierarchy with sales unit UUID 
    var RootOrgCenterUUID: UUID;
    RootOrgCenterUUID.content = "00145EF588E602DBB8B3AE3B10E55944";
    var RootOrgCenterID: OrganisationalCentreID;
    // Note: Make sure you pass an empty first parameter- RootOrgCenterID which is required for technical reasons.
    var SalesUnitHierarchyForGivenUUID = 
    OrganisationalManagementUtilities.ReadSalesUnitHierarchy
    (RootOrgCenterID,RootOrgCenterUUID,KeyDate);
    //Note: As no date is specified, current date is considered by default.
     
  • Variant 3: ReadSalesUnitHierarchy- With Sales Unit ID and Key Date
    • Returns the sales unit hierarchy pertaining to the sales unit ID (RootOrgCenterID1) and Key Date (KeyDate).
    • example: Sales unit hierarchy pertaining to the sales unit ID MC40000 as on 01.01.2005.
  • //Get sales unit hierarchy with sales unit ID and key date as input 
    var KeyDate= Library::Date.ParseFromString("20050101");
    var RootOrgCenterID1: OrganisationalCentreID;
    RootOrgCenterID1 = "MC40000";
    var RootOrgCenterUUID1: UUID;
    // Note: Make sure you pass an empty second parameter- RootOrgCenterUUID1, which is required for technical reasons.
    var SalesUnitHierarchyForGivenIDKeyDate = OrganisationalManagementUtilities.ReadSalesUnitHierarchy(RootOrgCenterID1,RootOrgCenterUUID1,KeyDate)
  • Variant 4: ReadSalesUnitHierarchy- With Sales Unit UUID and Key Date
    • Returns the sales unit hierarchy pertaining to the sales unit UUID (RootOrgCenterUUID2) and key date (KeyDate).
    • example: Sales unit hierarchy pertaining to the sales unit UUID 00145EF588E602DBB8B3AE3B10E55944 as on 01.01.2005.
  • //Get sales unit hierarchy with sales unit UUID and key date as input 
    var KeyDate= Library::Date.ParseFromString("20050101");
    var RootOrgCenterUUID2: UUID;
    RootOrgCenterUUID.content = "00145EF588E602DBB8B3AE3B10E55944";
    var RootOrgCenterID2: OrganisationalCentreID;
    // Note: Make sure you pass an empty first parameter- RootOrgCenterID2, which is required for technical reasons.
    var SalesUnitHierarchyForGivenUUIDKeyDate = OrganisationalManagementUtilities.ReadSalesUnitHierarchy
    (RootOrgCenterID2,RootOrgCenterUUID2,KeyDate);
  • Variant 5: ReadSalesUnitHierarchy- With Key Date
    • Returns the sales unit hierarchy in the organization, as on the key date specified.
    • example: Sales unit hierarchies in the organization, as on 01.01.2005
  • //Get sales unit hierarchy with key date as input 
    var KeyDate= Library::Date.ParseFromString("20050101");
    var RootOrgCenterID3: OrganisationalCentreID;
    var RootOrgCenterUUID3: UUID;
    // Note: Make sure you pass an empty first parameter- RootOrgCenterID3 and second parameter- RootOrgCenterUUID3, which are required for technical reasons.
    var SalesUnitHierarchyForGivenKeyDate = OrganisationalManagementUtilities.ReadSalesUnitHierarchy(RootOrgCenterID3,RootOrgCenterUUID3,KeyDate);
  • Variant 6: ReadSalesUnitHierarchy- Without a Parameter
    • Returns all sales unit hierarchy in the organization, as on that date.
    • example: Sales unit hierarchies as on that date.
  • //Get all sales unit hierarchies 
    var AllSalesUnitHierarchies = OrganisationalManagementUtilities.ReadSalesUnitHierarchy();
    //Note: As no date is specified, current date is considered by default.

 

Library to read Top most Sales Units

Description : Library ReadTopmostSalesUnits(KeyDate) returns all the sales units in the system as on the key date.

  • Variant 1: ReadTopmostSalesUnits- With Key Date
    • Returns the topmost sales units in the system, as on the validity date/key date (KeyDate) specified.
    • example: Topmost sales units as on 01.01.2005.
  • //Get top sales units for given validity date/key date 
    var KeyDate = Library::Date.ParseFromString("20050101");
    var TopmostAllSalesUnitsForGivenDate = OrganisationalManagementUtilities.ReadTopmostSalesUnits(KeyDate);
    foreach(var TopmostSalesUnit in TopmostAllSalesUnitsForGivenDate.TopmostSalesUnit ) {
    // Top Most Sales Unit ID
    	var TopmostSalesUnitOrganisationalCentreID = TopmostSalesUnit.OrganisationalCentreID;
    // Top Most Sales Unit UUID
    	var TopmostSalesUnitOrganisationalCentreUUID = TopmostSalesUnit.OrganisationalCentreUUID.content; 
    }
  • Variant 2: ReadTopmostSalesUnits- Without Key Date
    • Returns the topmost sales units in the system, as on that date.
    • example: Returns the topmost sales units as on that date
  • //Get all top sales units (without filtering) 
    var TopmostAllSalesUnits = OrganisationalManagementUtilities.ReadTopmostSalesUnits();
    //Note: As no date is specified, current date is considered by default.

Library to read Employees reporting to Sales Unit

Description : Library ReadEmployeesBySalesUnit(SalesUnitIDs) returns the employees reporting to sales units.

  • Variant 1: ReadEmployeesBySalesUnit- With Sales Unit IDs
    • Returns the employee(s) in the sales units pertaining to the sales unit IDs specified, as on that date.
    • example: Employee(s) present in the sales units pertaining to the sales unit IDs- MC40000 and MC41000, as on that date.
  • //Get employees reporting to sales unit IDs
    var SalesUnitIDs: collectionof OrganisationalCentreID;
    var SalesUnitID: OrganisationalCentreID;
    SalesUnitID = "MC40000";
    SalesUnitIDs.Add(SalesUnitID);
    SalesUnitID = "MC41000";
    SalesUnitIDs.Add(SalesUnitID);
    var EmployeesBySalesUnitID = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit(SalesUnitIDs);
    //Note: As no date is specified, current date is considered by default.
  • Variant 2: ReadEmployeesBySalesUnit – With Sales Unit UUIDs
    • Returns the employee(s) in the sales units pertaining to the sales unit UUIDs (SalesUnitUUIDs1), as on that date.
    • example: Employee(s) present in the sales units pertaining to the sales unit UUIDs- 00145EF588E602DBB8B3AE3B10E55944 and 00145EF588E602DBB8B3AE683CDB1FD6, as on that date.
  • //Get employees reporting to sales unit UUIDs
    var SalesUnitIDs1: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs1: collectionof UUID;
    var SalesUnitUUID: UUID;
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE3B10E55944";
    SalesUnitUUIDs1.Add(SalesUnitUUID);
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE683CDB1FD6";
    SalesUnitUUIDs1.Add(SalesUnitUUID);
    // Note: Make sure you pass an empty first parameter- SalesUnitIDs1, which is required for technical reasons.
    var EmployeesBySalesUnitUUID = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit (SalesUnitIDs1,SalesUnitUUIDs1);
    //Note: As no date is specified, current date is considered by default.
  • Variant 3: ReadEmployeesBySalesUnit – With Sales Unit IDs and Key Date
    • Returns the employee(s) in the sales units pertaining to the sales unit IDs (SalesUnitIDs3) and key date (KeyDate) specified.
    • example: Employee(s) present in the sales units pertaining to the sales unit IDs- MC40000 and MC41000, as on 01.01.2005..
  • //Get employees reporting to sales unit IDs and key date
    var KeyDate= Library::Date.ParseFromString("20050101");
    var SalesUnitIDs3: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs3: collectionof UUID;
    SalesUnitID = "MC40000";
    SalesUnitIDs3.Add(SalesUnitID);
    SalesUnitID = "MC41000";
    SalesUnitIDs3.Add(SalesUnitID);
    // Note: Make sure you pass an empty second parameter- SalesUnitUUIDs3, which is required for technical reasons. 
    var EmployeesBySalesUnitIDKeyDate = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit (SalesUnitIDs3,SalesUnitUUIDs3,KeyDate);
  • Variant 4: ReadEmployeesBySalesUnit – With Sales Unit UUIDs and Key Date
    • Returns the employee(s) in the sales units pertaining to the sales unit UUIDs (SalesUnitUUIDs4) and key date (KeyDate) specified.
    • example: Employee(s) present in the sales units pertaining to the sales unit UUIDs- 00145EF588E602DBB8B3AE3B10E55944 and 00145EF588E602DBB8B3AE683CDB1FD6 as on 01.01.2005.
  • //Get employees reporting to sales unit UUIDs and key date
    var KeyDate= Library::Date.ParseFromString("20050101");
    var SalesUnitIDs4: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs4: collectionof UUID;
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE3B10E55944";
    SalesUnitUUIDs4.Add(SalesUnitUUID);
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE683CDB1FD6";
    SalesUnitUUIDs4.Add(SalesUnitUUID);
    // Note: Make sure you pass an empty first parameter- SalesUnitIDs4 which is required for technical reasons.
    var EmployeesBySalesUnitUUIDKeyDate = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit(SalesUnitIDs4,SalesUnitUUIDs4,KeyDate);
  • Variant 5: ReadEmployeesBySalesUnit – With Sales Unit IDs, Sales Unit UUIDs, and Key Date
    • Returns the employee(s) in the sales units pertaining to the sales unit IDs (SalesUnitIDs5), sales unit UUIDs (SalesUnitUUIDs5), and key date (KeyDate) specified.
    • example: Employee(s) present in the sales units pertaining to the sales unit ID- MC40000, sales unit UUID- 00145EF588E602DBB8B3AE683CDB1FD6 as on 01.01.2005.
  • //Get employees reporting to sales unit IDs and sales unit UUIDs and key date
    var KeyDate= Library::Date.ParseFromString("20050101");
    var SalesUnitIDs5: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs5: collectionof UUID;
    SalesUnitID = "MC40000";  
    SalesUnitIDs5.Add(SalesUnitID);   
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE683CDB1FD6";
    SalesUnitUUIDs5.Add(SalesUnitUUID);
    // Note: Make sure you pass an empty first parameter- SalesUnitIDs5 which is required for technical reasons.
    var EmployeesBySalesUnitIDUUIDKeyDate = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit (SalesUnitIDs5,SalesUnitUUIDs5,KeyDate);
  • Variant 6: ReadEmployeesBySalesUnit – With Sales Unit ID and Sales Unit UUID
    • Returns the employee(s) in the sales units pertaining to the sales unit IDs (SalesUnitIDs5), sales unit UUIDs (SalesUnitUUIDs5), as on that date.
    • example: Employee(s) present in the sales units pertaining to the sales unit ID- MC40000, sales unit UUID- 00145EF588E602DBB8B3AE3B10E55944 as on that date.
  • //Get employees reporting to sales unit ID and sales unit UUIDs  
    var SalesUnitIDs6: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs6: collectionof UUID;
    SalesUnitID = "MC40000";
    SalesUnitIDs6.Add(SalesUnitID);
    SalesUnitUUID.content = "00145EF588E602DBB8B3AE3B10E55944";
    SalesUnitUUIDs6.Add(SalesUnitUUID);
    var EmployeesBySalesUnitIDUUID = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit
    (SalesUnitIDs6,SalesUnitUUIDs6);
    //Note: As no date is specified, current date is considered by default.

 

  • Variant 7: ReadEmployeesBySalesUnit- With Key Date
    • Returns the employee(s) in the sales units as on the key date (Key Date) specified.
    • example: Employee(s) present in the sales units as on 01.01.2005.
  • //Get all employees reporting to all sales units for given key date
    var KeyDate= Library::Date.ParseFromString("20050101");
    var SalesUnitIDs7: collectionof OrganisationalCentreID;
    var SalesUnitUUIDs7: collectionof UUID;
    // Note: Make sure you pass an empty first parameter-SalesUnitIDs7, second parameter- SalesUnitUUIDs7, which is required for technical reasons. 
    var AllEmployeesBySalesUnitKeyDate = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit
    (SalesUnitIDs7,SalesUnitUUIDs7,KeyDate);

 

  • Variant 8: ReadEmployeesBySalesUnit – Without Parameters
    • Returns all employees present in all the sales units, as on that date.
    • example: Employees present in all the sales units, as on that date.
  • //Get all employees reporting to all sales units 
    var AllEmployeesBySalesUnit = OrganisationalManagementUtilities.ReadEmployeesBySalesUnit();
    //Note: As no date is specified, current date is considered by default.

 

Assigned tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nathanael Mangold
      Nathanael Mangold

      Dear Murthy V,

       

      thank you for the blog.

      What is the required namespace to use the "OrganisationalManagementUtilities" functions?

       

      Author's profile photo Anil Kumar Rana
      Anil Kumar Rana

      Hi Nathanael,

      please use the following import at the beginning -> import AP.FO.MOM.Global;

      I tried it in the SDK and it is possible to use the Reuse Library then.

      Thanks,

      Anil