2008 Mar 06 3:54 AM
hi,
can any one tell me the Function Module which will converts the internal table to pdf format and stores in the pdf file into the application server.
Thanks in advance
2008 Mar 06 3:58 AM
2008 Mar 06 4:01 AM
2008 Mar 06 4:06 AM
Hi,
Choose a printer that will almost always exist or exist until you leave.
When opening the form set the following parameter on "tdgetotf".
When closing the form you will be able to get the data into an internal
table.
Function module "SX_OBJECT_CONVERT_OTF_PDF" will convert the internal table
into PDF format.
Use function module "WS_DOWNLOAD" to download document to presentation
server and function module "WS_EXECUTE" to view doc or
"application/pdf" to view mime object via the web.
and storing into appication server use this link:
http://abapcode.blogspot.com/2007/05/step-by-step-guide-for-using-lsmw-to.html
Hope this helps.
Cheers,
vasavi.
2008 Mar 06 4:11 AM
hi,
report output to pdf,
Re: how to display the data in PDF format
Posted: Jan 11, 2008 1:56 PM in response to: Maheedhar123 Ta... E-mail this message Reply
HI,
Line-Size of 220 characters shldnt be a problem.
Check the comments below:
DATA: pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
DATA: dest TYPE pri_params-pdest VALUE 'NHREMOTE'. ---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
Retreive local printer details*
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = dest
no_dialog = 'X'
immediately = ' '
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Set Spool printer details w.r.t local printer
pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = name
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
NEW-PAGE PRINT ON ---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
WRITE:/ 'Unable to create spool'.
ENDIF.
Output statements
WRITE:/ 'First Line'.
WRITE:/ 'Second Line'.
NEW-PAGE PRINT OFF. ---> Close spool
spono = sy-spono.
Convert ABAP Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spono
no_dialog = 'X'
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.
Download PDF contents to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test.pdf'
filetype = 'BIN'
TABLES
data_tab = i_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
example program to upload data to application server.
DATA ITAB LIKE LFA1 OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * FROM LFA1 INTO TABLE ITAB UP TO 20 ROWS.
END-OF-SELECTION.
OPEN DATASET 'ZSTEST' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
LOOP AT ITAB.
TRANSFER ITAB TO 'ZSTEST'.
ENDLOOP.
CLOSE DATASET 'ZSTEST'.
WRITE:/ 'File created..'.
ENDIF.
*reward if useful.