REPORT ZTEST_ABAPTPDF.
TABLES: TSP01.
DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS,
MC_VALID(1) TYPE C,
MI_BYTECOUNT TYPE I,
MI_LENGTH TYPE I,
MI_RQIDENT LIKE TSP01-RQIDENT.
DATA: MTAB_PDF LIKE TLINE OCCURS 0,
MC_FILENAME TYPE STRING. "LIKE RLGRAP-FILENAME.
*-- SELECTION SCREEN
PARAMETERS: P_REPID LIKE SY-REPID, " Report to execute
P_LINSZ LIKE SY-LINSZ DEFAULT 132, " Line size
P_PAART LIKE SY-PAART DEFAULT 'Z_58_147'. " Paper Format
START-OF-SELECTION.
CONCATENATE 'c:' P_REPID '.pdf' INTO MC_FILENAME. è 다운로드 파일경로
*-- Setup the Print Parmaters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
COPIES = '1'
DESTINATION = SPACE
EXPIRATION = '1'
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = MSTR_PRINT_PARMS
VALID = MC_VALID.
IF MSTR_PRINT_PARMS-PDEST = SPACE. MSTR_PRINT_PARMS-PDEST = 'ZP01'. ENDIF.
MSTR_PRINT_PARMS-LINSZ = P_LINSZ.
MSTR_PRINT_PARMS-PAART = P_PAART.
SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS MSTR_PRINT_PARMS
VIA SELECTION-SCREEN AND RETURN.
*-- Find out what the spool number is that was just created
PERFORM GET_SPOOL_NUMBER USING SY-REPID SY-UNAME
CHANGING MI_RQIDENT.
*-- Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = MI_RQIDENT
NO_DIALOG = SPACE
DST_DEVICE = MSTR_PRINT_PARMS-PDEST
IMPORTING
PDF_BYTECOUNT = MI_BYTECOUNT
TABLES
PDF = MTAB_PDF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = MI_BYTECOUNT
FILENAME = MC_FILENAME
FILETYPE = 'BIN'
CHANGING
DATA_TAB = MTAB_PDF.
FORM GET_SPOOL_NUMBER USING F_REPID F_UNAME
CHANGING F_RQIDENT.
DATA: LC_RQ2NAME LIKE TSP01-RQ2NAME.
CONCATENATE F_REPID+0(8) F_UNAME+0(3) INTO LC_RQ2NAME SEPARATED BY '_'.
SELECT * FROM TSP01 WHERE RQ2NAME = LC_RQ2NAME
ORDER BY RQCRETIME DESCENDING.
F_RQIDENT = TSP01-RQIDENT. EXIT.
ENDSELECT.
IF SY-SUBRC NE 0. CLEAR F_RQIDENT. ENDIF.
ENDFORM." get_spool_number
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
391 | report zsaptip_009 [1] | sapjoy | 2010.12.10 | 3852 |
390 | REPORT Z_3DGRAPH. [1] | sapjoy | 2010.10.18 | 3666 |
389 | REPORT zsmw0010 | sapjoy | 2010.10.12 | 4315 |
388 | z_exception_test | sapjoy | 2010.10.11 | 3521 |
387 | REPORT zmacro_01. | sapjoy | 2010.10.10 | 2582 |
» | REPORT ZTEST_ABAPTPDF | sapjoy | 2010.10.10 | 3693 |
385 | REPORT ZALVCOLOR | sapjoy | 2010.10.10 | 3212 |
384 | REPORT ZTABLE_UTIL | sapjoy | 2010.10.10 | 4012 |
383 | REPORT Z_DYNAMIC_SCREEN [1] | sapjoy | 2010.10.08 | 3035 |
382 | report zsalv_045 . | sapjoy | 2010.08.20 | 4264 |
381 | report zsalv_043 . | sapjoy | 2010.08.20 | 2978 |
380 | report zsalv_042 . | sapjoy | 2010.08.20 | 3135 |
379 | report zsalv_041 . | sapjoy | 2010.08.20 | 2998 |
378 | report zsalv_040 . | sapjoy | 2010.08.20 | 2608 |
377 | report zsalv_036 . | sapjoy | 2010.08.20 | 3473 |
376 | report zsalv_035 . | sapjoy | 2010.08.20 | 2505 |
375 | report zsalv_032 . | sapjoy | 2010.08.20 | 2976 |
374 | report zsalv_031 . | sapjoy | 2010.08.20 | 2427 |
373 | report zsalv_030 . | sapjoy | 2010.08.20 | 2331 |
372 | report zsalv_023 . | sapjoy | 2010.08.20 | 2347 |