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: 

Download PDF file in background

Former Member
0 Kudos

I have a program that builds a PDF file and downloads it to a network drive using GUI_DOWNLOAD. GUI_DOWNLOAD does not work in background, so I tried OPEN DATASET, TRANSFER FILE, CLOSE DATASET. I get a dump because it can't translate the PDF file. I've tried it both in TEXT MODE and BINARY MODE.

Has anyone ever downloaded a PDF in background?

Thanks.

4 REPLIES 4

former_member182371
Active Contributor
0 Kudos

Hi,

There is a standard program (search for rspdf</b> sorry but i don´t remember the exact name) that converts a spool order into a pdf file, why not having a look?.

why not using a submit to this program?.

0 Kudos

Thanks, I am using that function it's called FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'. I need to download the PDF it creates to a network drive in the background.

0 Kudos

The code it the function you described uses FUNCTION 'DOWNLOAD', this function works just like 'GUI_DOWNLOAD' and creates a dump.

Former Member
0 Kudos

You can try this code but it might only support a download to a PC:

FUNCTION Z_DS_CREATE_LOCAL_PDF_FILE .
*"----------------------------------------------------------------------
*"*"Local interface:
*"  EXPORTING
*"     REFERENCE(AFILENAME) LIKE  RLGRAP-FILENAME
*"  TABLES
*"      OTF_LINES STRUCTURE  ITCOO
*"----------------------------------------------------------------------
  DATA: PDF_LINES
  LIKE TLINE OCCURS 1000 WITH HEADER LINE,
   ARCH LIKE TOA_DARA, NO_LINES TYPE I.

  CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
            FORMAT       = 'PDF'
       IMPORTING
            BIN_FILESIZE = NO_LINES
       TABLES
            OTF          = OTF_LINES
            LINES        = PDF_LINES.


  CALL FUNCTION 'DOWNLOAD'
       EXPORTING
            BIN_FILESIZE = NO_LINES
            FILENAME     = 'c:test.pdf'
            FILETYPE     = 'BIN'
       IMPORTING
            ACT_FILENAME = AFILENAME
       TABLES
            DATA_TAB     = PDF_LINES.