2005 Jul 12 3:45 PM
Hi all,
When I developed smartform I kept particular printer in mind. Now since the client wants to print it on diffrenet printers, the allignment is going to change.
I came to know about a function called, CONVERT_OTFSPOOLJOB_2_PDF which will convert the spool jobs in pdf file. Now my question is how do I implement this function in smartforms so that whenever it goes for print through spool it will get conveterted in pdf format so that allignmnet willot change whatever may be the printer ?
2005 Jul 12 3:56 PM
Hi,
in the smartforom interface
I_SSFCTRLOP-getotf = 'X'.
FORM SAVE_TO_PDF TABLES ZOFTDATA STRUCTURE ITCOO.
data:
ZPDF LIKE TLINE OCCURS 100 WITH HEADER LINE,
NUMBYTES TYPE I.
call function 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = NUMBYTES
TABLES
OTF = ZOFTDATA
LINES = ZPDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = NUMBYTES
FILENAME = FILEPDF
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = FILEPDF
FILESIZE = NUMBYTES
TABLES
DATA_TAB = ZPDF
EXCEPTIONS
OTHERS = 9.
endform.
2005 Jul 13 8:01 AM
HI Svetlin Rusev,
Myself also want to convert form to PDF file. based on your coding, i defined the subroutine save_to_pdf in form routine area in gobal definition. my question is where should i call the subroutine and how to pass the parameter zotfdata. pls explain in detail . very urgent.
with thanks,
senthil.
2005 Jul 13 8:25 AM
Hi,
When calling FM CALL FUNCTION sfm_name (smartform call), there is an export parameter(importing) JOB_OUTPUT_INFO of type ssfcrescl.
zotfdata = ssfcrescl-OTFDATA
The subroutine is called after closing the smartform.
But additinally need to pass to FM CALL FUNCTION sfm_name an import parameter(exporting) CONTROL_PARAMETERS type SSFCTRLOP.
SSFCTRLOP-getotf = 'X'. - to get ssfcrescl-OTFDATA
SSFCTRLOP-no_dialog = 'X'. - if you don't need a dialog
Svetlin
2005 Jul 13 10:30 AM
2005 Jul 28 7:43 AM
2005 Jul 28 7:59 AM
Here is a sample code.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/tutorial with code sample on smart forms.pdf
2005 Jul 28 12:21 PM
i had used this code in my code. but its not working. again i had created a new form for testing the given code. it is also not working. when i debug the code i found that the table is been passing but the filesize is not retrieved there in the conver_otf func. may be because of this the func. is not getting the data in pdf file. do u any idea where the error may have occured.
2005 Jul 28 12:31 PM
Hi,
I use this code
FORM SAVE_TO_PDF TABLES ZOFTDATA STRUCTURE ITCOO.
data:
ZPDF LIKE TLINE OCCURS 100 WITH HEADER LINE,
NUMBYTES TYPE I.
call function 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = NUMBYTES
TABLES
OTF = ZOFTDATA
LINES = ZPDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = NUMBYTES
FILENAME = FILEPDF
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = FILEPDF
FILESIZE = NUMBYTES
TABLES
DATA_TAB = ZPDF
EXCEPTIONS
OTHERS = 9.
endform.
Be sure that table ZOFTDATA is not empty.
2005 Jul 28 1:00 PM
hi
but whr u had used the perform stmt. in the print prg.
2005 Jul 28 1:05 PM
Usually it should be atfer "CALL FUNCTION fm_name" stmt.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = I_SSFCTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = I_ssfcompop
USER_SETTINGS = 'X'
S_BKPF = S_BKPF
S_FWBAS = S_FWBAS
S_FWSTE = S_FWSTE
S_FWTOT = S_FWTOT
S_WORDS = S_WORDS
S_PAYM = S_PAYM
V_BSEG = S_BSEG
P_TYPE = copy
I_USER = PUNAME
IMPORTING
DOCUMENT_OUTPUT_INFO =
<b>JOB_OUTPUT_INFO = E_ssfcrescl</b>
JOB_OUTPUT_OPTIONS =
TABLES
T_BSEG = T_BSEG
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.