Business Partner
Definition
A person, an organization, or a group of persons or organizations, in which a company has a business interest.
Business Context and Use
The Business Partner business object provides business partner master data that is used independently of the application-specific business processes. A business partner can therefore have various functions that do not depend directly on business processes in sales or purchases.
The business object predominantly contains general business partner data such as:
- Roles
- Relationships
- Addresses
- Identification
- Bank details
A business partner can have different roles, for example:
- Contact person
- Competitor
- Sales and service partner
- Carrier
未定义access context.
Customer
Access context
- 1004 -Personal Work
- 1010 -Employee
- 1015 -Employee, Territory, Account, Sales Data
Definition
A business partner to whom materials or services are offered or provided.
Business Context and Use
The Customer business object provides business partner master data that is used in the context of selling materials and services. A customer can have all those functions that a business partner performs for sales-related business processes.
In addition to the general business partner data such as address data, roles, relationship data, and bank details, the business object provides data that is required for the processes such as:
- Operating hours - This includes information about when a business partner can be contacted (visiting hours, calling hours, and goods receiving hours of a customer).
- Capital investment - This includes attributes of the shareholder relationship such as the principal and the percentage of the investment.
- Contact person data
This includes identification data and address data of the two partners in a contact person relationship.
3.1 Industry sector to which the customer is assigned
3.2 Marketing data
This includes attributes that are relevant for marketing processes, such as the Nielsen ID.
A customer can, depending on the various business processes in which it is involved, have different roles, for example:
- Prospect
- Customer
使用代码创建Customer BO实例的一些注意事项
When you interact with the Customer business object, there are some details you need to consider.
Customer Root Node and Category Code
The root node of a customer is created automatically by the PDI when you create an instance of the Customer business object. When you create a customer, you must define the customer's category code. This must be either a “person” or an “organization”.
If the customer is a person, it is mandatory to fill in the “FamilyName”.
If the customer is an organization, it is mandatory to fill in the “OrganizationalName”; technically, the fieldname is “FirstLineName”.
Role Code
As a prerequisite, a customer must also have a role code, defined by the attributes “Customer Indicator” or “Prospect Indicator” as described in the chapter “Business Context and Use”. The customer must be of either the "customer" or "prospect" role. This role can be changed at any time.
Example: Creating a Customer
The following example demonstrates how to create a new customer of the category “person” and role “customer” with the family name “Testname”.
Prerequisites
- The category code must be either “person” or “organization”; in this example, “person” is used.
- The role must be set; in this case, it is set to “customer”.
- If customizing is set to an internal number range, then the ID need not be provided by the user. Instead, the internal ID is generated in the backend.
- However, if customizing requires that the ID be set externally, the ID must be conform to the number range. Then the ID is set externally (i.e. by the user) and automatically approved and saved by the backend.
例子:
import ABSL;
import AP.FO.BusinessPartner.Global;
import AP.FO.Address.Global;
// define root node
var elCustomerRoot: elementsof Customer;
var newCustomer;
// define common node - person
var elCustomerPerson: elementsof Customer.Common.Person;
//create root instance and set parameter CategoryCode.
// CategoryCode = "1" = Person,
// CategoryCode = "2" = Organization.
elCustomerRoot.CategoryCode = "1";
newCustomer = Customer.Create(elCustomerRoot);
//if new instance was set, set relation from this BO to BO Customer:
if ( newCustomer.IsSet() ) {
this.toCustomer = newCustomer;}
else { raise BOCreationFailed.Create("E", this.ID); }
// Filling node CurrentBusinessCharacters with aim at variable CustomerIndicator, which is manadatory!
// CustomerIndicator = true, then Person is customer
// OR ProspectIndicator = true, then Person is prospect
newCustomer.CurrentBusinessCharacters.CustomerIndicator = true;
// node Person-Name: Field PersonFamilyName is mandatory
newCustomer.CurrentCommon.Person.Name.FamilyName = “Testname”;
使用query 读取customer数据的代码:
import import ABSL;
import AP.FO.BusinessPartner.Global;
// Define variables
var query;
var selParams;
var queryResult;
// define query and selection parameter
query = Customer.QueryByIdentification;
selParams = query.CreateSelectionParams();
// Retrieve customer by query identification
selParams.Add(query.InternalID,"I","EQ", “1000480”);
queryResult = query.Execute(selParams);
foreach (Customer in queryResult) {
this.PersonFamilyName = Customer.CurrentCommon.Person.Name.FamilyName;
只有状态为Active的Customer才能参与到Sales流程中来
If you need to use your newly created Business Partner in Business Processes for example Sales Order, then it is need to use the action "activate". This action switches the status of the created Business Partner from "in Preparation" to "Active". Only active Business Partner can be used in Business Processes.
Employee
Definition
A person who contributes or has contributed to the creation of goods or services for a company. Employee includes both internal and external employees (service performers). Unlike externals, internal employees are bound by instructions and obliged to adhere to the company's policies and regulations.
Business Context and Use
The Employee business object contains all of the personal data stored for an employee, such as name, address, or bank details. The object can be used for internal employees or externals.
Generally speaking, instances of the Employee business object can be created in "Active" status only for internal employees. This status cannot be changed later. If the Human Capital Management deployment unit is activated, an instance of the business object is created for the internal employee by the personnel event Hiring ( Personnel Hiring business object). If the Human Capital Management deployment unit is not active, it is possible to create an instance of the business object for an internal employee directly.
The Employee business object is administered in Human Capital Management, but it is available to all other applications as well. It contains the following data:
- Personnel number (can be assigned manually or automatically)
- Personal data (for example, name, date and place of birth)
- Address (for example, business address, private address)
- Communication data (for example, telephone number, e-mail address)
- Bank details
Information for External Consumers
Creating an Employee
(There are no Root elements that have to be specified.)
The Given and the Family Name of the Common node has to be specified.
It is also mandatory to create an instance of the node Employee Type.
Employee BO的创建代码:
import ABSL;
import AP.FO.BusinessPartner.Global;
var instEmployee;
instEmployee = Employee.Create();
// Maintain the mandatory elements Given Name and First Name in node Common
instEmployee.CurrentCommon.Person.Name.GivenName = "Given Name";
instEmployee.CurrentCommon.Person.Name.FamilyName = "Family Name";
// Maintain the mandatory node Employee Type
var varEmployeeType: elementsof Employee.EmployeeType;
// Maintain the Internal Employee Indicator = true for an "internal" Employee
varEmployeeType.InternalEmployeeIndicator = true;
instEmployee.EmployeeType.Create(varEmployeeType);
If there is an external number assignment for the Employee ID, than the Employee ID has to be also specified.
// Maintain the Employee ID via the Employee ID
var varIdentificationEmployeeID: elementsof Employee.Identification;
varIdentificationEmployeeID.EmployeeID = "E123";
instEmployee.Identification.Create(varIdentificationEmployeeID);
使用query读取employee数据:
import ABSL;
import AP.FO.BusinessPartner.Global;
var qryEmployee_Identification_QueryByEmployeeAttributes;
var selParamsEmployee_Identification_QueryByEmployeeAttributes;
var colEmployee_Identification;
var instEmployee_Root;
// call QueryByEmployeeAttributes
if (this.EmployeeID.content.IsInitial()) {
qryEmployee_Identification_QueryByEmployeeAttributes = Employee.Identification.QueryByEmployeeAttributes;
selParamsEmployee_Identification_QueryByEmployeeAttributes = qryEmployee_Identification_QueryByEmployeeAttributes.CreateSelectionParams();
if (!this.GivenName.content.IsInitial()){
selParamsEmployee_Identification_QueryByEmployeeAttributes.Add(qryEmployee_Identification_QueryByEmployeeAttributes.BusinessPartnerCommonPersonNameGivenName, "I", "EQ", this.GivenName.content);
}
if (!this.FamilyName.content.IsInitial()){
selParamsEmployee_Identification_QueryByEmployeeAttributes.Add(qryEmployee_Identification_QueryByEmployeeAttributes.BusinessPartnerCommonPersonNameFamilyName, "I", "EQ", this.FamilyName.content);
}
if (!this.JobName.content.IsInitial()){
selParamsEmployee_Identification_QueryByEmployeeAttributes.Add(qryEmployee_Identification_QueryByEmployeeAttributes.JobName, "I", "EQ", this.JobName.content);
}
if (!this.ManagerID.content.IsInitial()){
selParamsEmployee_Identification_QueryByEmployeeAttributes.Add(qryEmployee_Identification_QueryByEmployeeAttributes.ManagerEmployeeID.content, "I", "EQ", this.ManagerID.content);
}
if (selParamsEmployee_Identification_QueryByEmployeeAttributes.Count() > 0 ){
colEmployee_Identification = qryEmployee_Identification_QueryByEmployeeAttributes.Execute(selParamsEmployee_Identification_QueryByEmployeeAttributes);
foreach (instEmployee_Identification in colEmployee_Identification) {
instEmployee_Root = instEmployee_Identification.ToRoot;
this.EmployeeName.content = instEmployee_Root.CurrentCommon.BusinessPartnerFormattedName;
this.EmployeeID.content = instEmployee_Identification.EmployeeID.content;
break; // of course colEmployee_Identification could contain more than one employee depending on the selection criteria
}
}
}
读取当前employee的生日:
import ABSL;
import AP.FO.BusinessPartner.Global;
import AP.PC.IdentityManagement.Global;
var qryIdentity_ROOT_QueryByElements;
var selParamsIdentity_Root_QueryByElements;
var colIdentity_Root;
var qryEmployee_Root_QueryByIdentification;
var selParamsEmployee_Root_QueryByIdentification;
var colEmployee_Root;
var attrIdentity_Root_UUID;
var instIdentity_Root;
// get UUID of current Identity
attrIdentity_Root_UUID = Context.GetCurrentIdentityUUID();
// get instance of current identity
if (this.birthday.IsInitial()) {
qryIdentity_ROOT_QueryByElements = Identity.QueryByElements;
selParamsIdentity_Root_QueryByElements = qryIdentity_ROOT_QueryByElements.CreateSelectionParams();
selParamsIdentity_Root_QueryByElements.Add(qryIdentity_ROOT_QueryByElements.UUID.content, "I", "EQ", attrIdentity_Root_UUID.content);
colIdentity_Root = qryIdentity_ROOT_QueryByElements.Execute(selParamsIdentity_Root_QueryByElements);
foreach (instIdentity_Root in colIdentity_Root) {
break;
}
}
// get employee instance and his birthday via identity instance unsing QueryByIdentification at the Root node
if (instIdentity_Root.IsSet() ) {
qryEmployee_Root_QueryByIdentification = Employee.QueryByIdentification;
selParamsEmployee_Root_QueryByIdentification = qryEmployee_Root_QueryByIdentification.CreateSelectionParams();
selParamsEmployee_Root_QueryByIdentification.Add(qryEmployee_Root_QueryByIdentification.UUID.content, "I", "EQ", instIdentity_Root.BusinessPartnerUUID.content);
colEmployee_Root = qryEmployee_Root_QueryByIdentification.Execute(selParamsEmployee_Root_QueryByIdentification);
foreach (instEmployee_Root in colEmployee_Root) {
this.birthday = instEmployee_Root.CurrentCommon.Person.BirthDate;
break; // colEmployee_Root should contain exactly one employee
}
}
更多Jerry的原创文章,尽在:"汪子熙":