本篇内容介绍了“C4C和CRM里怎么获取Organization Unit信息”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
如何查看某个用户分配的组织单元ID:
在Employee的Organization Data区域内看到分配的组织名称,如下图红色下划线所示:
现在的需求就是使用ABSL获取当前登录用户分配的Organization Unit信息,例如用WANGJERRY37登录,则取出下图显示的Department name PMLS:
具体实现:新建一个custom BO,使用字段DepartmentName存储这个待取的值:
然后创建AfterLoading script file,使用如下代码:
import ABSL; import AP.PC.IdentityManagement.Global; import AP.FO.BusinessPartner.Global; var queryByIdentityUUID = Identity.QueryByElements; var queryByIdentityUUIDParameter = queryByIdentityUUID.CreateSelectionParams(); var queryByEmployeeBPUUID = Employee.QueryByIdentification; var queryByEmployeeBPUUIDParameter = queryByEmployeeBPUUID.CreateSelectionParams(); if ( this.DepartmentName.IsInitial()){ var id = Context.GetCurrentIdentityUUID().content; queryByIdentityUUIDParameter.Add( queryByIdentityUUID.UUID.content, "I", "EQ", id.ToString() ); var result = queryByIdentityUUID.Execute(queryByIdentityUUIDParameter); var first = result.GetFirst(); // points to identity instance var person = first.Person; var bpUUId = person.UUID.content; queryByEmployeeBPUUIDParameter.Add( queryByEmployeeBPUUID.UUID.content, "I", "EQ", bpUUId.ToString()); var employeeQueryResult = queryByEmployeeBPUUID.Execute(queryByEmployeeBPUUIDParameter); var EmployeeQueryResultCurrent = employeeQueryResult.GetFirst(); var assignedOrg = EmployeeQueryResultCurrent.OrganisationalUnitAssignment.GetFirst(); var org = assignedOrg.ToRoot; // readOnly in AfterLoading event this.DepartmentName = org.NameAndAddress.AddressSnapshot.NameSuitableForLogonLanguage.GetFirst().Name.SecondLineName; }
假设Jerry Wang分配的Organization Unit ID为50000732,使用下列report打印出这个ID:
PARAMETERS: id TYPE but000-partner OBLIGATORY DEFAULT '4031140'. DATA: lo_core TYPE REF TO cl_crm_bol_core, lo_collection TYPE REF TO if_bol_entity_col, lo_root_entity TYPE REF TO cl_crm_bol_entity, lv_query_name TYPE crmt_ext_obj_name, lt_selection_parameter TYPE genilt_selection_parameter_tab, ls_selection_parameter TYPE genilt_selection_parameter, ls_query_parameters TYPE genilt_query_parameters, lv_size TYPE i. START-OF-SELECTION. ls_selection_parameter-attr_name = 'PARTNER'. ls_selection_parameter-option = 'EQ'. ls_selection_parameter-sign = 'I'. ls_selection_parameter-low = id. APPEND ls_selection_parameter TO lt_selection_parameter. ls_query_parameters-max_hits = 1. lo_core = cl_crm_bol_core=>get_instance( ). lo_core->load_component_set( 'PROD_ALL' ). lv_query_name = 'BuilEmpAdvancedSearch'. lo_collection = lo_core->dquery( iv_query_name = lv_query_name it_selection_parameters = lt_selection_parameter is_query_parameters = ls_query_parameters ). DATA(lo_result) = lo_collection->get_first( ). ASSERT lo_result IS NOT INITIAL. WRITE: / 'Org unit id: ', lo_result->get_property_as_string( 'ORGEH' ) COLOR COL_NEGATIVE.
最终调用的是这个function module:
“C4C和CRM里怎么获取Organization Unit信息”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。