Wednesday, December 22, 2010
Set IS_PRINT-PRINT = 'X' to get Print parameters popup. When you execute program, it prints ALV output to spool.
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 <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. 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. 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
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.