Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
13,226
This blog describes how to upsert the attachments into Successfactors using SAP Cloud Platform Integration. I am using Job Application OData API to achieve this.

For any Attachment to upsert into Successfactors OData API, we should have to do this through Attachment OData API. Attachment is a generic API to upsert any attachment in Successfactors.

In this blog i am going to explain how to upsert the PDF file into JobApplication API. In my JobApplication API, I have a custom field whose data type is Attachment and having the navigation to Attachment API from that field. If you select the Sub Level-1, you can see the attachment fields. Any how, i have not used the Succssfacors adapter to upsert. I am just showing this screenshot for API navigation and field structure.

 



 

Once you select the JobApplication API, the business key field will be automatically ticked the check box and it appears in the upsertable fields list. But coming to the Attachment API, Attachment ID is the business key but we should not upsert any data into this field. In Attachment API, we have to select the fileContent, fileName, module fields. These 3 are the required fields in this API.The DataType for fileContent field is Base64. For module field you can hardcode to RECRUITING.

Integration flow design:




 

In the above screenshot, I get the PDF File content from HTTP Adapter and after that i am using the Encoder shape to do the Base 64 format of the PDF Content. After that i am creating one header as Content-Type as "application/json". In Property, i have created one property as PDF and given the value to that property as the Base 64 Encoded data. After that i have created the body, which will accepts by the JobApplication API.

Content Modifier Screenshot:


Header:



 
Property:



 
Body:


Sample Json Data to Upsert:

{
"__metadata":{
"uri": "JobApplication(applicationId='1234')"
},
"applicationId": "1234",
"cust_ResultField":{
"fileContent":"SGVsbG8gV29ybGQh",
"module":"RECRUITING",
"fileName":"Result.pdf"
}
}

After that i am logging the payload data in the groovy script. After that, i am using the HTTP adapter to upsert the data into successfactors using POST operation and followed by the response catching using groovy script.

Best Regards,

Imran
22 Comments
0 Kudos
Hi Imran,

Thanks for great information.

Regards,

Ferozkhan
Harsh9
Participant
0 Kudos
Hi Imran

 

Thanks for sharing this blog. I have a question.

 

While upserting using HTTP adapter, it is returning status 500. I analyzed everything but everything looks good with json payload and HTTP adapter.

Could you please suggest?
rawinder2489
Explorer
0 Kudos
Hi Imran,

I am also having same requirement, sending Base64Encode from ERP to SF via HCI Middleware (Source and target both XML).

We have DecodedBase64 file in HCI but while trying to POST the data to Custom Portlet, we are getting Issues. Can we send PDF content into attachment field. Please find the screen shot of HCI_Log. and also find the complete iflow of Payslip. Kindly guide us on this Process.





Regards,

Rawinder

 

 
0 Kudos
Hi Rawinder,

Yes, we can send PDF content to attachment field. But it accepts the data in encoded format only. Use the Encoder shape to encode the PDF Content and set that in one property, like my screenshot above. After that take the content modifier and in it's body, place SF Formatted data(See My last screenshot). Also, use Request-Reply instead of End message. By using this you can see the upsert response from SF System. I also recommend to use HTTP Adapter instead of Successfactors. Try that and let me know if you face any issues.

Regards,

Imran
rawinder2489
Explorer
0 Kudos
Hi Imran,

I am sending Encoded Message and want to Decode in HCI but however i am failing to send the Decoded Message to SF. I have followed your steps but failing to Upsert the Decoded Data into SF.

  1. Have few doubts:- Can we convert Encoded data to Decoded data in HCI and Upsert into SF?


2. I am using Https as recommended but I am getting the data in XML(from source) format so should we send XML target side or  we can send Json as well?

 

Regards,

Rawinder

 

 
0 Kudos
Hi Rawinder,

  1. Attachments accepted in Encoded format only. You no need to decode the attachment in CPI. You can see the decoded- attachment directly in SF

  2. Yes, You can send XML as well using Https.

  3. First you make the trails with any rest tool like Postman/Boomerang to upsert the data into SF. Once, it is success, do with CPI.


Regards,

Imran
0 Kudos
HI Imran,

I am working on attachment, all looks good, but when I post as json or xml SFSF give me below error.

Inline edit for 'cust_FilesNav' is not supported. with the index 0

below is my payload

{
"__metadata":{
"uri": "cust_FileDemo"
},
"externalCode": "1234",
"effectiveStartDate":"/Date(1556568000)/",
"cust_FilesNav":{
"fileContent":"JVBERi0xLjQKJe",
"module":"EC",
"fileName":"Result.pdf"
}
}

 

Please let me know if I am doing anything wrong.

 

Thank you in advance.

Wajahat Imam
0 Kudos
Hello Imam,

You are missing the Business key in the structure. You have to maintain the business key corresponding to the API you are using(cust_FileDemo). Check the below corrected payload.

 

{
“__metadata”:{
“uri”: “cust_FileDemo(“externalCode”: “1234”)"
},
“externalCode”: “1234”,
“effectiveStartDate”:”/Date(1556568000)/”,
“cust_FilesNav”:{
“fileContent”:”JVBERi0xLjQKJe”,
“module”:”EC”,
“fileName”:”Result.pdf”
}
}

 

Regards,

Imran
ananda_paul
Explorer
0 Kudos
Hi Imran,

I am also getting the same error. I have attached the sample request that I posted and I am getting error response as Inline edit for 'cust_attachmentNav' is not supported

usersSysId is nothing but the externalCode.

Flow details:

Adapter - SuccessFactors

 

 

 
<?xml version="1.0" encoding="UTF-8"?><cust_Payslip3>
<cust_Payslip3>
<PeriodStartDate>2019-02-02T10:00:00</PeriodStartDate>
<cust_PeriodEndDate>2019-02-02T10:00:00</cust_PeriodEndDate>
<mdfSystemTransactionSequence>123</mdfSystemTransactionSequence>
<usersSysId>222333</usersSysId>
<cust_Gross>55000</cust_Gross>
<cust_Deductions>2000</cust_Deductions>
<cust_attachmentNav>
<Attachment>
<attachmentId>12345432</attachmentId>
<fileContent>JVBERi0xLjQKMSAwIG9iago8PC9UeXBlIC9YT2JqZWN0Ci9TdWJ0eXBlIC9JbWFnZQovTmFtZSAvSkkxYQovV2lkdGggMTY1MwovSGVpZ2h0IDIzMzgKL0JpdHNQZXJDb21wb25lbnQgOAovQ29sb3JT==</fileContent>
<fileName>one.pdf</fileName>
<module>GENERAL_OBJECT</module>
<userId>adminHCI</userId>
<viewable>true</viewable>
<deletable>false</deletable>
</Attachment>
</cust_attachmentNav>
</cust_Payslip3>
</cust_Payslip3>
0 Kudos
hi,

please find the following sap note if you are using a custom mdf

https://launchpad.support.sap.com/#/notes/0002599554

thanks silvia
ananda_paul
Explorer
0 Kudos
Hi Silvia,

Thanks for the link.

I followed the link exactly like inserting the Attachment table and then inserting the MDF with the attacmentID that was returned in the previous insert. I have attached the request payload to insert cust MDF table with the attacmentID. I am still getting the error as Inline editing for cust_MDF is not supported. wiht the index 0

Can you please point me where I am wrong?

0 Kudos
Having the same issue if I am trying to add it per xml payload. Per json it is working fine. Seams an incident is necessary.

 

thx silvia
ananda_paul
Explorer
0 Kudos

Hi Silvia,

Meanwhile, I tried posting it in JSON format. But, SuccessFactors adapter does not like the json format. It was giving me XML parser exception. Its looking for xml tag, but the body starts with { as its a json. I cannot submit it though http adpater.

Can you please guide me on how to use SF adapter to post the json format data? OR post it via http adapter?

JSON Req. message:

{
"__metadata": {
"uri": "Attachment"
},
"userId": "adminhci11",
"fileName": "json-payslip.pdf",
"module": "GENERIC_OBJECT",
"description": "payslip file",
"fileContent": "adsf234asdf2903irojfj3dovTmFtZSAvSkkxYQovV2lkdGggMTY1MwovSGVpZ",
"viewable": true,
"deletable": false
}

Rgs,

Anand…

0 Kudos
Hi Ananda,

Please use http adapter with Json format. Correct the below 2 lines in your Json Payload and try to upsert.

{

“__metadata”:{
“uri”: “Attachment(“userId”: “adminhci11”)”

}

Regards,

Imran
ananda_paul
Explorer
0 Kudos
Hi Imran,

 

I just now saw your message. I implemented this via XML format.

Thanks for your blog and help
former_member624836
Discoverer
0 Kudos
Hi Imran,

Thanks for great information. I am an ABAP developer and want to learn SF API.

I want to know how can I get the Json code from SF API.

In SF API center, I only can see the structure for API, but no Json code.

Could you tell me how to go through Content Modifier .

 
Sample Json Data to Upsert:

{
“__metadata”:{
“uri”: “JobApplication(applicationId=’1234′)”
},
“applicationId”: “1234”,
“cust_ResultField”:{
“fileContent”:”SGVsbG8gV29ybGQh”,
“module”:”RECRUITING”,
“fileName”:”Result.pdf”
}
Praveenkalwa
Explorer
0 Kudos
Hi Imran - I have the similar requirement but my middle ware is SAP PI, can we use the same using SAP PI . If you have any step by step flow using SAP PI . Please reply in the thread.

 

Regards

Praveen K
0 Kudos

Hello guys!

 

When the upsert occurs in the same user of the SuccessFactors that is configured in the CPI, the integration completes, 
but when it is done for another user of the SuccessFactors the following error occurs:
There is no permission to access the attached file 0010004338462019.pdf. 
The attachment in the cust_attachment field does not belong to the user adminEC.


Can anybody help me?

 

jaideepshetty
Participant
0 Kudos
Hi Vivian,

 

Were you able to find the cause or resolve this ?

 

Thanks

 
Hi Jaideep,

Yes, I was able to solve this problem!

I just had to pass the user configured in the "Security Material" of Success 

to the API "Attachment", in the userId field.
I was passing the user of the person who would access the Success (
001000433
jaideepshetty
Participant
0 Kudos
Hi Vivian,

 

Thank you for reply.

 

May I know what did you mean when you said Security Material?
"pass the user configured in the Security Material"


Thank you,
Jaideep Shetty
0 Kudos

​I have a problem in accessing upsert functionality of SuccessFactors from CPI. I am using Succesfactors odata v2 adapter in CPI but I am unable to find the Upsert Enitity .



 

 

I cannot find the upsert Entity in the SuccessFactors OData v2 in CPI. But I am able to access the same using Postman. Other odata functionalities are accessible from CPI using Oauth2 saml bearer token. Upsert functionality belongs to function-import  operation of SuccessFactors adapter. Is it implemented in SuccessFactors adapter?



Cannot find the upsert entity in SF adapter



Postman Client





In the screenshot, I am able to access the same upsert odata in postman using oauth token. I am unable to find the same in CPI. Kindly provide the solution for this issue.


Thanks in advance.



Labels in this area