SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

SmartForm Printing



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Smartforms, SapScripts, PDF
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Mar 04, 2009 5:19 pm    Post subject: SmartForm Printing Reply with quote

Version 1.0
Author WATTO
Source from: http: /www.watto.org/program/abap/download/Z_SMARTFORM_TEMPLATE_PRINT.abap
Description: A template program that runs a SmartForm and prints the output.

Code:
REPORT z_smartform_template_print.

DATA:
  v_control_params TYPE ssfctrlop,
  v_output_options TYPE ssfcompop,
  v_output_info    TYPE ssfcrescl.



*---------------------------------------------------------------------*
*       START-OF-SELECTION
*---------------------------------------------------------------------*
START-OF-SELECTION.

  CLEAR:
    v_output_info.


  PERFORM setup_smartform_for_print USING 'LOPC'.

  PERFORM run_smartform
    USING 'MYSMARTFORM'
      v_control_params
      v_output_options
    CHANGING
      v_output_info.



*---------------------------------------------------------------------*
*       FORM setup_smartform_for_print
*---------------------------------------------------------------------*
* [+] Sets the parameters for PDF conversions
*---------------------------------------------------------------------*
FORM setup_smartform_for_print
  USING
    p_printr TYPE rspopname.

  CLEAR:
    v_control_params,
    v_output_options.

  v_output_options-tddest     = p_printr.
  v_output_options-tdprinter  = 'SAPWIN'.
  v_output_options-tdnewid    = 'X'.
  v_output_options-tdimmed    = 'X'.
  v_output_options-tddelete   = 'X'.
  v_output_options-tdlifetime = 1.
  v_output_options-tdfinal    = 'X'.

  v_control_params-device     = 'PRINTER'.

ENDFORM.                    "setup_smartform_for_print



*---------------------------------------------------------------------*
*       FORM run_smartform
*---------------------------------------------------------------------*
* [+] Runs the SmartForm of the given name
*---------------------------------------------------------------------*
FORM run_smartform
  USING
    p_form_name TYPE c
    p_control_params TYPE ssfctrlop
    p_output_options TYPE ssfcompop
  CHANGING
    p_output_info TYPE ssfcrescl.

  DATA:
    lv_function_name TYPE rs38l_fnam.

* Find the SmartForm function module name
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = p_form_name
    IMPORTING
      fm_name            = lv_function_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 99.

  IF sy-subrc <> 0.
    EXIT.
  ENDIF.

* Run the SmartForm function module
  CALL FUNCTION p_form_name
    EXPORTING
      control_parameters = p_control_params
      output_options     = p_output_options
      user_settings      = ' '
    IMPORTING
      job_output_info    = p_output_info
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 99.

ENDFORM.                    "run_smartform
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Smartforms, SapScripts, PDF All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.