Application Development and Automation 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: 
Read only

Changing Printer Default Setting

Former Member
0 Likes
1,331

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,119

Hi,

Go through the following FMs:

LOAD_PRINT_PARAMETERS - User default printer settings

SET_PRINT_PARAMETERS - Sets users print settings for a report

STORE_PRINT_PARAMETERS - Saves users current print settings

Do search on them for full details.

Regards.

5 REPLIES 5
Read only

Former Member
0 Likes
1,120

Hi,

Go through the following FMs:

LOAD_PRINT_PARAMETERS - User default printer settings

SET_PRINT_PARAMETERS - Sets users print settings for a report

STORE_PRINT_PARAMETERS - Saves users current print settings

Do search on them for full details.

Regards.

Read only

Former Member
0 Likes
1,119

do u get any error? did u check necessary authorization for doing the same? check return parameters of FM for errors?

Read only

0 Likes
1,119

Iam getting retun parameter as Valid = 'X'.

I want the settings to get affected only to the program i ran

Edited by: Nishanth Kumar Reddy Chenchu on Mar 6, 2009 11:59 AM

Read only

Former Member
0 Likes
1,119

Hi,

Ofcourse, its different issue...Can you explain me why you have used the below code

*&--GET THE EXISTING DEFAULT PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
out_parameters = l_t_params.

I mean you are importing the existing default parameters but you are not modifying the parameters in l_t_params. I hope you are not required above code.

Satya

Read only

0 Likes
1,119

Can i get any inputs please