Skip to Content
0
Nov 23, 2018 at 09:31 AM

UpdateTimeSheet overwrites the values and entries when used FromXML.

43 Views

Hi,

I’ve created a Time Sheet which has 2 time recordings for Employee Type: (attached image : image1)

When I try to update the second recording (line 2) of this Time Sheet and only “Financial project” value as “Prj03” using XML (image 3)

it overwrites the existing recordings and also clears/blank the rest of the values: (attached image : image2)

- Is it behaviour for updating Time sheet using XML approach or is there any other way to update the Time sheet which will not affect the existing data?

My Code :

// String inputFilePath : updatetimesheet.jpgpath of the xml which is used to update the Timesheet

public static string UpdateTimeSheets(String inputFilePath)

{

String message = "";

// oCompanyService object is already created.

SAPbobsCOM.IProjectManagementTimeSheetService oTimeSheetService = (SAPbobsCOM.IProjectManagementTimeSheetService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementTimeSheetService);

PM_TimeSheetData oTimeSheet =(PM_TimeSheetData)oTimeSheetService.GetDataInterface(SAPbobsCOM.ProjectManagementTimeSheetServiceDataInterfaces.pmtssPM_TimeSheetData);

try

{

oTimeSheet.FromXMLFile(inputFilePath);

oTimeSheetService.UpdateTimeSheet(oTimeSheet);

return message;

}

catch (Exception e)

{

message = e.Message;

}

return message;

}

Attachments

updatetimesheet.jpg (267.6 kB)