‎2009 Mar 06 6:19 AM
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.
‎2009 Mar 06 6:21 AM
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.
‎2009 Mar 06 6:21 AM
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.
‎2009 Mar 06 6:21 AM
do u get any error? did u check necessary authorization for doing the same? check return parameters of FM for errors?
‎2009 Mar 06 6:23 AM
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
‎2009 Mar 06 6:40 AM
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
‎2009 Mar 06 9:29 AM