Skip to Content
0
Nov 18, 2011 at 03:04 PM

ALV print in background : print dialog pops up

508 Views

Hi,

I want to print a ALV grid to Spool in background......................I am using FM ' REUSE_ALV_GRID_DISPLAY'

But when I execvute the program in foreground or background the print selection dialog comes up....................How to avoid this........................Any ideas or experience

*--


CODE--


**- Get printer parameters
DATA : l_params.

  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      IMMEDIATELY            = SPACE
      LAYOUT                 = 'X_58_170"'
      LINE_COUNT             = '58'
      LINE_SIZE              = '1024'
      NO_DIALOG              = 'X'
      DESTINATION            = 'LOCL'
    IMPORTING
      OUT_PARAMETERS         = l_params
    EXCEPTIONS
      ARCHIVE_INFO_NOT_FOUND = 1
      INVALID_PRINT_PARAMS   = 2
      INVALID_ARCHIVE_PARAMS = 3
      OTHERS                 = 4.

*- Prepare ALV print str.
  l_print-print = abap_true .                   
  l_print-print_ctrl = lfd_params.
  l_print-NO_CHANGE_PRINT_PARAMS = abap_true.  
  l_print-no_print_listinfos = 'N'.


*-Call ALV in background
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = l_repid
*        i_callback_pf_status_set = L_pf_stat
*        i_callback_user_command  = l_user_cmd
      i_callback_top_of_page   = l_top_page
      is_layout                = l_layout
      it_fieldcat              = lt_ALV_fcat
      IS_PRINT                 = l_print
      i_save                   = 'A'
    TABLES
      t_outtab                 = lt_objects
    EXCEPTIONS
      program_error            = 1.

<Added code tags>

Edited by: Suhas Saha on Nov 21, 2011 2:54 PM