08-22-2013 7:32 AM
I am converting ABAP Spool to PDF download and downloading the same into PDF. But the PDF output downlaoded is in A4 layout only and not in A3 even after creating a new destination device for A3
08-22-2013 8:38 AM
Hi Gautam Totekar,
Try like this
TYPES: BEGIN OF ty_pdf,
fld1(20) TYPE c,
fld2(20) TYPE c,
fld3(20) TYPE c,
END OF ty_pdf.
DATA : g_val TYPE c,
w_pripar TYPE pri_params,
w_arcpar TYPE arc_params,
spool_no LIKE tsp01-rqident,
it_pdf TYPE TABLE OF tline WITH HEADER LINE,
file_tab TYPE STANDARD TABLE OF solisti1,
bytecount TYPE i.
DATA: it_t001 TYPE TABLE OF t001.
DATA: wa_t001 TYPE t001.
DATA: it_FINAL TYPE TABLE OF ty_pdf.
DATA: wa_FINAL TYPE ty_pdf.
START-OF-SELECTION.
PERFORM get_data.
PERFORM print_data CHANGING spool_no.
PERFORM convert_spool_2_pdf.
PERFORM download_pdf_file.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
FORM get_data .
SELECT * INTO TABLE it_t001 FROM t001 up to 10 rows.
wa_final-fld1 = 'Field 1'.
wa_final-fld2 = 'Field 2'.
wa_final-fld3 = 'Field 3'.
APPEND wa_final TO it_final.
LOOP AT it_t001 INTO wa_t001.
wa_final-fld1 = wa_t001-bukrs.
wa_final-fld2 = wa_t001-butxt.
wa_final-fld3 = wa_t001-ort01.
APPEND wa_final TO it_final.
ENDLOOP.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form print_data
*&---------------------------------------------------------------------*
FORM print_data CHANGING spool_no.
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.
LOOP AT it_final into wa_final.
WRITE😕 wa_final.
ENDLOOP.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
ENDIF.
IF NOT sy-spono IS INITIAL.
spool_no = sy-spono.
ENDIF.
ENDFORM. " print_data
*&---------------------------------------------------------------------*
*& Form convert_spool_2_pdf
*&---------------------------------------------------------------------*
FORM convert_spool_2_pdf .
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spool_no
no_dialog = space
IMPORTING
pdf_bytecount = bytecount
TABLES
pdf = it_pdf.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = it_pdf
content_out = file_tab.
ENDFORM. " convert_spool_2_pdf
*&---------------------------------------------------------------------*
*& Form download_PDF_file
*&---------------------------------------------------------------------*
FORM download_pdf_file .
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = bytecount
filename = 'D:/test.pdf'
filetype = 'BIN'
CHANGING
data_tab = file_tab.
ENDFORM. " download_PDF_file
08-22-2013 8:08 AM
08-22-2013 8:13 AM
08-22-2013 8:19 AM
Hi,
Ask your Basis consultant (or) you can also check in Transaction SPAD
what is the default set for out put basically it is A4 .. there you
change it to A3 format.
Regards
Khaleel
08-22-2013 8:23 AM
Hi,
Try to change the Page format used in smartforms to A3 width and height.
08-22-2013 8:25 AM
Hi Gautam,
The new destination device and printer should have DEFAULT page format as A3.
Regards
08-22-2013 2:57 PM
where to providethese settings to the new destination device and printer ? the basis have provided one device. But I doubt its configuration. I checked SPAD.. I could see page format in tray selection .. could nto find default settings
08-23-2013 6:36 AM
In SPAD got to outpu devices of the ouput type you are using in print parameters
Check the "Tray Info" tab here you can specify hardcoded DINA3 and use this only for your case.
Regards
08-22-2013 8:38 AM
Hi Gautam Totekar,
Try like this
TYPES: BEGIN OF ty_pdf,
fld1(20) TYPE c,
fld2(20) TYPE c,
fld3(20) TYPE c,
END OF ty_pdf.
DATA : g_val TYPE c,
w_pripar TYPE pri_params,
w_arcpar TYPE arc_params,
spool_no LIKE tsp01-rqident,
it_pdf TYPE TABLE OF tline WITH HEADER LINE,
file_tab TYPE STANDARD TABLE OF solisti1,
bytecount TYPE i.
DATA: it_t001 TYPE TABLE OF t001.
DATA: wa_t001 TYPE t001.
DATA: it_FINAL TYPE TABLE OF ty_pdf.
DATA: wa_FINAL TYPE ty_pdf.
START-OF-SELECTION.
PERFORM get_data.
PERFORM print_data CHANGING spool_no.
PERFORM convert_spool_2_pdf.
PERFORM download_pdf_file.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
FORM get_data .
SELECT * INTO TABLE it_t001 FROM t001 up to 10 rows.
wa_final-fld1 = 'Field 1'.
wa_final-fld2 = 'Field 2'.
wa_final-fld3 = 'Field 3'.
APPEND wa_final TO it_final.
LOOP AT it_t001 INTO wa_t001.
wa_final-fld1 = wa_t001-bukrs.
wa_final-fld2 = wa_t001-butxt.
wa_final-fld3 = wa_t001-ort01.
APPEND wa_final TO it_final.
ENDLOOP.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form print_data
*&---------------------------------------------------------------------*
FORM print_data CHANGING spool_no.
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.
LOOP AT it_final into wa_final.
WRITE😕 wa_final.
ENDLOOP.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
ENDIF.
IF NOT sy-spono IS INITIAL.
spool_no = sy-spono.
ENDIF.
ENDFORM. " print_data
*&---------------------------------------------------------------------*
*& Form convert_spool_2_pdf
*&---------------------------------------------------------------------*
FORM convert_spool_2_pdf .
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spool_no
no_dialog = space
IMPORTING
pdf_bytecount = bytecount
TABLES
pdf = it_pdf.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = it_pdf
content_out = file_tab.
ENDFORM. " convert_spool_2_pdf
*&---------------------------------------------------------------------*
*& Form download_PDF_file
*&---------------------------------------------------------------------*
FORM download_pdf_file .
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = bytecount
filename = 'D:/test.pdf'
filetype = 'BIN'
CHANGING
data_tab = file_tab.
ENDFORM. " download_PDF_file
08-22-2013 9:03 AM
we tried with a new printer configured as A3 layout default but still the contents are not readable. and fonts are very small
08-22-2013 9:16 AM
Hi Gautam Totekar,
See this link for solution http://scn.sap.com/thread/1675947
08-22-2013 9:24 AM
what is the original size? Lets say, if its a SF, is it designed to fit A4 page and not A3 page? If yes, then you will have to first make it fit for A3 size display, manually. And then you will have proper A3 print.
Regards,
KS
08-22-2013 9:37 AM
It is a normal list output of report..
On a nutton. I am printing the same output to spool.
using Get_print_parameters,
CONVERT_ABAPSPOOLJOB_2_PDF
and downloading
08-22-2013 9:42 AM
Hi Gautam Totkar,
Develop smartform and convert it to PDF your requirement will fulfill.
See this link to know how to download smartform as PDF
http://wiki.sdn.sap.com/wiki/display/Snippets/Convert+Smartform+to+PDF+format
08-22-2013 10:52 AM
We have 4-5 reports with similar problem
X_65_255 gives proper output with all teh columns but the font sieze is not readable which is why we are moving to layout A3.
We cannot convert it to smartform output currently
08-22-2013 10:58 AM
Hi Gautam,
Have a look for generic A3 Printing with issue similar to yours.
How can I print A3 format in SAP
Regards
08-22-2013 11:10 AM
Hi,
Since it is a normal report its printing format will completely depend on it SPAD settings:
This link explains:
http://www.saptechies.org/how-can-i-print-a3-format-in-sap/
Regards,
KS
08-26-2013 10:05 AM
As suugested we created a new page format Z_A3 and mentioned DINA3 and lines 65 columns 255 for it.
And maintained the same against the printer under Tray.
But although sp01 shows complete output the PDF generated with following FM is blank
GET_PRINT_PARAMETERS
***Write list and generate spool***
CONVERT_ABAPSPOOLJOB_2_PDF
GUI_DOWNLOAD
08-26-2013 11:56 AM
08-26-2013 12:49 PM
No the device type I am using is HPLJIIID:HP lserjet 3 series PCL5.
As I am generating a spool number first and then sending it to download using FMs
CONVERT_ABAPSPOOLJOB_2_PDF
GUI_DOWNLOAD.
PDF1 is used for automatic conversion of spool to PDF i feel.
Creating a device of this type will it help ?
because we have a device of this type used it as well.
08-26-2013 1:30 PM
Then for this kind of print use the existing device with device type "PDF1" and check.
08-26-2013 1:41 PM
you would also need to first set output width and size manually.
check:
http://wiki.sdn.sap.com/wiki/display/ABAP/PDF+Download+By+Creating+Spool+Request
From this link, check this piece of code:
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
and then call CONVERT_ABAPSPOOLJOB_2_PDF, as shown there.
BR,
KS
08-28-2013 6:44 AM
08-28-2013 9:12 AM
yes..Thanks for your inputs.
printed using PDFP.
08-28-2013 9:16 AM
08-28-2013 9:06 AM
HI,
GO TO TCODE SPAD
CLICK ON FULL ADMIN. BUTTON
CHOOSE THE TAB <DEVICE TYPES>
THERE YOU CLICK ON <DISPLAY> BUTTON AGAINST - PAGE FORMATS
CREATE A NEW PAGE FORMAT OF YOUR INTEREST
AND THEN ASSIGN IT TO A DEVICE TYPE .