public static List <Employee> getAllEmployees(RfcDestination destination) { List <Employee> ret = new List <Employee>(); RfcRepository repo = destination.Repository; IRfcFunction employeeList = repo.CreateFunction("BAPI_EMPLOYEE_GETLIST"); employeeList.SetValue("ORG_SEARK", "*"); employeeList.SetValue("JOB_SEARK", "*"); employeeList.SetValue("SUR_NAME_SEARK", "*"); employeeList.SetValue("LST_NAME_SEARK", "*"); employeeList.Invoke(destination); IRfcTable employees = employeeList.GetTable("EMPLOYEE_LIST"); for (int cuIndex = 0; cuIndex < employees.RowCount; cuIndex++) { employees.CurrentIndex = cuIndex; Employee emp = new Employee(); emp.PeronalNr = employees.GetString("PERNR"); emp.Name = employees.GetString("ENAME"); emp.OrgID = employees.GetString("ORG_ID"); emp.Organisation = employees.GetString("ORG_TEXT"); emp.JobID = employees.GetString("JOB_ID"); emp.Job = employees.GetString("JOB_TEXT"); emp.empDetail = EmployeeDetail.getEmployeeDetail(destination, emp.PeronalNr); emp.empAddr = EmployeeAddress.getEmployeeAddress(destination, emp.PeronalNr); ret.Add(emp); } return(ret); }
public static List <EmployeeAddress> getEmployeeAddress(RfcDestination destination, string employeeNum) { List <EmployeeAddress> ret = new List <EmployeeAddress>(); RfcRepository repo = destination.Repository; IRfcFunction employeeList = repo.CreateFunction("BAPI_ADDRESSEMPGETDETAILEDLIST"); employeeList.SetValue("EMPLOYEENUMBER", employeeNum); employeeList.Invoke(destination); IRfcTable employeedetails = employeeList.GetTable("ADDRESS"); for (int cuIndex = 0; cuIndex < employeedetails.RowCount; cuIndex++) { EmployeeAddress adr = new EmployeeAddress(); adr.TypeOfAddress = employeedetails.GetString("NAMEOFADDRESSTYPE"); adr.Address = employeedetails.GetString("STREETANDHOUSENO"); ret.Add(adr); } return(ret); }