Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert xstring or binary data to PDF format Module pool programming SAP ABAP?

former_member396057
Participant
0 Kudos

Hi,

I am uploading the PDF file data in custom database table in xstring format.

I want to read xstring data and display in PDF format in presentation server/desktop through module pool programming. Here I am not using any smartform/script.

How to convert xstring data to PDF format ?

Regards,

Shabbir

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Are you

  • using filetype 'BIN' in the call of cl_gui_frontend_services=>gui_download
  • the first one trying to read and display those data (if yes, check how it was built and saved in database, are those actual pdf data?)
5 REPLIES 5

matt
Active Contributor
0 Kudos

If you're uploading a PDF then the xstring is already in PDF format.

0 Kudos

Thanks for the reply.

I have xstring format data in custom database table. I am reading the xstring data and then download using 'GUI_DOWNLOAD' on desktop. The pdf file is not opening, it is showing error " Adobe Reader could not open 'file1.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded ".

Regards,

Shabbir


matt
Active Contributor

As I understand it, you are uploading a PDF from somewhere and storing its binary representation in a database table. You are then downloading it, and now it doesn't open.

If that's the case, your data is getting corrupted in your process - the process itself should work, I've done it many times with different types of files. There are three points where corruption might happen.

1. On the upload

2. In the storing of the data in the database

3. On the download

Without further information - for example the relevant source code for each step (use the CODE button in the editor and right-click paste as plain text) - it's not possible to tell you a which point its going wrong..

raymond_giuseppi
Active Contributor
0 Kudos

Are you

  • using filetype 'BIN' in the call of cl_gui_frontend_services=>gui_download
  • the first one trying to read and display those data (if yes, check how it was built and saved in database, are those actual pdf data?)

roberto_vacca2
Active Contributor
0 Kudos

Hi.

Then you should use SCMS_XSTRING_BINARY to convert raw data in binary format.

To display pdf format, you can use cl_gui_html_viewer, load then show_data method, through a container.

Hope to help.

Bye