‎2016 Jan 05 4:07 AM
Hi All,
I am using Smartforms to print some barcodes based information. Instead of using Print Preview and then giving PDF!, Is there any other way to generate the pdf file just for printing it. I don't want to save the file as pdf in some location. I want just the functionality of PDF! to print the file.
Kindly help me in this regard,
Thanks in advance,
Jai.
‎2016 Jan 05 4:47 AM
Hello Jai,
In the print option, from where you select to see the print preview, tick the option print immediately. If you do not need the spool, you can select 'Delete after output' option.
If you want to make it through the driver program, then you can use OUTPUT_OPTIONS-TDIMMED and set its parameter to u2018Xu2019 while calling the function module of the smartforms. TDIMMED means print immediately.
Regards,
Shivangi Vyas
‎2016 Jan 05 6:01 AM
Hi,
Actually getting the PDF is extra code....
Some code
SELECTION-SCREEN SKIP .
PARAMETERS: p_dialog TYPE fpnodialog AS CHECKBOX DEFAULT abap_true .
PARAMETERS: p_prview TYPE tdpreview AS CHECKBOX DEFAULT abap_true .
PARAMETERS: p_immed TYPE ssfcompop-tdimmed AS CHECKBOX DEFAULT abap_true .
PARAMETERS: p_delete TYPE ssfcompop-tddelete AS CHECKBOX DEFAULT abap_true .
PARAMETERS: p_padest TYPE tsp03-padest OBLIGATORY .
PARAMETERS: p_langu TYPE t002-spras OBLIGATORY DEFAULT sy-langu .
SELECTION-SCREEN SKIP .
INITIALIZATION.
PERFORM at_initialization .
*----------------------------------------------------------------------*
FORM at_initialization .
DATA: it_return TYPE bapirettab .
DATA: st_defaults TYPE bapidefaul .
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
IMPORTING
defaults = st_defaults
TABLES
return = it_return.
p_padest = st_defaults-spld .
ENDFORM . "at_initialization
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM prt_data_1 .
DATA: fm_name TYPE rs38l_fnam .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_fname
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
DATA: st_control_parameters TYPE ssfctrlop .
DATA: st_output_options TYPE ssfcompop .
DATA: st_job_output_info TYPE ssfcrescl .
st_control_parameters-no_dialog = p_dialog .
st_control_parameters-device = 'PRINTER' .
st_control_parameters-preview = p_prview .
st_control_parameters-langu = p_langu .
* st_output_options-tdnoprint = abap_true .
st_output_options-tdnewid = abap_true .
st_output_options-tdimmed = p_immed .
st_output_options-tddest = p_padest .
st_output_options-tddelete = p_delete .
CALL FUNCTION fm_name
EXPORTING
user_settings = abap_false "Take into account st_output_options
control_parameters = st_control_parameters
output_options = st_output_options
st_scarr = st_scarr
it_sflight = it_sflight
IMPORTING
job_output_info = st_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc NE 0 .
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .
ENDIF .
ENDFORM . "prt_data_1
*----------------------------------------------------------------------*
Regards.