Smart form conversion in PDF
Hi Guys,
I have one query in the smartforms, I can able to convert the smartform to PDF and saving the PDF in my DESKTOP directly with showing the POP_UP, when i choose the print preview in the POP-UP screen.
*My Requirement is : I need to display the PDF details first and later i will chose the save option, Could you add your comments.
As of now i am using below code the PDF saving in the DESKTOP, Could any ple add your suggestion how to show the PDF with out saving the PDF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = LOC_PDF_LEN
TABLES
OTF = INT_OTF
LINES = IT_LINES
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.
To display File SAVE dialog window
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
CHANGING
FILENAME = LOC_FILE_NAME
PATH = LOC_FILE_PATH
FULLPATH = LOC_FULL_PATH
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = LOC_PDF_LEN
FILENAME = LOC_FULL_PATH
FILETYPE = 'BIN'
TABLES
DATA_TAB = IT_LINES
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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hi
If you mean to see the pdf file before saving it, it's possible to see the print of the sf only.
If you mean to open the pdf file after saving it:
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
URL = LOC_FILE_NAME
EXCEPTIONS
FRONTEND_NOT_SUPPORTED = 1
FRONTEND_ERROR = 2
PROG_NOT_FOUND = 3
NO_BATCH = 4
UNSPECIFIED_ERROR = 5
OTHERS = 6.
Max
Similar Messages
-
To convert Smart Form output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Smart Forms output to PDF format and send it via email to customer. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnRefer the links -
how to convert smartform into pdf and send through mail
Smartform as PDF attachment to a mail.
smartform pdf and mail
smartform to pdf to mail
Regrads,
Amit
Reward all helpful replies. -
Sandard Smart Form output into PDF format.
Hi to all,
Any one please guide me, how to convert sandard Smart Form output into PDF format.
Regards,
Thaneshhi thanesh,
the below code may help you.
data: FM_NAME TYPE RS38L_FNAM.
DATA: W_BIN_FILESIZE TYPE I,
T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
T_PDF_TAB TYPE TLINE OCCURS 0 WITH HEADER LINE,
W_FILESIZE TYPE I,
WA_CTRLOP TYPE SSFCTRLOP,
WA_OUTOPT TYPE SSFCOMPOP,
T_OTFDATA TYPE SSFCRESCL.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = <ur form name>
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
WA_CTRLOP-GETOTF = 'X'.
WA_CTRLOP-NO_DIALOG = 'X'.
WA_OUTOPT-TDNOPREV = 'X'.
call function <function module generated for ur form>
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = WA_CTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = WA_OUTOPT
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_OTFDATA
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
T_OTF[] = T_OTFDATA-OTFDATA[].
call function 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
BIN_FILE =
tables
OTF = T_OTF
LINES = T_PDF_TAB
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.
call function 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
CODEPAGE = ' '
FILENAME = 'D:\TEST11.PDF'
FILETYPE = 'BIN'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = W_FILESIZE
tables
data_tab = T_PDF_TAB
FIELDNAMES =
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
NO_AUTHORITY = 10
OTHERS = 11
if sy-subrc = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
WRITE: / 'SUCCESSFULLY CONVERTED'.
endif. -
Hello All ,
I have created one smart form and provided option to download the same in PDF. My Problem is that is downloaded in PDF but at the same time my end user want to see the print preview and take the print from there itself also.
I am using the following code can some one suggest me the what need to do the change after both option will work at the same time.
Please Note I have also made the use of property
SSFCOMPOP-TDNOPREV
But after this also issue not resolve. Some one Please suggest me the how to resolve the issue.
DATA :
WA_FMNM TYPE TDSFNAME, " Smart Forms: Form Name
WA_CNTL TYPE SSFCTRLOP, " FOR PDF PRINT
WA_POP TYPE SSFCOMPOP, " printer name
T_OTF_FROM_FM TYPE SSFCRESCL,
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE,
T_OTF TYPE SSFCRESCL-OTFDATA,
W_BIN_FILESIZE TYPE I, " BINARY FILE SIZE
W_FILE_NAME TYPE STRING,
WA_FNMD TYPE RS38L_FNAM. " Name of Function Module
DATA:
W_FORM_NAME TYPE TDSFNAME,
W_FMODULE TYPE RS38L_FNAM,
W_CPARAM TYPE SSFCTRLOP,
W_OUTOPTIONS TYPE SSFCOMPOP,
W_FILE_PATH TYPE STRING,
W_FULL_PATH TYPE STRING.
SMART FORM FUNCTION MODULE
WA_FMNM = TEXT-113.
W_FORM_NAME = TEXT-113.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = WA_FMNM
IMPORTING
FM_NAME = WA_FNMD
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END FORM
WA_CNTL-GETOTF = 'X'.
WA_CNTL-NO_DIALOG = 'X'.
WA_CNTL-PREVIEW = SPACE .
WA_POP-TDDEST = 'LP01'.
CALL FUNCTION WA_FNMD
EXPORTING
CONTROL_PARAMETERS = WA_CNTL
OUTPUT_OPTIONS = WA_POP
V_APPLN_OB = V_APPLN_OB
V_KUNNR_OB = V_KUNNR_OB
V_EBELN = V_EBELN
V_CAT_NAME = V_CAT_NAME
V_VAR_NAME = V_VAR_NAME
IMPORTING
JOB_OUTPUT_INFO = T_OTF_FROM_FM
TABLES
T_ZCNC18 = T_ZCNC18
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
T_OTF[] = T_OTF_FROM_FM-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
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.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = W_FILE_NAME
PATH = W_FILE_PATH
FULLPATH = W_FULL_PATH
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = W_FULL_PATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ''
HEADER = '00'
TRUNC_TRAILING_BLANKS = ''
WRITE_LF = 'X'
COL_SELECT = ''
COL_SELECT_MASK = ''
DAT_MODE = ''
CONFIRM_OVERWRITE = ''
NO_AUTH_CHECK = ''
CODEPAGE = ''
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ''
TRUNC_TRAILING_BLANKS_EOL = 'X'
TABLES
DATA_TAB = T_PDF_TAB
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 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Swati NamdevHi Swati,
Pls refer the below code:
TABLES: ekko.
DATA: int_itab TYPE TABLE OF ekko WITH HEADER LINE.
DATA: wf_name TYPE rs38l_fnam.
DATA: wf_so1.
*For PDf Conversions
DATA: int_tab_otf_data TYPE ssfcrescl,
int_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
int_tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
file_name TYPE string,
file_path TYPE string,
full_path TYPE string,
cparam TYPE ssfctrlop,
outop TYPE ssfcompop.
**Preview not allowed.
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = ' '.
cparam-getotf = 'X'.
GET PARAMETER ID 'EBLEN' FIELD wf_so1.
SELECT mandt ebeln bukrs bsart ernam ekorg bedat FROM ekko INTO TABLE
int_itab WHERE ebeln = wf_so1.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SMARTFORM_FINAL2'
IMPORTING
fm_name = wf_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION wf_name
EXPORTING
control_parameters = cparam
output_options = outop
user_settings = space
IMPORTING
job_output_info = int_tab_otf_data
TABLES
int_itab = int_itab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
int_tab_otf_final[] = int_tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = bin_filesize
TABLES
otf = int_tab_otf_final
lines = int_pdf_tab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = file_name
path = file_path
fullpath = full_path.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = full_path
filetype = 'BIN'
IMPORTING
filelength = file_size
TABLES
data_tab = int_pdf_tab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Ramneet Ahuja -
Converting smart forms as a pdf in different languages
Hi Experts,
I have been created a smart form and later on i converted it to in pdf also, but how can i convert a smart form output into different languages (English(defualt), German, Italian, French, Spanish,). Can anyone tell me about the idea behind this or a simple demo program???????????
do i need to maintain each text on the smart form into these languages already through SE63 or somewhere any idea that can help me without translating the whole text into those languages, could be able to do pdf conversion.
Thanks and Regards,
ShakunThe OTF data needs to already be in the target language - the conversion process is a process of changing the document format only, not a translation tool.
-
Smart Form convert to Pdf and send to email
hi,
ive dev the smart for me21n. its working fine. Standard programme is SAPLMEGUI.
now new requirement is , convert the smart form to pdf and then sending the pdf through email to customer.
Can any plz tell me is there any stadard programme or else need to custmise the print programme?
RegardsKirans belong to convert the smart form to pdf.
there is standard programme RSTXPDFT4
but after convert the form to pdf. i need to send it thorough mail.
iam checking other link one which is send by mr.naresh..
thank you
Regards -
Smart forms convert to pdf binary data
Dear All,
I'm working on smart forms integrations with .net and I need to send the smart forms PDF binary data though custom rfc .
For that i'm converting smart forms otf data to pdf in and pass this data through rfc but this idata is is not wokring on .net guys when they are converting this on pdf..
so is there any need of decoded smart forms otf data before passing through or i'm missing some basic step?
Please guide me?
Rg
Anujhi,
Have a look on this wiki:
[http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformoutputtoPDFformat]
And maybe this one could also interest you:
[|http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment]
regards
mickael -
Regading smart form printpreview to pdf
<<Do not post duplicate questions. >>
i have one smart created with one custem page format . 400 * 1100 . that smart form attached to vfo3 transcation .
when iam seeing printpreviw is ok . but when iam converting this print preview to pdf . the last data missing in page .
but in print preview half page only . but not getting full data .
any one suggest me .
Edited by: Matt on Jul 20, 2010 2:05 PMhi ,
your check with window size and Alignments
Regards,
Ansari -
How To Get The Smart Form Into The PDF File
Hello Friends,
Can Any One Tell How To Get Smart Form in PDF.
I used this RSTXPDFT4 Program.
It is asking The Spool Number.
How to get the Spool Number.the steps are
SmartForms Output to PDF
There is a way to download smartform in PDF format.
Please do the following:
1. Print the smartform to the spool.
2. Note the spool number.
3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the
noted spool number.
how to get spool number
The simplest method is to read the spool table directly, table TSP01
example code
REPORT zsuresh_test.
* Variable declarations
DATA:
w_form_name TYPE tdsfname VALUE 'ZSURESH_TEST',
w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
W_bin_filesize TYPE i, " Binary File Size
w_FILE_NAME type string,
w_File_path type string,
w_FULL_PATH type string.
* Internal tables declaration
* Internal table to hold the OTF data
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
* Internal table to hold OTF data recd from the SMARTFORM
t_otf_from_fm TYPE ssfcrescl,
* Internal table to hold the data from the FM CONVERT_OTF
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
* This function module call is used to retrieve the name of the Function
* module generated when the SMARTFORM is activated
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_form_name
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = w_fmodule
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Calling the SMARTFORM using the function module retrieved above
* GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
* format of the output
w_cparam-no_dialog = 'X'.
w_cparam-preview = space. " Suppressing the dialog box
" for print preview
w_cparam-getotf = 'X'.
* Printer name to be used is provided in the export parameter
* OUTPUT_OPTIONS
w_outoptions-tddest = 'LP01'.
CALL FUNCTION w_fmodule
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = w_cparam
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = w_outoptions
* USER_SETTINGS = 'X'
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
* JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
t_otf[] = t_otf_from_fm-otfdata[].
* Function Module CONVERT_OTF is used to convert the OTF format to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
* BIN_FILE =
TABLES
otf = T_OTF
lines = T_pdf_tab
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.
* To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILE_NAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* WITH_ENCODING =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
* presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
FILETYPE = 'BIN'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = T_pdf_tab
* FIELDNAMES =
* 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
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Do reward if helpful
Edited by: sharad narayan on Apr 4, 2008 2:14 PM
Edited by: sharad narayan on Apr 4, 2008 2:18 PM -
Physical Inventory Sap script to Smart Form conversion
Hi to all experts,
there is standard print program RM07IDRU (tcode mi21) .This print is assigned to customized sapscript (zmm_phys_inv) for printing . Now the problem is that we have print barcode using this script on a different printer .For scripts the bar code printing takes a lot of effort .The users want the sap script to be converted to smart forms . what is the best approach for this............................need u r feedbacksHi Mohammed
The users want the sap script to be converted to smart forms . what is the best approach for this
For this refer the similar kind of thread.
how to convert sap script layout into smartforms?
regards
s@chin -
Smart form: Spool to PDF Conversion more than 100 pages.
Hi folks,
I have an issue with Function Module (FM) CONVERT_ABAPSPOOLJOB_2_PDF when the report to be converted has more than 100 pages.....i have explained this scenario as below
We have been using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert ABAP report to PDF file and then send this via mail using FM SO_DOCUMENT_SEND_API1.....
PDF conversion using FM CONVERT_ABAPSPOOLJOB_2_PDF works well if the number of report pages is less than 100....i.e the table pdf of the FM will contain the output as expected.....
If the report has more than 100 pages, the the FM CONVERT_ABAPSPOOLJOB_2_PDF will schedule the conversion job as a background job and returns with a SY-subrc eq 0 and the table parameter pdf will ne empty.
Could you suggest me a woorkaround in this situtaion...i.e how do I then get the output of the background job
And any process to convert Spool to PDF if having more than 100 pages.
Thanks in Advance............Pb,
If the report has more than 100 pages, the the FM CONVERT_ABAPSPOOLJOB_2_PDF will schedule the conversion job as a background job and returns with a SY-subrc eq 0 and the table parameter pdf will ne empty
i would suggest you to if pages are more than 100 than you need to send report output to sp01 with spool request number by using fm job_open..job_close..
than from sp01 you can convert pdf by running RSTXPDFT4 in se38.
hope this would solve your problem.
Amit. -
what are procedure shld follow to download a smartform into pdf.
i am calling directly smartform from the generated function by passing final table .go through this link, this might help you to guide about the complete process
http://help.sap.com/saphelp_nw2004s/helpdata/en/c8/4adf7ba13c4ac1b4600d4df15f8b84/frameset.htm
http://sap.ittoolbox.com/documents/popular-q-and-a/displaying-a-pdf-file-in-place-2797
Re: Smartform to PDF
Posted: Oct 10, 2006 12:37 PM in response to: Rama krishna S Reply E-mail this post
Hi,
Check this link...
http://sap4.com/wiki/index.php?title=Genera_PDF_a_partir_de_Smartforms
Please go through this link , hope you will get useful stuff from this.
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450
*& Form f9100_save_to_pdf
text
-->P_WS_FORMNAME text
FORM f9100_save_to_pdf using value(ws_formname).
data: i_lines TYPE tline OCCURS 0 WITH HEADER LINE.
data: ws_bin_size type i,
ws_filename type string.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = ws_bin_size
TABLES
otf = i_otf
lines = i_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
flg_exit = 'X'.
MESSAGE i050 WITH 'Error converting to PDF format'.
EXIT.
ENDIF.
Get the download path
PERFORM get_download_path CHANGING ws_filename.
if flg_exit = 'X'.
EXIT.
endif.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = ws_bin_size
filename = ws_filename
filetype = 'BIN'
TABLES
data_tab = i_lines
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.
IF sy-subrc <> 0.
MESSAGE i050 WITH 'Error while File download'.
flg_exit = 'X'.
EXIT.
ELSE.
MESSAGE i050 WITH 'File downloaded successfully '.
flg_exit = 'X'.
EXIT.
ENDIF.
Refer the following link for more details:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Please Refer this,
https://forums.sdn.sap.com/click.jspa?searchID=5369529&messageID=3814804
rEGARDS
VASU -
Form conversion to PDF with Chinese characters
Hello.
I have a Sap script form and it has Chinese characters in the title and footer. It is converted to PDF then send it to email, at transaction SOST. The Chinese characters was replaced by '#'.
Our basis tried to install the device driver for PDF stated in sap note 999712, but still it didn't correct the form's output in the PDF file. The form is in ZH and the font used in the form is CNSONG. The transactions was also executed during ZH logon. Would anybody know a solution to this?
Thanks in advance!Doray,
For printing in PDF other than english characters we have to create new font .
Go to SE73 and create new font family Named ZCOUR_I6 and then execute the report RSTXPDF2 where in select the optin for activity to be performed as READ and SAVE the font file.
From control panel for to fonts and copy the COURIER NEW (TrueTYpe) font on to ur desktop .
Upload the the same font file using RSTXPDF2 by specifying it in the file name.
Then try to execute the tcode which u r usingh for converting the output to PDF and check whether the desired output has been converted.
Hope things are little clear for you.
Regards.. -
Smart Form as PDF within iframe
Hi all,
the problem i'm facing today is that i can't display a SMART FORM as a PDF in an <iframe> Tag.
If i call a simple PDF (which is stored on my PC as a local file) everything works fine and the PDF is
shown within the iframe Tag.
<html>
<head>
</head>
<body>
Test<p>
<iframe src="C:Test.pdf" width="90%" height="400" name="test"></iframe>
</body>
</html>
If i try to do the same with my test BSP the PDF is not shown within iframe Tag. Instead the iframe Tag
stays empty and the PDF is called directly by the Adobe Reader and not by my Browser (IE7).
<html>
<head>
</head>
<body>
Test<p>
<iframe src="https://vsapex2ci.daksap.de:44320/sap/bc/bsp/sap/zpdf_test/test.htm"
width="90%" height="400" name="test"></iframe>
</body>
</html>
On my test.htm only OnInitialization is implemented. Here's the Code:
DATA: lv_pdf TYPE xstring,
ls_output_data TYPE ssfcrescl,
ls_ctrl_param TYPE ssfctrlop,
lv_fm_name TYPE rs38l_fnam,
lt_lines TYPE TABLE OF tline,
lv_pdf_len TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTESTPDF'
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
ls_ctrl_param-no_dialog = 'X'.
ls_ctrl_param-getotf = 'X'.
CALL FUNCTION lv_fm_name
EXPORTING
CONTROL_PARAMETERS = ls_ctrl_param
USER_SETTINGS = space
IMPORTING
JOB_OUTPUT_INFO = ls_output_data
* Conversion of output format OTF into PDF format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_pdf_len
bin_file = lv_pdf
TABLES
otf = ls_output_data-otfdata
lines = lt_lines.
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field( name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field( name = 'content-disposition'
value = 'attachment; filename=test.pdf' ).
lv_pdf_len = XSTRLEN( lv_pdf ).
response->set_data( data = lv_pdf
length = lv_pdf_len ).
navigation->response_complete( ).
How can i display my generated PDF (SMART FORM) within an iframe Tag?
Regards
Mark-Andréhere is the code
data: cached_response type ref to if_http_response.
create object cached_response type cl_http_response exporting add_c_msg = 1.
cached_response->set_data( file_content ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = file_mime_type ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate runtime->application_url '/' guid into display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
return.
now in the layout use display_url as the src for iframe
Raja -
PDF Form giving different data compare to smart form
Hi Friends,
There are few scenerion in my system where my application produce a PDF form (Smart Form Convert to PDF through OTF)
In some case when I execute/print the form it shows me all PO form represnt me a differnt PO form althought their smartform is showing up correct PO.
Please help me out what can be a issue.
-RickHi ,
Like I have print of 5-6 PO then I am getting a refrence of some other PO in all print of these 5-6 PO.
for example...I have a print of series 1000000001 to 1000000005 then I am getting the details of other PO 1000000011 into all 5 print of PO starting from 1 to 5.
Note- I have a custom program which convert smartforms to OTF and send a PDF to mail id.
-Ricky
Maybe you are looking for
-
Preview.app - Behaviour of Tiger's Preview for Leopard's Preview?
Hi there, I am a web designer and I use Leopard's Preview to look at different pages of a website's design. This includes opening several pages as images and switching between them. And this is where I'm having alot of issues with Leopard's Preview.a
-
Flex TreeItemRenderer issue with Height
Hello. I went trought alot of nightmare nights with this TreeItemRenderer in forums, Stack Overflow, Expert-Exchange and etc., and i left without actually help on my issue. I hope i got it here finally. The idea is basically create an item for a Tree
-
BSP Extensions doesn't work with Pocket PC2003
hello, i faced out following problem, that i have alreday posted in the BSP-forum. They said the guys here may have a solution. I want to write an application using webas on abap 6.20 SP 41 using BSP-Extension. The Extension framework dumps: browser
-
When taking a picture with home and sleep button can you get rid of the tool and task bar?? (the search bars)
-
Downloading the LR-plugin "presets for lightroom", which I bought before.
Hi I bought the plugin "presets for lightroom", and I can't find a file or a folder in my "download-folder" for installing after with lightroom. How may I download the plugin?