Skip to Content
0
Former Member
Mar 06, 2009 at 06:19 AM

Changing Printer Default Setting

212 Views

Hello Folks,

I got a requirement to change the printer default settings, but its not reflecting in ALV Reports.

Any inputs? want to change layout to X_65_255

Here is the coding i have done.Please let me know on Corrections.

DATA: l_t_params LIKE pri_params,

l_valid TYPE c,

l_f_repid LIKE sy-repid.

DATA: l_days LIKE pri_params-pexpi VALUE 5,

l_count LIKE pri_params-prcop VALUE 1,

l_list_text LIKE pri_params-prtxt,

l_text(12) TYPE c.

*&--FETCH DEFAULT PRINTER FOR A USER

CLEAR usr01.

SELECT SINGLE * FROM usr01 WHERE bname = sy-uname.

*&--IF DEFAULT PRINTER DOESN'T EXIST SET IT TO 'LOCL'.

IF usr01-spld IS INITIAL.

usr01-spld = 'LOCL'.

ENDIF.

*&--GET THE EXISTING DEFAULT PARAMETERS

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

no_dialog = 'X'

IMPORTING

out_parameters = l_t_params.

*&--MODIFY THE EXISTING DEFAULT PARAMETERS

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

destination = usr01-spld

immediately = 'X'

copies = l_count

list_name = l_text

new_list_id = 'X'

line_size = 255

abap_list = 'X'

line_count = 65

layout = 'X_65_255'

receiver = sy-uname

no_dialog = 'X'

IMPORTING

out_parameters = l_t_params

valid = l_valid.

alv_print-print_ctrl-pri_params = l_t_params.

CALL METHOD g_o_grid->set_table_for_first_display

EXPORTING

i_bypassing_buffer = 'X'

is_variant = alv_disp_variant

i_save = 'A'

i_default = 'X'

is_layout = alv_layout

is_print = alv_print

it_toolbar_excluding = alv_excl_func

CHANGING

it_outtab = $alv_outtab[] "because with

it_fieldcatalog = alv_fieldcat

it_sort = alv_sorttab

EXCEPTIONS

invalid_parameter_combination = 1 "header line when density

program_error = 2

too_many_lines = 3

OTHERS = 4.