cancel
Showing results for 
Search instead for 
Did you mean: 

How to UPSERT the PDF Attachment to Successfactors using SAP HCI

0 Kudos

Hi, I am trying to upsert the attachment in success factors for one of the field(Custom Field) in OData API. Actually, i got the PDF file from the third party response and i have to upsert that PDF File in JobApplication API. I didn't see that field from the fields list in the API(Job Application) while configuring the adapter. Do i need to attach through Attachment API? If yes, what is the procedure and what is the association between Attachment API and Job Application API?

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Imran,

Have you resolved the issue and what was the solution.It would help our community if you can brief your solution for the above use case.

Regards,

Sriprasad Shivaram Bhat

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi, I have resolved this issue and written the blog on this. Following is the URL for the blog:

https://blogs.sap.com/2018/09/16/how-to-upsert-the-attachments-into-successfactors-using-sap-cpi/


Sriprasadsbhat
Active Contributor
0 Kudos

Hello Imran,

Please read the API documentation about the format in which data of attachment needs to be passed.

As per my understanding you need to convert the attachment data to Base64 Encoded and pass that value to file content.The xml which you are passing is incorrect.Please generate XML as per the schema generated by model operation ( with above sublevel 1 selected ).

Regards,

Sriprasad Shivaram Bhat

0 Kudos

I have done the Base 64 for PDF content. Then also, no luck. That XML is source structure(Custom Structure) in map. The target side i have taken the XML Schema generated for Job Application.

Map ScreenShot:

mapping-upsert.png

I am getting the following error:

com.sap.gateway.core.ip.component.odata.exception.OsciException: HTTP Request failed with error : executeUtil : failed with error. Message = The target server failed to respond

Final Message i am posting:

final-message-post.png

0 Kudos

Hi Sri,

Thanks for giving the answer. I have created the target structure and i am facing issues while creating the source structure. I am getting the following error:

com.sap.xi.mapping.camel.XiMappingException: com.sap.aii.utilxi.misc.api.BaseRuntimeException: The content of elements must consist of well-formed character data or markup., cause: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 2; The content of elements must consist of well-formed character data or markup.

Iflow Screenshot:

attachmentupsert.png

What i did was, i have created the source structure in Content Modifier 3. I have read the pdf body in property as ${in.body} and creating the body in Content modifier 3 as below.

<?xml version="1.0" encoding="UTF-8"?>
<Attachment>
<Attachment>
<fileName>Test_Result.pdf</fileName>
<fileExtension>pdf</fileExtension>
<ApplicationID>192025</ApplicationID>
<fileContent>${property.PDF_File}</fileContent>
</Attachment>
</Attachment>

Map Screenshot:

mapping-upsert.png

PDF Output From HTTP Adapter looks like below:

pdf-filedata.png

Note: While i am sending this output file to SFTP, i can see and read the original PDF File.

So, please suggest me on how to read the output PDF file(From HTTP Adapter) and create the source strcuture to map the JobApplication API Structure. Thank you.

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Imran,

Below might help you.

In the Query Model Operation Select Job Application and Sub Level 1 where you will get Attachment 1 & then pass all the required values there.

Regards,

Sriprasad Shivaram Bhat