Application Development and Automation 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: 
Read only

Converting Smartform in PDF - Background

Former Member
0 Likes
389

I want convert a Smartform, that contains pictures, to a PDF-File in the background (therefore I couldn’t use WS_DOWNLOAD). I need the result of the PDF-File in an internal table as ASCII-TEXT.

-


For the conversation of the OTF-Format in PDF I used the standard function "CONVERT_OTF".

The result of the function I saved to the applicatian server with the commands:

file = '/usr/transfer/tmp/test'.

OPEN DATASET file FOR OUTPUT in binary mode.

IF sy-subrc <> 0.

RAISING error_open_file.

ENDIF.

close file.

-


For getting the file as a text file I opened it in the text mode like:

DATA wa_s TYPE solisti1-line.

OPEN DATASET file FOR INPUT IN text MODE encoding default.

IF sy-subrc <> 0.

RAISING error_open_file.

ENDIF.

DO.

READ DATASET file INTO wa_s.

IF sy-subrc NE 0.

EXIT.

ENDIF.

MOVE wa_s TO out_pdf-line.

APPEND out_pdf.

ENDDO.

-


For testing the conversation I saved the content of the internal table "OUT_PDF" to the Windows Workstation as FILETYPE "ASC". But when i try to open the file I got an error like this: "XOBJECT "00007" was not found". The PDF-File shows only the text of the Smartform but the pictures are missing.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = 'C:\test.pdf'

filetype = 'ASC'

CHANGING

data_tab = out_pdf.

Thanks in advance for any help.

MP

1 REPLY 1
Read only

Former Member
0 Likes
280

You can't use download in background because you're on desktop and you can't be on your desktop in background.

I advise you to search for sample of code by searching PDF and OTF. There are many example for this problem.

Christophe