on 04-29-2009 8:05 AM
HI Friends,
i am using the invoice print program. the following code generate the popup for print (spool number) and and the data goes to the printer.
now here i want PDF(not print) is there any option?
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = i_itcpp
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
Hi,
refer to the following code:
TABLES:likp,itcpo.
Internal table and variable Declaration
Data: gi_otf TYPE STANDARD TABLE OF itcoo,
gi_line TYPE TABLE OF tline,
bin_file TYPE i.
itcpo-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
dialog = 'X'
form = 'YSCRIPT'
language = sy-langu
OPTIONS = itcpo
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
codepage = 11
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Then use start form,write form and end form.
CALL FUNCTION 'CLOSE_FORM'
TABLES
otfdata = gi_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Convert data to PDF format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = bin_file
used in GUI_DOWNLOAD
TABLES
otf = gi_otf
lines = gi_line
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope it helps.
Regards
Rajesh Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
DATA: g_t_otfdata TYPE STANDARD TABLE OF itcoo WITH HEADER LINE,
CALL FUNCTION 'CLOSE_FORM'
Tables
OTFDATA = g_t_otfdata[]
EXCEPTIONS
OTHERS = 1.
Now, call the below FM to display the output in PDF.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = g_t_otfdata[]
EXCEPTIONS
acrobat_not_registered = 1
convert_otf_to_pdf_error = 2
download_error = 3
acrobat_not_started = 4
cntl_error = 5
OTHERS = 6.
Hope it helps
Rgds,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.