on 03-03-2015 5:29 AM
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.
Regards
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.
The following are the key actions that you can perform on your UDO:
For sample code, see GeneralService.
For sample code, see GeneralService.GetByParams.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
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);
oGeneralService.Update(oGeneralData);
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();
SBO_Company.StartTransaction();
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);
oGeneralService.Add(oGeneralData);
Hope it helps.
Thanks & Regards
Ankit Chauhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
9 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.