What is the use and benefits if using the General Serives in SAP B1 ?
I am using an add-on. In that add-on code some general services are used. So I want to know about that.
Ankit Chauhan replied
In SDK help center it is stated as follows:
The GeneralService enables you to access UDOs from the DI API in order to manipulate user-defined tables.
To work with your UDO, obtain an instance of the GeneralService for your UDO, as follows:
Set oGeneralService = oCmpSrv.GetGeneralService("MainUDO")
where MainUDO is the name of your UDO, and oCmpSrv is an instance of CompanyService. With the instance of GeneralService, you can perform actions on your UDO.
The following are the key actions that you can perform on your UDO:
- Adding a Row: Add the data for the row to a GeneralData object, and call the service's Add method.
For sample code, see GeneralService.
- Looking Up a Row: Pass the key of the row to retrieve to the service's GetByParams method. The process of looking up a row is similar to that for closing, canceling and removing a row.
For sample code, see GeneralService.GetByParams.
- Invoking a Custom Method: You can define custom methods in your UDO's custom business logic implementation DLL, and call them at any time using the service's Invoke method.
The service's InvokeMethod method calls the InvokeMethod method in your UDO custom business logic implementation DLL (if you implemented the method). InvokeMethod can then dispatch the call to other custom method's in the DLL.
For more information, see GeneralService.InvokeMethod.
Hope that helps you to understand.
Thanks & Regards