1

I want to add (or update) sale employee (database table: OSLP) using DI API. The object to use is SalesPerson, but in its public properties I dont see 'Telephone', 'Mobile', 'Fax',... I just added successfully a record without these properties, it means that I used the correct service (SalesPerson). So how I can add a record with fields like: Telephone, Mobile, ... ? Thanks in advance.

Please check my images for more info:

NULL
  • 13
  • 1
  • 4

2 Answers2

0

Try using the EmployeesInfo Object:

SAPbobsCOM.EmployeesInfo EmployeeInfo = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oEmployeesInfo);
EmployeeInfo.GetByKey("BOB");
EmployeeInfo.Remarks = "Always Late!";
Praxiom
  • 578
  • 1
  • 8
  • 21
  • I dont think it work, EmployeesInfo Object process data in table OHEM, I want to add record to table OSLP. – NULL Apr 03 '20 at 12:21
  • My Apologies, it seems as though the properties you mentioned are not exposed to the DI. Could it be performed in code through the UI ? – Praxiom Apr 03 '20 at 12:53
  • "Could it be performed in code through the UI ?", sorry, I dont get it. – NULL Apr 03 '20 at 13:25
  • You could try to open the form on screen within the sap application, find the final row and add the data directly to the grid, then force a click event on the button. – Praxiom Apr 03 '20 at 13:37
  • We use DI API on our own application, we have 2 options: save data using DI service or save data using our service (execute sql command). I think DI API doesn't have object for this task. – NULL Apr 03 '20 at 13:54
  • Thank you so much for your answers. And sry for my bad English =)) – NULL Apr 03 '20 at 13:55
  • no problem, your english is perfect :) i think there is no way to set this property, could you create a user field, call it 'mobile2' and set that with the DI? – Praxiom Apr 03 '20 at 15:43
0

In the OP's graphic, you see the EmployeeID, which is a foreign key to the EmployeesInfo object.

If you have loaded a salesperson record into memory as a SalesPersons object named "oslp", this is how you'd update the mobile phone:

var ohem = company.GetBusinessObject( BoObjectTypes.oEmployeesInfo ) as EmployeesInfo;
if ( ohem.GetByKey( oslp.EmployeeId ) ) {
  ohem.MobilePhone = newMobilePhoneNumber;
  var errorCode = ohem.Update();
  // Deal with error, if any
}

If you hire a new salesperson, you would add the EmployeesInfo first and note the new person's EmployeeId; then add the Salespersons record and fill in the EmployeeId.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Charles Jenkins
  • 340
  • 4
  • 10