SAP Cloud for Customer里BusinessPartner, Customer和Employee这些BO的区别 (2)

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

SAP Cloud for Customer里BusinessPartner, Customer和Employee这些BO的区别

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 } } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzfwxs.html