Skip to Content

About Time Sheet:

The Time Sheet feature enables you to record times of activities for an employee, user, or others.

To access this window, from the SAP Business One Main Menu, choose

Human Resources → Time Sheet

A detailed information about the Time Sheet can be found from the following ‘How to Guide for SAP Business One Version 9.2 and SAP Business One 9.2, version for SAP HANA’ .

https://help.sap.com/http.svc/rc/012002523100002810972016e/9.2/en-US/HTG_B1_92_ProjectMgmt.pdf

Using Time Sheet in SAP Business One SDK:

Time Sheet object is exposed as a Service Type Object (ProjectManagementTimeSheetService) from SAP Business One Version 9.2 PL03. It is yet to be implemented in DTW.

Here is how to use the Time Sheet object using DI API:

1. Add a Time Sheet using DI API:

SAPbobsCOM.CompanyService oCompanyService = default(SAPbobsCOM.CompanyService);
SAPbobsCOM.ProjectManagementTimeSheetService oTimeSheetService = null;
oCompanyService = oCompany.GetCompanyService();
oTimeSheetService = (SAPbobsCOM.ProjectManagementTimeSheetService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementTimeSheetService);
SAPbobsCOM.PM_TimeSheetData oTimeSheet = oTimeSheetService.GetDataInterface(SAPbobsCOM.ProjectManagementTimeSheetServiceDataInterfaces.pmtssPM_TimeSheetData);
SAPbobsCOM.PM_TimeSheetParams oTimeSheetParam = oTimeSheetService.GetDataInterface(SAPbobsCOM.ProjectManagementTimeSheetServiceDataInterfaces.pmtssPM_TimeSheetParams);
oTimeSheet.TimeSheetType = SAPbobsCOM.TimeSheetTypeEnum.tsh_Employee;
oTimeSheet.UserID = 1;
SAPbobsCOM.PM_TimeSheetLineData oTimeSheetLine = oTimeSheet.PM_TimeSheetLineDataCollection.Add();
DateTime startTime, endTime, breakTime, nonBillableTime;
startTime = DateTime.Today;
startTime = startTime.AddHours(10);
startTime = startTime.AddMinutes(30);
endTime = DateTime.Today;
endTime = endTime.AddHours(16);
endTime = endTime.AddMinutes(30);
breakTime = DateTime.Today;
breakTime = breakTime.AddMinutes(45);
nonBillableTime = DateTime.Today;
nonBillableTime = nonBillableTime.AddHours(1);
nonBillableTime = nonBillableTime.AddMinutes(5);
oTimeSheetLine.Date = DateTime.Today;
oTimeSheetLine.StartTime = startTime;
oTimeSheetLine.EndTime = endTime;
oTimeSheetLine.Break = breakTime;
oTimeSheetLine.NonBillableTime = nonBillableTime;
oTimeSheetLine.ActivityType = 1;
oTimeSheetLine.CostCenter = "17005678";
oTimeSheetLine.FinancialProject = "01";
oTimeSheetLine = oTimeSheet.PM_TimeSheetLineDataCollection.Add();
startTime = DateTime.Today;
startTime = startTime.AddHours(16);
startTime = startTime.AddMinutes(30);
endTime = DateTime.Today;
endTime = endTime.AddHours(17);
endTime = endTime.AddMinutes(30);
breakTime = DateTime.Today;
breakTime = breakTime.AddMinutes(10);
nonBillableTime = DateTime.Today;
oTimeSheetLine.Date = DateTime.Today;
oTimeSheetLine.StartTime = startTime;
oTimeSheetLine.EndTime = endTime;
oTimeSheetLine.Break = breakTime;
oTimeSheetLine.NonBillableTime = nonBillableTime;
oTimeSheetLine.ActivityType = 1;
oTimeSheetLine.ServiceCall = 1;

oTimeSheetParam = oTimeSheetService.AddTimeSheet(oTimeSheet);

2. Update a Time Sheet using DI API:

SAPbobsCOM.CompanyService oCompanyService = default(SAPbobsCOM.CompanyService);
SAPbobsCOM.ProjectManagementTimeSheetService oTimeSheetService = null;
oCompanyService = oCompany.GetCompanyService();
oTimeSheetService = (SAPbobsCOM.ProjectManagementTimeSheetService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementTimeSheetService);
SAPbobsCOM.PM_TimeSheetParams oTimeSheetParam = oTimeSheetService.GetDataInterface(SAPbobsCOM.ProjectManagementTimeSheetServiceDataInterfaces.pmtssPM_TimeSheetParams);
oTimeSheetParam.AbsEntry = 2;
SAPbobsCOM.PM_TimeSheetData oTimeSheet = oTimeSheetService.GetTimeSheet(oTimeSheetParam);
oTimeSheet.DateFrom = DateTime.Today.AddDays(-1);
oTimeSheetService.UpdateTimeSheet(oTimeSheet);

3. Delete a Time Sheet using DI API:

SAPbobsCOM.CompanyService oCompanyService = default(SAPbobsCOM.CompanyService);
SAPbobsCOM.ProjectManagementTimeSheetService oTimeSheetService = null;
oCompanyService = oCompany.GetCompanyService();
oTimeSheetService = (SAPbobsCOM.ProjectManagementTimeSheetService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementTimeSheetService);
SAPbobsCOM.PM_TimeSheetParams oTimeSheetParam = oTimeSheetService.GetDataInterface(SAPbobsCOM.ProjectManagementTimeSheetServiceDataInterfaces.pmtssPM_TimeSheetParams);
oTimeSheetParam.AbsEntry = 2;
oTimeSheetService.DeleteTimeSheet(oTimeSheetParam);

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply