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 to SAP Application Server

Former Member
0 Kudos

Hi,

I need to download the PDF file to SAP Application Server. Can any one please help me to Solve this Issue?

Thanks in Advance,

Kannan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Assuming the PDF file resides on the PC:


REPORT ztest.

DATA: BEGIN OF itab OCCURS 0,
        field(256),
      END   OF itab.
DATA: dsn(100) VALUE '/usr/sap/xfr/FIS/testpdf'.

CALL FUNCTION 'GUI_UPLOAD'
     EXPORTING
          filename   = 'c:temptest.pdf'
          filetype   = 'BIN'
     TABLES
          data_tab   = itab.

OPEN DATASET dsn FOR OUTPUT IN BINARY MODE.

LOOP AT itab.
  TRANSFER itab-field TO dsn.
ENDLOOP.

Rob

5 REPLIES 5

Former Member
0 Kudos

Assuming the PDF file resides on the PC:


REPORT ztest.

DATA: BEGIN OF itab OCCURS 0,
        field(256),
      END   OF itab.
DATA: dsn(100) VALUE '/usr/sap/xfr/FIS/testpdf'.

CALL FUNCTION 'GUI_UPLOAD'
     EXPORTING
          filename   = 'c:temptest.pdf'
          filetype   = 'BIN'
     TABLES
          data_tab   = itab.

OPEN DATASET dsn FOR OUTPUT IN BINARY MODE.

LOOP AT itab.
  TRANSFER itab-field TO dsn.
ENDLOOP.

Rob

0 Kudos

Hi Rob,

Thanks for your reply. I did what you have mentioned. But when i check the application server, The file looks like a .txt file. How do i know it is a PDF file? How do i verify it download in the PDF format at the Application Server? Please reply me.

Thanks in Advance,

Kannan

0 Kudos

You can read and upload the file to the PC:


report ztest.

data: begin of itab occurs 0,
        field(256),
      end   of itab.
data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
      length  like sy-tabix,
      lengthn like sy-tabix.

call function 'GUI_UPLOAD'
     exporting
          filename   = 'c:temptest.pdf'
          filetype   = 'BIN'
     importing
          filelength = length
     tables
          data_tab   = itab.

open dataset dsn for output in binary mode.

loop at itab.
  transfer itab-field to dsn.
endloop.

close dataset dsn.
clear   itab.
refresh itab.

open dataset dsn for input in binary mode.

do.
  read dataset dsn into itab-field.
  if sy-subrc = 0.
    append itab.
  else.
    exit.
  endif.
enddo.

call function 'GUI_DOWNLOAD'
     exporting
          filename     = 'c:temptestn.pdf'
          filetype     = 'BIN'
          bin_filesize = length
     importing
          filelength   = lengthn
     tables
          data_tab     = itab.

Rob

0 Kudos

Hi Rob,

Can you please help me in this issue.

I have to read the spool already in pdf format as it is created by adobe form

and write to application server in pdf format. Please guide me achieve this.

Thanks and Regards

Manu

Former Member
0 Kudos

Hello ,

I have PDF in binary format in my SAP system and not in PC. How can i upload it to application server?

Please put your valuable comments.

Regards,

Akriti