a month ago
Hello FSM experts,
I need advice regarding an issue of converting PNG/JPG attachments to base64 format for integration purposes in SAP FSM. In my current setup, I use business rule to extract an attachment through the Get Attachment API, convert it to base64, and send it to another system via an API call. For the past 3 years, my way has worked fine. However, over the last few days, the base64 conversion has stopped work correctly—it seems to replace characters like 'i' with '/' and possibly more (e.g. MIME-type "iVBOR" (means PNG type) changed to "/VBOR").
At present, I am using JavaScript to handle the conversion directly within the second API call. I would like to ask the community: what methods or practices do you use to convert attachments to base64 in similar scenarios? Are there any reliable alternatives you use and work event these days?
Example of JS conversion to base64 is in attachment.
Thank you in advance for your insights!
Filip
Request clarification before answering.
Hello! USPS Liteblue@zarnovickyf
Here's a high-level approach to troubleshooting and resolving the issue you're experiencing with converting PNG/JPG attachments to base64 in SAP FSM, without diving into code:
Since this method has been working for years, the first thing to consider is whether there have been any recent updates to SAP FSM or the external systems you're integrating with. System updates, API changes, or updates to underlying libraries can sometimes affect how base64 encoding works.
The issue you're describing—where characters like 'i' get replaced by '/'—suggests there may be an encoding inconsistency, especially when the base64 data is transferred. It's possible that the encoding used to convert the attachment to base64 might not be the same on both sides of the integration (i.e., how SAP FSM and the receiving system are interpreting the data).
Base64-encoded files typically begin with a MIME type (e.g., data:image/png;base64,). If this part is missing or altered, the data might not be correctly recognized or decoded at the other end.
Since you're using SAP FSM to handle attachments, ensure that the attachment retrieval process is still functioning correctly. Sometimes, changes to how files are retrieved or processed might impact the integrity of the base64 encoding.
If the base64 string is very large (for example, large images or attachments), it's possible that the data is being truncated or altered during transmission.
To check if the base64-encoded data is correct, you can use online base64 tools. These tools can help you verify whether the base64 encoding is correct and if the file, when decoded, matches the original image or file.
Sometimes, specific file types or attachments might behave differently, especially if the files are large or have complex metadata.
Best regards,
Diana Peters
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Diana, thanks for your message, it helps us analyze the problem. The solution came from SAP Support, they gave us a new API to get Attachments that solved the problem:
https://eu.fsm.cloud.sap/cloud-attachment-service/api/v1/Attachment/${attachment.id}/content?dtos=Attachment.18&account=${account.name}&company=${company.name}
Until now we were using https://eu.coresuite.com/api/data/v4/Attachment/${attachment.id}/content?dtos=Attachment.18&account=${account.name}
Filip
User | Count |
---|---|
19 | |
17 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.