Sie sind auf Seite 1von 4

Converting SMART FORMS output to PDF format

REPORT

zsuresh_test.

*
DATA:
w_form_name
w_fmodule
w_cparam
w_outoptions
W_bin_filesize
w_FILE_NAME
w_File_path
w_FULL_PATH

Variable
TYPE

VALUE

Internal

itcoo

*
Internal
t_otf_from_fm

table

to

*
Internal
T_pdf_tab

table
LIKE

to

This function
module

tables

table

TYPE

to

hold

OCCURS

hold

OTF

hold

module call
generated

is used
when

declaration
the

recd

from
0

the
WITH

name

to

SMARTFORM
ssfcrescl,

FM
CONVERT_OTF
HEADER
LINE.

of

the

Function
activated

is

=
=

w_form_name
'
'

'
=

'

w_fmodule
=

1
2
3

=
=
<>
TYPE
sy-msgv2

space.

be

LINE,

'SSF_FUNCTION_MODULE_NAME'

"
"

Printer

the

to retrieve the name


the
SMARTFORM

w_cparam-getotf
*

data

HEADER

from

sy-msgty

used

is

=
Suppressing
for
=
provided

0.
sy-msgno
sy-msgv4.

NUMBER
sy-msgv3

*
Calling
the
SMARTFORM
using
the
function
* GET_OTF parameter in the CONTROL_PARAMETERS
* format of the output

OTF

WITH

data
TYPE

the
data
OCCURS

tline

CALL
FUNCTION
EXPORTING
formname
*
VARIANT
*
DIRECT_CALL
IMPORTING
fm_name
EXCEPTIONS
no_form
no_function_module
OTHERS
.
IF
sy-subrc
MESSAGE
ID
sy-msgid
WITH
sy-msgv1
ENDIF.

w_cparam-no_dialog
w_cparam-preview

'ZSURESH_TEST',
rs38l_fnam,
ssfctrlop,
ssfcompop,
File
Size
string,
string,
string.

Binary

Internal

*
DATA:
t_otf

*
*

tdsfname
TYPE
TYPE
TYPE
i,
"
type
type
type

TYPE

declarations

in

module
is set

the
print

the

retrieved
above
to get the OTF

dialog

export

'X'.
box
preview
'X'.
parameter

*
w_outoptions-tddest

OUTPUT_OPTIONS
'LP01'.

CALL
FUNCTION
EXPORTING
*
ARCHIVE_INDEX
*
ARCHIVE_INDEX_TAB
*
ARCHIVE_PARAMETERS
control_parameters
=
*
MAIL_APPL_OBJ
*
MAIL_RECIPIENT
*
MAIL_SENDER
output_options
=
*
USER_SETTINGS
=
IMPORTING
*
DOCUMENT_OUTPUT_INFO
job_output_info
=
*
JOB_OUTPUT_OPTIONS
EXCEPTIONS
formatting_error
=
internal_error
=
send_error
=
user_canceled
=
OTHERS
=
.
IF
sy-subrc
<>
MESSAGE
ID
sy-msgid
TYPE
sy-msgty
NUMBER
WITH
sy-msgv1
sy-msgv2
sy-msgv3
ENDIF.
t_otf[]
*

Function

=
Module

CONVERT_OTF

w_fmodule
=
=
=
w_cparam
=
=
=
w_outoptions
'X'
=
t_otf_from_fm
=
1
2
3
4
5
0.
sy-msgno
sy-msgv4.

t_otf_from_fm-otfdata[].
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

CALL
EXPORTING
BIN_FILESIZE
filename
FILETYPE
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
tables
data_tab
*

FM

GUI_DOWNLOAD

to download
presentation

the

generated

FUNCTION

PDF

file

onto the
server

'GUI_DOWNLOAD'
=

FILELENGTH

W_bin_filesize
w_FULL_PATH
'BIN'
'
'
'
'
'00'
'
'
'X'
'
'
'
'
'
'
'
'
'
'
'
'
ABAP_TRUE
'#'
'
'
=
'X'
'
'
'
'
'
'
'
'
IMPORTING
=

=
FIELDNAMES

T_pdf_tab
=

=
=
APPEND
=
WRITE_FIELD_SEPARATOR
=
HEADER
=
TRUNC_TRAILING_BLANKS
=
WRITE_LF
=
COL_SELECT
=
COL_SELECT_MASK
=
DAT_MODE
=
CONFIRM_OVERWRITE
=
NO_AUTH_CHECK
=
CODEPAGE
=
IGNORE_CERR
=
REPLACEMENT
=
WRITE_BOM
=
TRUNC_TRAILING_BLANKS_EOL
WK1_N_FORMAT
=
WK1_N_SIZE
=
WK1_T_FORMAT
=
WK1_T_SIZE
=

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
.
IF
*
MESSAGE
*
WITH
ENDIF.

FILE_WRITE_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
FILESIZE_NOT_ALLOWED
HEADER_TOO_LONG
DP_ERROR_CREATE
DP_ERROR_SEND
DP_ERROR_WRITE
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL
DP_TIMEOUT
FILE_NOT_FOUND
DATAPROVIDER_EXCEPTION
CONTROL_FLUSH_ERROR
OTHERS

ID

sy-subrc
SY-MSGID
SY-MSGV1

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

<>
TYPE
SY-MSGTY
NUMBER
SY-MSGV2
SY-MSGV3

EXCEPTIONS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0.
SY-MSGNO
SY-MSGV4.

Das könnte Ihnen auch gefallen