Saturday, December 18, 2010
Set 'X' to IS_PRINT-PRINT to print ALV output to spool and read spool using function module CONVERT_ABAPSPOOLJOB_2_PDF.
REPORT zdownload_alvoutput. *&-----------------------------------------------------------------------* * Declarations *&-----------------------------------------------------------------------* DATA: i_t001 TYPE t001 OCCURS 0, pdf LIKE tline OCCURS 0. DATA: g_spool TYPE tsp01-rqident, g_program TYPE sy-repid VALUE sy-repid. TYPE-POOLS:slis. DATA: w_print TYPE slis_print_alv, w_print_ctrl TYPE alv_s_pctl. *&-----------------------------------------------------------------------* * Selection-Screen *&-----------------------------------------------------------------------* PARAMETERS: p_file TYPE string. *&-----------------------------------------------------------------------* * Initialization *&-----------------------------------------------------------------------* INITIALIZATION. p_file = 'C:\venkat.pdf'. *&-----------------------------------------------------------------------* * Start-of-selection *&-----------------------------------------------------------------------* START-OF-SELECTION. SELECT * FROM t001 INTO TABLE i_t001 UP TO 100 ROWS. w_print-print = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_program i_structure_name = 'T001' is_print = w_print TABLES t_outtab = i_t001. IF sy-subrc EQ 0. g_spool = sy-spono. CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' EXPORTING src_spoolid = g_spool TABLES pdf = pdf. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filename = p_file filetype = 'BIN' TABLES data_tab = pdf. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_program i_structure_name = 'T001' TABLES t_outtab = i_t001. "is_print = w_print ENDIF. ENDIF. ENDIF.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
this is good , but i want send mail with pdf attachment
ReplyDeleteHi,
ReplyDeleteWhen i try to create PDF file with this logic, When i Execute, A pop up window is coming asking for Output Device, Number of Copes etc.. . How can i bypass this pop up screen. Directly output should be saved in PDF without asking any input for Output Device, Number of Copes etc.