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: 

set_table_for_first_display and is_print problem

dean_hinson2
Active Contributor
0 Kudos

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?

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Hi,

I think you need to pass this way.


if SY-SUBRC <> 0.
CLEAR x_PRINT-PRINT_CTRL.
else.
* x_PRINT-PRINT_CTRL = x_PRINT_CTRL.
 x_PRINT-PRINT_CTRL = x_PRI_PARAMS. "<<<<<
endif.

aRs

2 REPLIES 2

former_member194669
Active Contributor
0 Kudos

Hi,

I think you need to pass this way.


if SY-SUBRC <> 0.
CLEAR x_PRINT-PRINT_CTRL.
else.
* x_PRINT-PRINT_CTRL = x_PRINT_CTRL.
 x_PRINT-PRINT_CTRL = x_PRI_PARAMS. "<<<<<
endif.

aRs

0 Kudos

Yep... been looking at too long.... changed the code as follows...

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_PRI_PARAMS.

endif.

x_PRINT_CTRL-PRI_PARAMS = x_PRI_PARAMS.

x_PRINT-PRINT_CTRL = x_PRINT_CTRL.