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

Upload a file into the application layer without using presentation layer!

Former Member
0 Likes
792

Hi all,

I'm trying to create a pdf from a classical report (which is done successfully). Now i need to upload the pdf into the application layer.

What i've done in the below program is... generate a simple classical report and using the spool id, i've generated a pdf and downloaded it into the presentation layer using GUI_DOWNLOAD.

Objective : I want this output PDF file in my application layer (without making any copy in the presentation layer for some security reasons) ..... Plz help me out with this.

DATA:g_val     TYPE c. 
DATA:w_pripar  TYPE pri_params. 
DATA:w_arcpar  TYPE arc_params. 
DATA:spool_no  LIKE tsp01-rqident. 
DATA:it_pdf    TYPE TABLE OF tline WITH HEADER LINE. 
DATA:wa_pdf    LIKE LINE OF it_pdf. 
 
START-OF-SELECTION. 
 
CALL FUNCTION 'GET_PRINT_PARAMETERS' 
EXPORTING 
  in_archive_parameters  = w_arcpar 
  in_parameters          = w_pripar 
  layout                 = 'X_65_132' 
  line_count             = 65 
  line_size              = 132 
  no_dialog              = 'X' 
IMPORTING 
  out_archive_parameters = w_arcpar 
  out_parameters         = w_pripar 
  valid                  = g_val. 
IF g_val  NE space AND sy-subrc = 0. 
w_pripar-prrel = space. 
w_pripar-primm = space. 
NEW-PAGE PRINT ON NEW-SECTION PARAMETERS w_pripar ARCHIVE PARAMETERS w_arcpar NO DIALOG. 
"Output which is gone to spool 
WRITE:/ 'Output in spool to create zip file 1'. 
WRITE:/ 'Output in spool to create zip file 2'. 
WRITE:/ 'Output in spool to create zip file 3'. 
WRITE:/ 'Output in spool to create zip file 4'. 
NEW-PAGE PRINT OFF. 
CALL FUNCTION 'ABAP4_COMMIT_WORK'. 
ENDIF. 
IF NOT sy-spono IS INITIAL. 
"Declarations 
spool_no = sy-spono. 
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' 
  EXPORTING 
    src_spoolid   = spool_no 
    no_dialog     = space 
  TABLES 
    pdf           = it_pdf. 
"Save the file 
CALL FUNCTION 'GUI_DOWNLOAD' 
  EXPORTING 
    filename     = 'C:\rep_output_pdf.pdf' 
    filetype     = 'BIN' 
  TABLES 
    data_tab     = it_pdf. 
ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
479

Hi,

You can download the data onto the application server using:

1. OPEN DATASET <FILE NAME> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

2. LOOP AT IT_PDF INTO WA_PDF.

TRANSFER WA_PDF TO <FILE NAME>.

ENDLOOP.

3. CLOSE DATASET <FILE NAME>.

Read only

Former Member
0 Likes
479

Please search.

there is no need of going for GUI_DOWNLOAD.

SEARCH tags like OPEN DATASET, or UPLOAD TO APPLICATION SERVER . you will get your answer..