PDF打印
data: L_FUN_NAM TYPE RS38L_FNAM, "FUNCTION NAME
L_CONTROL TYPE SSFCTRLOP, "CONTROL
L_OPTION TYPE SSFCOMPOP, "OPTION
OPTION TYPE SSFCRESCL.
L_CONTROL TYPE SSFCTRLOP, "CONTROL
L_OPTION TYPE SSFCOMPOP, "OPTION
OPTION TYPE SSFCRESCL.
L_CONTROL-GETOTF = 'X'.
* l_control-preview = ''.
L_CONTROL-NO_DIALOG = 'X'.
L_CONTROL-LANGU = SY-LANGU.
* l_control-preview = ''.
L_CONTROL-NO_DIALOG = 'X'.
L_CONTROL-LANGU = SY-LANGU.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZQM_FORM_INSPECT4_COPY1'
EXPORTING
FORMNAME = 'ZQM_FORM_INSPECT4_COPY1'
IMPORTING
FM_NAME = L_FUN_NAM
FM_NAME = L_FUN_NAM
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
CALL FUNCTION L_FUN_NAM
EXPORTING
CONTROL_PARAMETERS = L_CONTROL
OUTPUT_OPTIONS = L_OPTION
USER_SETTINGS = 'X' "20210402
G_TLINE = L_LINES
IMPORTING
JOB_OUTPUT_INFO = OPTION
TABLES
GT_OUT = GT_OUT2
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
EXPORTING
CONTROL_PARAMETERS = L_CONTROL
OUTPUT_OPTIONS = L_OPTION
USER_SETTINGS = 'X' "20210402
G_TLINE = L_LINES
IMPORTING
JOB_OUTPUT_INFO = OPTION
TABLES
GT_OUT = GT_OUT2
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
"PDF打印
IF SY-UNAME = 'DEV'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = G_BINFILESIZE
TABLES
OTF = OPTION-OTFDATA
LINES = GT_PDFTAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
CHANGING
FILENAME = FILE_NAME
PATH = FILE_PATH
FULLPATH = FULL_PATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = G_BINFILESIZE
FILENAME = FULL_PATH
FILETYPE = 'BIN'
TABLES
DATA_TAB = GT_PDFTAB.
ELSE.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
I_OTF = OPTION-OTFDATA
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = G_BINFILESIZE
TABLES
OTF = OPTION-OTFDATA
LINES = GT_PDFTAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
CHANGING
FILENAME = FILE_NAME
PATH = FILE_PATH
FULLPATH = FULL_PATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = G_BINFILESIZE
FILENAME = FULL_PATH
FILETYPE = 'BIN'
TABLES
DATA_TAB = GT_PDFTAB.
ELSE.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
I_OTF = OPTION-OTFDATA
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.