Aufruf des Smart Forms Formulars im Rahmenprogramm

Aus SAP-Wiki
Zur Navigation springenZur Suche springen

Siehe Smart Forms.

Ein typischer Aufruf eines Smart Form Formulars könnte so aussehen:

 DATA: lv_fm_name  TYPE rs38l_fnam,
       ls_params1 TYPE ssfcompop.
*      ls_params2 TYPE ssfctrlop,

 DATA: ls_document_output_info TYPE  ssfcrespd,
       ls_job_output_info      TYPE  ssfcrescl,
       ls_job_output_options   TYPE  ssfcresop.

 CONSTANTS: con_form    TYPE ssfscreen-fname  VALUE 'ZREBADRESSEN',
            con_drucker TYPE ssfcompop-tddest VALUE 'LOCL'.

* Es wird der von Smartforms generierte Funktionsbaustein ermittelt
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = con_form   "Smart Forms Name
    IMPORTING
      fm_name            = lv_fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.

 IF sy-subrc <> 0.
*  Ermittlung technische Bezeichnung Smartforms nicht erfolgreich
   MESSAGE i531(0u) WITH text-096.
   EXIT.
 ENDIF.

* Füllen der Druckparameter
* ls_params2-no_dialog  = 'X'.
* ls_params1-tdnoprev   = 'X'.
  ls_params1-tddest     = con_drucker.  "Spool: Output device
  ls_params1-xsfoutdev  = con_drucker.  "Spool: Output device
  ls_params1-tddataset  = 'INV'.        "Spool request: Name
  ls_params1-tdlifetime = '5'.          "Spool Retention Period (Print Parameters)
* ls_params1-tdsuffix1  = 'suff1'.      "Spool request: Suffix 1
  ls_params1-tdsuffix2  = sy-uname.     "Spool request: Suffix 2
  ls_params1-tdnewid    = 'X'.          "New Spool Request (Print Parameters)
  ls_params1-TDIMMED    = space.        "Print Immediately (Print Parameters)

 CALL FUNCTION lv_fm_name
   EXPORTING
     output_options             = ls_params1
*    USER_SETTINGS              =
     it_text                    = gt_data_tab
   IMPORTING
     document_output_info       = ls_document_output_info
     job_output_info            = ls_job_output_info
     job_output_options         = ls_job_output_options
   EXCEPTIONS
     formatting_error           = 1
     internal_error             = 2
     send_error                 = 3
     user_canceled              = 4
     OTHERS                     = 5.

 IF sy-subrc <> 0.
   MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
 ENDIF.