*& Report ZPDF_DNLD_TEST1 *
*& *
*&---------------------------------------------------------------------*
*& DEVK904536 *
*& *
*&---------------------------------------------------------------------*
REPORT zpdf_dnld_test1 .
DATA: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
i_pdf LIKE tline OCCURS 100 WITH HEADER LINE,
i_opt like itcpo occurs 0 with header line. " important
i_opt-TDGETOTF = 'X'.
append i_opt.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
FORM = 'ZTEST_SCRIPT1'
LANGUAGE = SY-LANGU
OPTIONS = i_opt " important
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.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TEXT'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
* IMPORTING
* PENDING_LINES =
* EXCEPTIONS
* ELEMENT = 1
* FUNCTION = 2
* TYPE = 3
* UNOPENED = 4
* UNSTARTED = 5
* WINDOW = 6
* BAD_PAGEFORMAT_FOR_PRINT = 7
* SPOOL_ERROR = 8
* CODEPAGE = 9
* OTHERS = 10
.
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 'CLOSE_FORM'
* IMPORTING
* RESULT =
* RDI_RESULT =
TABLES
OTFDATA = i_otf " important
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.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
* IMPORTING
* BIN_FILESIZE =
* BIN_FILE =
TABLES
otf = i_otf
lines = i_pdf
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 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'c:\test_pdf.pdf'
FILETYPE = 'BIN' " important
* 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 = ' '
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
* IMPORTING
* FILELENGTH =
tables
data_tab = i_pdf
* 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.
ALSO READ:
- Download Data From Application Server Files To Presentation Server Using FM C13Z_APPL_TO_FRONT_END.
- Creating A Directory On Presentation Server Using FM GUI_CREATE_DIRECTORY.
- Removing A Directory From Presentation Server Using FM GUI_REMOVE_DIRECTORY.
- Removing A File From Presentation Server Using FM GUI_DELETE_FILE.
- ZIP Files In Application Server Using FM SCMS_XSTRING_TO_BINARY.
RETURN TO MAIN INDEX:
- Sample Programs On Uploading & Downloading Files.
- Sample Programs On HR ABAP.
- Sample Report Programs On ALV List/ Grid Display.
- Sample Programs On Selection Screen.
- Sample Programs On BDC.
.....Back To MAIN INDEX.
No comments:
Post a Comment