Skip to Content
Product Information
Author's profile photo ANKIT CHAUHAN

Resource Master Data object is exposed in SAP Business One Version 9.2

About Resource Master Data:

A resource is a commodity, machine, labor, and so on, used to produce goods and services. As opposed to items, resources have capacity available throughout a period of time that can be consumed in a production process. You can define daily resource capacity for each day separately or for a period of time, and then you can assign the capacity to production orders.

To access this window, from the SAP Business One Main Menu, choose  Resources  Resource Master Data.

For more details on Resource Master Data, you can refer to following link:

https://help.sap.com/saphelp_sbo92/helpdata/en/44/c4c1cd7ca22e17e10000000a114a6b/frameset.htm

Using Resource Master Data in SAP Business One SDK:

“Resource Master Data” object is exposed as a Service Type Object in SAP Business One Version 9.2 .

Here is how to use this object using DI API:

1. Add a Resource Master Data using DI API:

SAPbobsCOM.CompanyService oCS = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
SAPbobsCOM.ResourcesService srvResources = (SAPbobsCOM.ResourcesService)oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.ResourcesService);
SAPbobsCOM.Resource res = (SAPbobsCOM.Resource)srvResources.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResource);
res.VisCode = "r1";
SAPbobsCOM.ResourceWarehouse Whs = res.Warehouses.Add();
Whs.Warehouse = "01";
SAPbobsCOM.ResourceDailyCapacity DC = res.DailyCapacities.Add();
DC.Weekday = SAPbobsCOM.ResourceDailyCapacityWeekdayEnum.rdcwFirst;
DC.Factor1 = 1;
SAPbobsCOM.ResourceParams ret = srvResources.Add(res);

2. Update a Resource Master Data using DI API:

SAPbobsCOM.ResourceParams par = (SAPbobsCOM.ResourceParams)srvResources.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResourceParams); 
par.Code = ret.Code; //"r1"; 
SAPbobsCOM.Resource res2 = srvResources.Get(par); 
res2.Name = "name"; 
srvResources.Update(res2);

3. Link a Resource Master Data to an Item using DI API:

SAPbobsCOM.CompanyService oCS = oCompany.GetCompanyService();
SAPbobsCOM.ResourcesService rs = (SAPbobsCOM.ResourcesService)oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.ResourcesService);
SAPbobsCOM.ResourceParams rp = (SAPbobsCOM.ResourceParams)rs.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResourceParams);
rp.Code = resourceCode;
rs.CreateLinkedItem(rp); // This will link an item to the resource master data by creating a new item in Item Master Data.
SAPbobsCOM.ResourceParams rpCheck =(SAPbobsCOM.ResourceParams)rs.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResourceParams);
rpCheck.Code = resourceCode;
SAPbobsCOM.Resource r3 = rs.Get(rpCheck);

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dhiraj Dharan
      Dhiraj Dharan

      Hi Ankit,

      Thank you.. We were looking for this and simply found it...

      Thanks

      Dhiraj

      Author's profile photo Former Member
      Former Member

      Thanks ANKIT CHAUHAN