Skip to Content
1
Jun 01, 2020 at 11:00 AM

Sales Order PDF attachment is corrupted when opened

735 Views

Hello,

I have created a custom program that creates a PDF document and attaches it to the Attachment List in a Sales Order.

The problem I'm facing is that this program is working fine in Development System but it's not working in Quality System.

In Quality System, the program will still attach the document to Sales Order but when I try to open it or even save to PC and open it, it gives an error that the PDF is corrupted.

The code that I used in this process can be summarized as below:

  1. Get the PDF file that needs to be edited and attached from PC via FM GUI_UPLOAD
  2. Convert to Compressed Binary Format using FM SO_CONVERT_CONTENTS_BIN
  3. CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET' to get folder ID
  4. Create SAPoffice object and move to folder using FM SO_OBJECT_INSERT
  5. Link the object using FM BINARY_RELATION_CREATE_COMMIT

There has been no change in Quality System. No difference in code as well.

If anybody can advice here, that would be of great help.

Thank you.