Integrating the Smart Form into the Application

Prerequisites

You defined the form interface in your form and activated the form.

Context

You trigger form printing by calling as few as two function modules. The first module uses the name of the form to determine the name of the generated function module. Then you call this module.

Procedure


  1. In the Form Builder call the function Start of the navigation pathEnvironment Next navigation step NameEnd of the navigation path of the function module and use Ctrl-Y and Ctrl-C to copy its name.

  2. In the application program define a variable of type RS38L_FNAM for the name of the generated function module:

    data fm_name type RS38L_FNAM.
                   
  3. If desired, you can call the function module SSF_FIELD_LIST. It returns a list of the form parameters actually used in the form. You can use this information to limit data selection, if necessary.

  4. Call function module SSF_FUNCTION_MODULE_NAME. It returns the name of the generated function module:

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
                    FORMNAME        = '<Formularname>'
            IMPORTING
                    FM_NAME         = fm_name
            EXCEPTIONS
                    NO_FORM         = 1
                    NO_FUNCTION_MODULE = 2
                    OTHERS          = 3.
    
    IF SY-SUBRC <> 0.
            <Fehlerbehandlung>
    ENDIF.
                   
  5. Call the generated function module. To do this, use the Insert Statement function for CALL FUNCTION in the ABAP Editor and use the name you copied in step 1 (to avoid having to copy all interface parameters manually). Then replace the function module name with the variable fm_name defined in step 2.

    CALL FUNCTION fm_name
      EXPORTING
    *       ARCHIVE_INDEX   = 
    *       ARCHIVE_PARAMETERS =
    *       CONTROL_PARAMETERS =
    *       MAIL_APPL_OBJ   =
    *       MAIL_RECIPIENT  =
    *       MAIL_SENDER     =
    *       OUTPUT_OPTIONS  =
    *       USER_SETTINGS   = 'X'
            G_CARRID        = <Variable>
            G_CONNID        = <Variable> 
            G_FLDATE        = <Variable>
    * IMPORTING
    *       DOCUMENT_OUTPUT_INFO    =
    *       JOB_OUTPUT_INFO         =
    *       JOB_OUTPUT_OPTIONS      =
      TABLES
            GT_SBOOK        = <interne Tabelle>
      EXCEPTIONS
            FORMATTING_ERROR = 1
            INTERNAL_ERROR  = 2
            SEND_ERROR      = 3
            USER_CANCELED   = 4
            OTHERS          = 5.
    
    IF SY-SUBRC <> 0.
            <Fehlerbehandlung>
    ENDIF.
                   
  6. In the interface, pass all data you want to transfer to the form.

Results

The generated function module processes the form logic defined in the Smart Form. Its output is sent to spool processing.

As long as you do not change the form interface, you can make any changes to the form. When you activate it again, the system generates the current version of the form as soon as you call the function module. Only if you change the form interface, you must adapt the interface in the application program.