‎2021 May 19 10:34 PM
Hello
Requirement: To create a PDF and attach it to Sales Order through GOS from a base64 encoded string (from PDF file) as Input. The input PDF file has only 'SAP' written in it.
Completed so far:
1. Able to convert the input string into xString using 'SCMS_BASE64_DECODE_STR'
2. Converted xString to Binary using 'SCMS_XSTRING_TO_BINARY'. Below is the Binary output from this step

3. In order to create PDF from this point, I am writing above content to Spool and then converting to PDF using 'CONVERT_ABAPSPOOLJOB_2_PDF'
4. Linked the PDF table from Step 3 to Sales Order GOS attachment successfully
Problem: PDF attached to the Sales Order has the exact data shown in the screenshot as I wrote it in the spool as well. Please guide me in understanding how can I generate the PDF with the original content 'SAP' from Binary data in Step 2 without the unwanted data.
‎2021 May 19 11:47 PM
Hi natashagarg,
Out of curiosity, have you tried ADS_CREATE_PDF_SPOOLJOB?
Cheers,
Luis
‎2021 May 20 3:53 AM
Thanks Luis for replying. I tried the suggested FM as well but I am getting an error 'File does not begin with %PDF' while trying to open it from spool
‎2021 May 20 4:04 AM
I am getting below in the PDF that is getting generated. It is same as what I am getting as output from 'SCMS_XSTRING_TO_BINARY'.

‎2021 May 20 7:15 AM
Please use the COMMENT button. The button ANSWER is reserved to give the solution.
‎2021 May 20 5:20 AM
Hi!
Let me see if get this straight. I might miss something...
‎2021 May 20 7:14 AM
I second Jörgen, you don't need spooling !! If you have the bytes of the PDF, then add the file to the sales order.
‎2021 Jul 24 5:20 PM
i want to convert Xstring to PDF file,could you tell me how to write Xstring to FDF file ,thanks .
‎2021 Jul 24 6:06 PM
Saying "convert xstring to ..." is the same as saying "convert bytes to ...", which doesn't mean a lot without the context, whatever the target is PDF or anything else. You must explain what the source bytes contain (XLSX file, etc. ?)