메뉴 건너뛰기

SAP 한국 커뮤니티

REPORT ZTEST_ABAPTPDF

sapjoy 2010.10.09 20:49 조회 수 : 3691

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

번호 제목 글쓴이 날짜 조회 수
669 REPORT Z06_01. sapjoy 2024.04.20 14
668 REPORT  z05_36 sapjoy 2023.02.07 243
667  z15_21_drag sapjoy 2022.02.24 269
666 Z18_06_DRAGCLASS sapjoy 2022.02.22 296
665 API sapjoy 2022.11.02 316
664 REPORT z10_02. sapjoy 2012.07.30 779
663 REPORT Z11_09. sapjoy 2012.07.30 780
662 REPORT Z11_04 . sapjoy 2012.07.30 786
661 REPORT Z11_03. sapjoy 2012.07.30 795
660 REPORT z11_05. sapjoy 2012.07.30 797
659 REPORT z14_13. sapjoy 2012.08.01 798
658 REPORT z14_09. sapjoy 2012.08.01 800
657 REPORT Z11_08. sapjoy 2012.07.30 805
656 REPORT z08_05. sapjoy 2012.07.30 809
655 REPORT z10_06. sapjoy 2012.07.30 813
654 REPORT z05_14. sapjoy 2012.07.30 814
653 REPORT Z05_32. sapjoy 2012.07.30 816
652 REPORT z08_03. sapjoy 2012.07.30 817
651 REPORT z10_11. sapjoy 2012.07.30 817
650 REPORT Z12_03 sapjoy 2012.07.30 818