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: 

List to PDF

Former Member
0 Kudos

Hi all,

Is there any function module to convert ABAP list output to PDF?

Thanks,

Riyaz

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Riyaz,

SAP has provided a standard program , RSTXPDFT4, which you can use to convert any Spool request or ABAP Lists to a PDF File.

Also you can check

CONVERT_ABAPSPOOLJOB_2_PDF

convert abap spool output to PDF

CONVERT_OTF

Convert SAP documents (SAPScript) to other types.

Example:

CALL FUNCTION "CONVERT_OTF"

EXPORTING FORMAT = "PDF"

IMPORTING BIN_FILESIZE = FILE_LEN

TABLES OTF = OTFDATA

LINES = PDFDATA

EXCEPTIONS ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

OTHERS = 4.

CONVERT_OTFSPOOLJOB_2_PDF

converts a OTF spool to PDF (i.e. Sapscript document)

Regards,

Sameena

6 REPLIES 6

Former Member
0 Kudos

Hi Riyaz,

1. CONVERT_ABAPSPOOLJOB_2_PDF

regards,

amit m.

0 Kudos

try these..

CONVERT_ABAPSPOOLJOB_2_PDF

CONVERT_OTFSPOOLJOB_2_PDF

CONVERT_OTF_2_PDF

Check the below postings :

Former Member
0 Kudos

Hi Riyaz,

SAP has provided a standard program , RSTXPDFT4, which you can use to convert any Spool request or ABAP Lists to a PDF File.

Also you can check

CONVERT_ABAPSPOOLJOB_2_PDF

convert abap spool output to PDF

CONVERT_OTF

Convert SAP documents (SAPScript) to other types.

Example:

CALL FUNCTION "CONVERT_OTF"

EXPORTING FORMAT = "PDF"

IMPORTING BIN_FILESIZE = FILE_LEN

TABLES OTF = OTFDATA

LINES = PDFDATA

EXCEPTIONS ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

OTHERS = 4.

CONVERT_OTFSPOOLJOB_2_PDF

converts a OTF spool to PDF (i.e. Sapscript document)

Regards,

Sameena

Former Member
0 Kudos

hi riyaz,

check the below link...it has step by step procedure to do the conversion...

/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp

if usefull,mark the points,

regards,

padma.

Former Member
0 Kudos

Hai Riyaz

Try with the following code

REPORT Z_ABAPOUTPUT_PDF_SREE_13424 .

data: w_ident like tsp01-rqident,

w_doctype like tsp01-rqdoctype,

w_bytecount type i.

data: itab_pdf like tline occurs 0 with header line.

parameter spoolnum like tsp01-rqident obligatory.

selection-screen begin of block a2 with frame.

parameters: to_pc radiobutton group a2 default 'X',

pcfile like rlgrap-filename lower case,

to_unix radiobutton group a2,

unixfile(255) lower case.

selection-screen end of block a2.

********************************

at selection-screen on block a2.

********************************

if to_pc = 'X' and pcfile is initial.

message e398(00) with 'Enter PC File Name.'.

elseif to_unix = 'X' and unixfile is initial.

message e398(00) with 'Enter Unix File Name.'.

endif.

*******************************

at selection-screen on spoolnum.

*******************************

select single rqident rqdoctype

into (w_ident, w_doctype)

from tsp01

where rqident = spoolnum.

if sy-subrc ne 0.

message e398(00) with 'Spool' spoolnum 'not found'.

endif.

************************************************

at selection-screen on value-request for pcfile.

************************************************

call function 'WS_FILENAME_GET'

exporting

mask = ',.,..'

importing

filename = pcfile

exceptions

others = 1.

if sy-subrc <> 0.

message id sy-msgid type 'I' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

*******************

start-of-selection.

*******************

if w_doctype = 'LIST'.

perform get_abap_spool_in_pdf.

elseif w_doctype = 'OTF'.

perform get_otf_spool_in_pdf.

endif.

if to_pc = 'X'.

perform write_pdf_spool_to_pc.

else.

perform write_pdf_spool_to_unix.

endif.

message i398(00) with 'Completed OK'.

************************************************************************

form get_abap_spool_in_pdf.

refresh itab_pdf.

call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

exporting

src_spoolid = w_ident

importing

pdf_bytecount = w_bytecount

tables

pdf = itab_pdf

exceptions

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

others = 12.

if sy-subrc ne 0.

message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.

endif.

endform.

************************************************************************

form get_otf_spool_in_pdf.

refresh itab_pdf.

call function 'CONVERT_OTFSPOOLJOB_2_PDF'

exporting

src_spoolid = w_ident

importing

pdf_bytecount = w_bytecount

tables

pdf = itab_pdf

exceptions

err_no_otf_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_dstdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

others = 12.

if sy-subrc <> 0.

message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.

endif.

endform.

************************************************************************

form write_pdf_spool_to_unix.

open dataset unixfile for output in binary mode.

if sy-subrc ne 0 .

message e398(00) with 'Cannot open unix file for output:' unixfile.

endif.

loop at itab_pdf.

transfer itab_pdf to unixfile.

if sy-subrc ne 0 .

message e398(00) with 'Cannot write to unix file:' unixfile.

endif.

endloop.

close dataset unixfile.

endform.

************************************************************************

form write_pdf_spool_to_pc.

call function 'WS_DOWNLOAD'

exporting

bin_filesize = w_bytecount

filename = pcfile

filetype = 'BIN'

tables

data_tab = itab_pdf

exceptions

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

others = 10.

if sy-subrc <> 0.

message e398(00) with 'Cannot download to PC. Error =' sy-subrc.

endif.

endform.

Thanks & regards

Sreenivasulu P

Former Member
0 Kudos

HI

GOOD

CONVERT_ABAPSPOOLJOB_2_PDF Convert ABAP spool output to PDF

AND GO THROUGH THIS LINK

http://jnpassieux.chez-alice.fr/info/SAP_liste_fonctions.php

THANKS

MRUTYUN