Skip to Content
0
Aug 28, 2007 at 06:44 PM

set_table_for_first_display and is_print problem

186 Views

Hello,

I am having trouble setting the default printer for method set_table_for_first_display. Below are the code snippets I have implemented thinkig it would do the job...

DATA: x_PRINT TYPE LVC_S_PRNT,

x_PRINT_CTRL TYPE ALV_S_PCTL,

x_PRI_PARAMS TYPE PRI_PARAMS,

x_PDEST LIKE pri_params-pdest.

.

.

.

  • set printer to PPOMA_BBP attribute PRI setting

CLEAR x_PDEST.

PERFORM get_default_printer_setting changing x_PDEST.

call function 'GET_PRINT_PARAMETERS'

exporting

DESTINATION = x_PDEST

MODE = 'CURRENT'

NO_DIALOG = 'X'

importing

OUT_PARAMETERS = x_PRI_PARAMS

VALID = g_valid

exceptions

ARCHIVE_INFO_NOT_FOUND = 1

INVALID_PRINT_PARAMS = 2

INVALID_ARCHIVE_PARAMS = 3

others = 4.

if SY-SUBRC <> 0.

CLEAR x_PRINT-PRINT_CTRL.

else.

x_PRINT-PRINT_CTRL = x_PRINT_CTRL.

endif.

.

.

.

CREATE OBJECT grid1

EXPORTING i_parent = custom_container.

CALL METHOD grid1->set_table_for_first_display

EXPORTING i_structure_name = 'ZBBPS_BW_SC_extract_2'

  • gs_variant-report must not be initial!

is_variant = gs_variant

is_print = x_PRINT

i_save = x_save

i_default = h_default

CHANGING it_outtab = t_extract.

When executed, it seems the values are what they are supposed to be in x_PRINT . However, when I clikc the printer icon, the 'PRINT ALV REPORT' displays with the print device blank.

What did I miss?