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 itab data into pdf

0 Kudos
269

i want to download my internal table data as PDF document without using any smartform or adobe form.So i don't want to use without those print parameters can i able to download the data into a pdf document.

4 REPLIES 4

ilachaudhary297
Participant
0 Kudos
111

Hi Shaik,

You can refer below link for converting data into pdf.

https://wiki.scn.sap.com/wiki/display/ABAP/PDF+files+in+SAP.

Thanks

0 Kudos
111

Thank you for your advice.

along with i am using below code:

*&---------------------------------------------------------------------*
*& Report ZPR_ITAB_2_PDF
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPR_ITAB_2_PDF.
TABLES: mara.

DATA: itab TYPE TABLE OF mara,
wa TYPE mara.

DATA:g_val TYPE c,
w_pripar TYPE pri_params,
w_arcpar TYPE arc_params,
i_pdf TYPE TABLE OF tline,
spoolid LIKE tsp01-rqident.


START-OF-SELECTION.

SELECT * FROM mara INTO TABLE itab
UP TO 100 ROWS.

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.

ENDIF.
********
loop at itab into wa. "-->Loop your internal table write here + include the content you want to add in the PDF

WRITE: wa-matnr,
wa-ernam,
wa-ersda.
*write: wa.
endloop.
*********
NEW-PAGE PRINT OFF.

CALL FUNCTION 'ABAP4_COMMIT_WORK'.
spoolid = sy-spono.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolid
no_dialog = ' '
TABLES
pdf = i_pdf.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\dell\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = i_pdf.

It is giving me error as :

Exception condition "ERR_NO_SPOOLJOB" triggered

Kindly suggest on this//

Florian
Active Contributor
0 Kudos
111

Make sure, there is a printer maintained in SU3 of the user, which running the report. It should work that way.

If this is not the rootcause, do a breakpoint at spoolid and check, if there is one provided. If not you have to investigate why it is that way.

~Florian

0 Kudos
111

Thanks for suggestion ..

But it is creating spool id now and file also downloading in local system but file is not opening.

Error am getting : cannot open the file and file doesn't have no pages.