Skip to Content
0
Aug 29, 2023 at 12:05 PM

Timesheet Entry Posting Through CAPM

242 Views Last edit Aug 31, 2023 at 02:22 PM 3 rev

Hi All,

I am trying to post the timesheet data to my public cloud system through CAPM but getting "CSRF token validation failed" error.

I am using "https://api.sap.com/api/API_MANAGE_WORKFORCE_TIMESHEET/overview" API , here we can API structure is different. Fields which are coming in Complex Type i.e. (TimeSheetDataFields) are not accessible.

below is my payload:-

{

"TimeSheetDataFields": {

"ControllingArea": "string",

"SenderCostCenter": "string",

"ReceiverCostCenter": "string",

"InternalOrder": "string",

"ActivityType": "string",

"WBSElement": "string",

"WorkItem": "string",

"BillingControlCategory": "string",

"PurchaseOrder": "string",

"PurchaseOrderItem": "string",

"TimeSheetTaskType": "string",

"TimeSheetTaskLevel": "string",

"TimeSheetTaskComponent": "string",

"TimeSheetNote": "string",

"RecordedHours": "0",

"RecordedQuantity": "0",

"HoursUnitOfMeasure": "string",

"RejectionReason": "string",

"TimeSheetWrkLocCode": "string",

"TimeSheetOvertimeCategory": "string",

"SenderPubSecFund": "string",

"SendingPubSecFunctionalArea": "string",

"SenderPubSecGrant": "string",

"SenderPubSecBudgetPeriod": "string",

"ReceiverPubSecFund": "string",

"ReceiverPubSecFuncnlArea": "string",

"ReceiverPubSecGrant": "string",

"ReceiverPubSecBudgetPeriod": "string"

},

"PersonWorkAgreementExternalID": "string",

"CompanyCode": "string",

"TimeSheetRecord": "string",

"PersonWorkAgreement": "string",

"TimeSheetDate": "/Date(1492098664000)/",

"TimeSheetIsReleasedOnSave": true,

"TimeSheetPredecessorRecord": "string",

"TimeSheetStatus": "string",

"TimeSheetIsExecutedInTestRun": true,

"TimeSheetOperation": "string"

}

Sample Payload:-

{
"TimeSheetDataFields": {
"ControllingArea": "A000",
"SenderCostCenter": "",
"ReceiverCostCenter": null,
"InternalOrder": "",
"ActivityType": "T005",
"WBSElement": "STLBSNL21042023.1.4",
"WorkItem": "P005",
"TimeSheetTaskType": "",
"TimeSheetTaskLevel": "",
"TimeSheetTaskComponent": "",
"TimeSheetNote": "",
"RecordedHours": "11",
"RecordedQuantity": "1",
"HoursUnitOfMeasure": "H",
"RejectionReason": "",
"TimeSheetWrkLocCode": "",
"TimeSheetOvertimeCategory": ""
},
"PersonWorkAgreementExternalID": "MOMPS03",
"CompanyCode": "1810",
"PersonWorkAgreement": null,
"TimeSheetDate": "2023-08-10T00:00:00",
"TimeSheetStatus": "30",
"TimeSheetIsExecutedInTestRun": false,
"TimeSheetOperation": "C"
}

It's working fine when we are posting the data in postman or API HUB.

Thanks