Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

reg: Suppress Print popup while printing ALV

former_member196601
Active Participant
0 Kudos

Hi Experts,

I am using FM REUSE_ALV_LIST_DISPLAY to print the report and convert the spool to PDF and email it as attachment.

When iam calling the FM for printing by passing parameter IS_PRINT, it is asking me to enter printer details as popup. I need to suppress this popup. I tried passing the default print parameters to this IS_PRINT, but still no result.

Can anyone help me on this.

Thanks

Naveen

2 REPLIES 2

Former Member
0 Kudos

Hi

You need to pass first ALV data to spool and a PDF doc as email and then again call the FM grid display .

  • Clear Spool Number

CLEAR: gv_spool.

  • Check for presence of any recipients

IF s_reclst[] IS NOT INITIAL.

sy-batch = 'X'. "#EC WRITE_OK

gs_alv_print-print = 'X'.

gs_alv_print-prnt_info = ' '.

gs_alv_print-no_print_selinfos = 'X'.

gs_alv_print-no_print_listinfos = 'X'.

gs_alv_print-no_coverpage = 'X'.

gs_alv_print-reserve_lines = 1.

gs_alv_print-print_ctrl-pri_params-pdest = 'PRINTER'.

gs_alv_print-print_ctrl-pri_params-primm = 'X'.

CALL FUNCTION 'REUSE_ALV_list_DISPLAY'

EXPORTING

i_callback_program = gv_repid

is_layout = gs_alv_layout

is_variant = gs_alv_variant

it_fieldcat = gt_alv_fieldcat

it_sort = gt_alv_sort

it_events = gt_alv_events

is_print = gs_alv_print

TABLES

t_outtab = gt_final[]

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Get the Spoolnumber

gv_spool = sy-spono.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = gv_spool

TABLES

pdf = gt_pdf_output

EXCEPTIONS

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

OTHERS = 12.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

  • Transfer the 132-long strings to 255-long strings

LOOP AT gt_pdf_output INTO gs_pdf_output.

TRANSLATE gs_pdf_output USING ' ~'.

CONCATENATE gt_buffer gs_pdf_output INTO gt_buffer.

ENDLOOP.

TRANSLATE gt_buffer USING '~ '.

DO.

gs_objtxt = gt_buffer.

APPEND gs_objtxt TO gt_objtxt.

SHIFT gt_buffer LEFT BY 255 PLACES.

IF gt_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

ENDIF.

ENDIF.

the above code will help you.

Thanks

kishore

SuhaSaha
Advisor
Advisor
0 Kudos

Please check Sandra's reply in this thread: