submitTimeSheet

Purpose

Submit an existing Time Sheet object in PPM.

Note: This operation supports the Day in Days option and Period in Days option, which were introduced since PPM Center version 8.00 Service Pack 1. For more information, see the Time Sheet Update Service section in Project and Portfolio Management Center Version 8.00.01 (Service Pack 1) Release Notes.

Function

This operation updates the status of all the lines of an existing time sheet, and the status of the time sheet to "submitted."

Before this operation, the status of the time sheet must be "unsubmitted" or "in-rework." Additionally, you must set the billing approver or time approver for the resource of the time sheet.

During the submission, you can update any existing line item data. To submit all line items with out any change, include all lines or include none of the lines. If the operation has one or more lines included, any missing unsubmitted lines will be removed.

The user performing this operation must have the permission to submit this particular time sheet, meaning that the user must meet the following conditions:

  • Have the Time Mgmt: Edit Time Sheets access grant.

  • Be one of the following:

    • The resource of this time sheet.

    • The delegate of the resource.

    • The manager of the resource.

Input

An object of whole TimeSheetBean to submit.

Return

An object of TimeSheetBean.

Java Interface

SubmitTimeSheetResponseDocument submitTimeSheet(SubmitTimeSheetDocument in)

Parameters

Description

SubmitTimeSheetDocument

Wrapper for TimeSheetBean. See the following example for the construction.

SubmitTimeSheetResponseDocument

Wrapper for TimeSheetBean. See the following example on how to retrieve the bean.

Java Examples

Example: submit an existing time sheet.

TimeSheetBean createdTimeSheetBean = null;
    public void testSubmitTimeSheet() {
        System.out.println("testSubmitTimeSheet started ...");
        try {
            if(createdTimeSheetBean == null)
                testCreateTimeSheet();
            TimeServiceStub stub = new TimeServiceStub(ctx,
WSURL);
            SubmitTimeSheetDocument submitTimeSheetDocument =
SubmitTimeSheetDocument.Factory.newInstance();
            TimeSheetBean submitTimeSheetBean =
submitTimeSheetDocument.addNewSubmitTimeSheet().addNewTimeSheet
Bean();
submitTimeSheetBean.setTimeSheetId(createdTimeSheetBean.getTime
SheetId());
submitTimeSheetBean.setResourceId(createdTimeSheetBean.getResou
rceId());
submitTimeSheetBean.setPeriodId(createdTimeSheetBean.getPeriodI
d());
             TimeSheetStatus timeSheetStatus =
submitTimeSheetBean.addNewState();
             timeSheetStatus.setCode(new BigInteger("1"));
             timeSheetStatus.setMeaning("unsubmitted");
             TimeSheetLineBean timeSheetLineBean =
submitTimeSheetBean.addNewTimeSheetLines();
timeSheetLineBean.setTimeSheetLineId(createdTimeSheetBean.getTi
meSheetLinesArray(0).getTimeSheetLineId());
timeSheetLineBean.setWorkItemId(createdTimeSheetBean.getTimeShe
etLinesArray(0).getWorkItemId());
timeSheetLineBean.setWorkItemSetId(createdTimeSheetBean.getTime
SheetLinesArray(0).getWorkItemSetId());
timeSheetLineBean.setWorkItemType(createdTimeSheetBean.getTimeS
heetLinesArray(0).getWorkItemType());
          TimeActualsBean timeActualsBean1 =
timeSheetLineBean.addNewTimeActualsList();
          timeActualsBean1.setTotalsFlag(true);
          timeActualsBean1.setEffortsListArray(new double[]
{1,2,3,4,5,0,0,1,2,3,4,5,0,0,10});
            TimeActualsBean timeActualsBean2 =
timeSheetLineBean.addNewTimeActualsList();
            timeActualsBean2.setTotalsFlag(false);
            timeActualsBean2.setEffortsListArray(new double[]
{1,2,3,4,5,0,0,1,2,3,4,5,0,0,10});
            SubmitTimeSheetResponseDocument response =
stub.submitTimeSheet(submitTimeSheetDocument);
            TimeSheetBean returnTimeSheet =
response.getSubmitTimeSheetResponse().getReturn();
            System.out.println("Time Sheet was submitted " +
returnTimeSheet.getTimeSheetId());
        }
        catch(Exception e) {
            e.printStackTrace();
        }
        System.out.println("testSubmitTimeSheet completed");
    }

Errors and Exceptions

When an error occurs on this operation, you will receive a description of the root cause in the log or in the response message.

The server log file content is similar to the following:

Exception in thread "main" org.apache.axis2.AxisFault: [root cause description] 

Response message:

<exception:exceptionDetails xmlns:exception="http://
www.mercury.com/ppm/ws/exception">
<exception:detail>[root cause description] </exception:detail>
</exception:exceptionDetails>

Possible root cause descriptions:

Message Code

Message

Cause(s)

Possible Corrective Action

ex.cannotEditTimesheet

User cannot edit Timesheet

User may not have the required access grant or Time Management License.

Check the user licenses and privileges (access grants).

ex.timesheetCannotbeSubmitted

Timesheet is not in unsubmitted or rework state, it cannot be submitted

Time sheets can be submitted only if they are unsubmitted or in rework.

Check the state of the time sheet that you are trying to submit.

ex.timesheetNullCannotbeSubmitted

Timesheet is null, cannot be submitted

Time sheet ID is invalid, database might be corrupt.

Check the validity of the time sheet ID.

ex.tsIncorrectSubmitStatus

This timesheet can not be submitted as timesheet status is submitted or there is no unsubmitted timesheet line

Time sheet status is incorrect to submit.

Perform the getTimeSheet operation to check the time sheet status, and then perform other appropriate operations.

ex.timesheetApproverNotSet

Billing or Time Approver for this resource is not set

Billing or time approver is needed for submit operation.

Set the billing or time approver in PPM Center for the resource of the timesheet.