‎2009 Jul 23 12:42 PM
Hi All,
Can someone advise to me whether it is possible to send a string to a printer from a SAP program? Im using a ZEBRA printer and want to send ZPL code to it in raw print format.
If so how do i go about doing it? How would i specify printer location and so on.
Many Thanks - David
‎2009 Jul 23 3:06 PM
I don't have any experience with ZEBRAs but since no one has answered, here's some info. You can send commands to printers using the PRINT-CONTROL command from lists or forms. Since you've already specified an output device, SAP knows where to send the control. You'll find a list of available print control commands for your device type in transaction SPAD. You can also create your own print controls and add them through SPAD. If you're using one of the form development technologies, you can also specify a page format that has printer specific commands attached to it. This is commonly used to load PCL commands for tray initialization, font loading, etc.
‎2009 Jul 23 3:06 PM
I don't have any experience with ZEBRAs but since no one has answered, here's some info. You can send commands to printers using the PRINT-CONTROL command from lists or forms. Since you've already specified an output device, SAP knows where to send the control. You'll find a list of available print control commands for your device type in transaction SPAD. You can also create your own print controls and add them through SPAD. If you're using one of the form development technologies, you can also specify a page format that has printer specific commands attached to it. This is commonly used to load PCL commands for tray initialization, font loading, etc.
‎2009 Jul 23 3:09 PM
Hi Brad,
Thanks for you response.
I pretty much stumbled across this solution myself too. Many thanks for taking the time though.
David
‎2009 Jul 24 10:56 AM
Brad,
Sorry to bother, i managed to pass a string to the printer using this method but its not what i was looking for as i thought the printer would then interpate the printer code string wrapper (in this case ZPL code). But instead it just prints the string that i pass through. This makes sense to be honest but i was wondering if it is possible to pass the string as raw data so that it can be interpreted.
I've seen the RDI (raw data interface) parameter within OPEN_FORM but i can't see an object to pass the string wrapper to.
Any ideas eould be greatly appreciated.
Thanks - David
‎2009 Jul 24 10:56 AM
‎2009 Jul 24 11:18 AM
Hi,
Check this code. it might help u.
loop at it_printdata into wa_final.
check wa_final-lgort ne space .
output_options-tddest = pripar-pdest.
output_options-tdimmed = pripar-primm.
output_options-tdnewid = 'X'.
output_options-tdcopies = wa_final-prcop.
append output_options.
control_parameters-preview = ' '.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
control_parameters-no_dialog = 'X'.
append control_parameters.
if wa_final-type eq 'MTS'.
* IF wa_final-vbeln EQ space AND wa_final-kdpos IS INITIAL.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form1
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
call function 'SSF_OPEN'
exporting
user_settings = ' '
output_options = output_options
control_parameters = control_parameters.
call function fm_name1
exporting
control_parameters = control_parameters
output_options = output_options
v_matnr = wa_final-matnr
v_werks = wa_final-swerk
v_lgort = wa_final-lgort
v_sernr = wa_final-sernr.
if sy-subrc eq 0.
flag = 'X'.
endif.
call function 'SSF_CLOSE'.
else.
check wa_final-vbeln ne space and not wa_final-posnr is initial .
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form2
importing
fm_name = fm_name2
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
call function 'SSF_OPEN'
exporting
user_settings = ' '
output_options = output_options
control_parameters = control_parameters.
call function fm_name2
exporting
control_parameters = control_parameters
output_options = output_options
v_matnr = wa_final-matnr
v_werks = wa_final-swerk
v_lgort = wa_final-lgort
v_sernr = wa_final-sernr
v_kdauf = wa_final-vbeln
v_kdpos = wa_final-posnr.
if sy-subrc eq 0.
flag = 'X'.
endif.
call function 'SSF_CLOSE'.
endif.
clear wa_final.
endloop.
‎2009 Jul 24 11:19 AM
Hi,
Check this code. It might help you.
loop at it_printdata into wa_final.
check wa_final-lgort ne space .
output_options-tddest = pripar-pdest.
output_options-tdimmed = pripar-primm.
output_options-tdnewid = 'X'.
output_options-tdcopies = wa_final-prcop.
append output_options.
control_parameters-preview = ' '.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
control_parameters-no_dialog = 'X'.
append control_parameters.
if wa_final-type eq 'MTS'.
* IF wa_final-vbeln EQ space AND wa_final-kdpos IS INITIAL.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form1
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
call function 'SSF_OPEN'
exporting
user_settings = ' '
output_options = output_options
control_parameters = control_parameters.
call function fm_name1
exporting
control_parameters = control_parameters
output_options = output_options
v_matnr = wa_final-matnr
v_werks = wa_final-swerk
v_lgort = wa_final-lgort
v_sernr = wa_final-sernr.
if sy-subrc eq 0.
flag = 'X'.
endif.
call function 'SSF_CLOSE'.
else.
check wa_final-vbeln ne space and not wa_final-posnr is initial .
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form2
importing
fm_name = fm_name2
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
call function 'SSF_OPEN'
exporting
user_settings = ' '
output_options = output_options
control_parameters = control_parameters.
call function fm_name2
exporting
control_parameters = control_parameters
output_options = output_options
v_matnr = wa_final-matnr
v_werks = wa_final-swerk
v_lgort = wa_final-lgort
v_sernr = wa_final-sernr
v_kdauf = wa_final-vbeln
v_kdpos = wa_final-posnr.
if sy-subrc eq 0.
flag = 'X'.
endif.
call function 'SSF_CLOSE'.
endif.
clear wa_final.
endloop.
‎2009 Jul 24 11:22 AM
Hi Balu,
Thanks for the reply but this is not what im looking for. I need to pass raw data to the printer
david