Showing results for 
Search instead for 
Did you mean: 

General Services

Former Member
0 Kudos

Dear Experts,

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.

Plz reply.


Accepted Solutions (1)

Accepted Solutions (1)

Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dhiraj,

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.

Key Actions

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

Ankit Chauhan

0 Kudos

Hello, links are not working anymore. Could you update with working links if possible?

Best regards,

Answers (1)

Answers (1)

Product and Topic Expert
Product and Topic Expert
0 Kudos


Here is some sample to perform it:

1. To Update any UDO Data:

SAPbobsCOM.GeneralService oGeneralService = null;

                                                            SAPbobsCOM.GeneralData oGeneralData = null;

                                                            SAPbobsCOM.GeneralDataParams oGeneralParams = null;

                                                            SAPbobsCOM.CompanyService sCmp = null;

                                                            SAPbobsCOM.GeneralData oChild = null;

                                                            SAPbobsCOM.GeneralDataCollection oChildren = null;

                                                            sCmp = SBO_Company.GetCompanyService();

                                                            oGeneralService = sCmp.GetGeneralService("UDOCODE");

                                                            oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));

                                                            oGeneralParams.SetProperty("Code", ANYCode);

                                                            oGeneralData = oGeneralService.GetByParams(oGeneralParams);

                                                            oChildren = oGeneralData.Child("DETAILTABLEOFUDO");

                                                            oChild = oChildren.Item(LineID - 1);

                                                            oChild.SetProperty("U_Field1", VALUETOSET1);

                                                            oChild.SetProperty("U_Field2", VALUETOSET2);



1. To Add any UDO Data:

SAPbobsCOM.GeneralService oGeneralService;

                                                        SAPbobsCOM.GeneralData oGeneralData;

                                                        SAPbobsCOM.GeneralData oChild;

                                                        SAPbobsCOM.GeneralDataCollection oChildren;

                                                        SAPbobsCOM.GeneralDataParams oGeneralParams;

                                                        oCompService = SBO_Company.GetCompanyService();


                                                        oGeneralService = oCompService.GetGeneralService("UDOCODE");

                                                        oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                                                        oGeneralData.SetProperty("Code", ANYCode);

oGeneralData.SetProperty("U_Field1", ProjectCode);

// Adding data to Detail Line

oChildren = oGeneralData.Child("ACTDETAIL1");

                                                            oChild = oChildren.Add();

                                                            oChild.SetProperty("U_Code", VALUE);

oChild.SetProperty("U_Name", VALUE);


Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos


Thanks for the details.