07-02-2007 9:52 AM
HI all
In selection screen one can select the fields from the list and then they are made to display in ALV. from there i need to download into PDF file.I am capturing spool id and doonloading into PDF file using one of the available function modules but when the records are more than 99 its throwing a popup that its more than the limit.please suggest what to do.please give the functinal modules to download to pdf.
07-02-2007 10:05 AM
Hi,
Plz have a look at the below code.
Declaration of local variables
DATA : lv_bytecount TYPE i,
lv_cancel(1) TYPE c,
lv_filename1 LIKE rlgrap-filename. "File name
Declaration of local constants
CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.
CONCATENATE c_c
sy-repid
lc_pdf
INTO lv_filename1.
Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = v_rqident
no_dialog = c_x
dst_device = v_print_parms-pdest
IMPORTING
pdf_bytecount = lv_bytecount
TABLES
pdf = i_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.
REFRESH : i_pdf.
ENDIF.
IF p_pdf IS NOT INITIAL.
To Download to PDF format
PERFORM download_w_ext(rstxpdft) TABLES i_pdf
USING lv_filename1
lc_pdf
'BIN'
lv_bytecount
lv_cancel.
ENDIF.
Regards,
Nagaraj
07-02-2007 9:59 AM
Hi
yes, You are right
99 columns is the Max limit to download/print the ALV Output
So take the spool ID of that ALV print and use the fun module to convert to PDF CONVERT_ABAPSPOOLJOB_2_PDF
Reward points for useful Answers
Regards
Anji
Message was edited by:
Anji Reddy Vangala
07-02-2007 10:05 AM
Hi,
Plz have a look at the below code.
Declaration of local variables
DATA : lv_bytecount TYPE i,
lv_cancel(1) TYPE c,
lv_filename1 LIKE rlgrap-filename. "File name
Declaration of local constants
CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.
CONCATENATE c_c
sy-repid
lc_pdf
INTO lv_filename1.
Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = v_rqident
no_dialog = c_x
dst_device = v_print_parms-pdest
IMPORTING
pdf_bytecount = lv_bytecount
TABLES
pdf = i_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.
REFRESH : i_pdf.
ENDIF.
IF p_pdf IS NOT INITIAL.
To Download to PDF format
PERFORM download_w_ext(rstxpdft) TABLES i_pdf
USING lv_filename1
lc_pdf
'BIN'
lv_bytecount
lv_cancel.
ENDIF.
Regards,
Nagaraj
07-02-2007 10:07 AM
Hi,
try with this function module....
<b>CONVERT_ABAPSPOOLJOB_2_PDF</b> convert abap spool output to PDF.
CONVERT_OTFSPOOLJOB_2_PDF converts a OTF spool to PDF (i.e. Sapscript document).
SX_OBJECT_CONVERT_OTF_PDF Conversion From OTF to PDF (SAPScript conversion).
<b>or try with this program.</b>
SAP has provided program <b>RSTXPDFT4</b> to convert spools to PDF file and download them on to local drives
regards,
Ashok reddy