2007 Jan 30 2:10 PM
Hi all!
How can I pass variable with PRINTERNAME to function GET/SET_PRINT_PARAMETERS..
If I use this code it stil print with default printer?
FORM print.
PERFORM read_fields.
DATA: val,
pripar LIKE pri_params,
arcpar LIKE arc_params,
h_plist LIKE pri_params-plist.
DATA:l_params TYPE pri_params,
l_valid TYPE c.
DATA: pa_dest LIKE pri_params-pdest.
pa_dest = '3070'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
immediately = 'X'
IMPORTING
out_parameters = pripar
out_archive_parameters = arcpar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF val <> space AND sy-subrc = 0.
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = pa_dest.
NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG.
PERFORM print_selectie_per_klant_f.
NEW-PAGE PRINT OFF.
ELSE.
PERFORM fout.
ENDIF.
ENDFORM.
Adibo..:)
Hi all!
How can I pass variable with PRINTERNAME to function GET/SET_PRINT_PARAMETERS..
If I use this code it stil print with default printer?
FORM print.
PERFORM read_fields.
DATA: val,
pripar LIKE pri_params,
arcpar LIKE arc_params,
h_plist LIKE pri_params-plist.
DATA:l_params TYPE pri_params,
l_valid TYPE c.
DATA: pa_dest LIKE pri_params-pdest.
pa_dest = '3070'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
immediately = 'X'
IMPORTING
out_parameters = pripar
out_archive_parameters = arcpar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF val <> space AND sy-subrc = 0.
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = pa_dest.
NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG.
PERFORM print_selectie_per_klant_f.
NEW-PAGE PRINT OFF.
ELSE.
PERFORM fout.
ENDIF.
ENDFORM.
Adibo..:)
2007 Jan 30 2:15 PM
2007 Jan 30 2:16 PM
Hi,
There is a Exporting field called <b>DESTINATION</b>. This is the 'output device
Regards
Sudheer
2007 Jan 30 2:17 PM
have you called the FM SET_PRINT_PARAMETERS in the events INITIALIZATION or AT SELECTION-SCREEN.
AT SELECTION-SCREEN.
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = pa_dest.
2007 Jan 30 2:18 PM
check below code...
*Print parameter declarations
DATA: val(1) TYPE c,
pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
lay = 'X_65_255'.
lines = 255.
rows = 65.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
layout = lay
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
check val EQ 'X'.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
Write:/ 'data'.
NEW-PAGE PRINT OFF.
*Write to printer
DATA: ld_params LIKE pri_params,
ld_valid TYPE c,
ld_lay TYPE pri_params-paart,
Example of seting default layout
ld_lay = 'X_65_255'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
immediately = 'X'
LAYOUT = ld_layout
LIST_NAME = 'TEST'
LIST_TEXT = 'Test page'
NEW_LIST_ID = 'X'
no_dialog = ' '
release = 'X'
IMPORTING
out_parameters = ld_params
valid = ld_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
IF ld_valid <> space.
new-page print on parameters ld_params NO dialog.
write: 'This text will be printed on page'.
write: 'This text will be printed on page'.
Stop spool report appearing, maybe option to remove this
leave to screen 0.
ENDIF.
ENDIF.
2007 Jan 30 2:19 PM
Hi adibo,
i believe the pri_params-pdest (structure pri_params field pdest lenght is only of 4 characters) takes the length of 4. however spool devices are assigned numbers in the case '3070' device...
hope this helps u a bit,
all the best,
regards,
sampath
mark helpful answers
2007 Jan 30 2:30 PM
@Chandrasekhar and everyone
I tried this:
AT SELECTION-SCREEN.
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = pa_dest.
FORM print.
PERFORM read_fields.
DATA: val,
pripar LIKE pri_params,
arcpar LIKE arc_params,
h_plist LIKE pri_params-plist.
DATA : c_copies LIKE pri_params-prcop.
DATA:l_params TYPE pri_params,
l_valid TYPE c.
DATA: pa_dest LIKE pri_params-pdest.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = ' '
immediately = 'X'
IMPORTING
out_parameters = pripar out_archive_parameters = arcpar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF val <> space AND sy-subrc = 0.
NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG.
PERFORM print_selectie_per_klant_f.
NEW-PAGE PRINT OFF.
ELSE.
PERFORM fout.
ENDIF.
ENDFORM.
Won't work..I still see my default printer..
I'am using VPN at the moment..I don't know if this is the problem..:S
Adibo..:)
2007 Jan 30 2:37 PM
if ur using VPN, then ur mostly connecting to ur client from somewhere else. so it takes default printer and prints normally. Normally, users can print from client location to the correct printer.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |