Skip to Content

Faxing a SmartForm

I need information on how to fax a smartform. I have looked in the SAP Press "SAP Smart Forms" and searched SDN, as well as Google, and I couldn't come up with anything. It seems as though the search on SDN isn't working at all today.

If anybody has information regarding telefax as the output type with SmartForms I would appreciate it. I have tried it and it looks like everything is done correctly but when I run the form and check SOST, nothing is in there.

Regards,

Davis

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 25, 2007 at 08:47 PM

    Hi Davis,

    Please check this weblog ... perhaps it may help to start with.

    /people/erwan.lebrun/blog/2007/04/16/tips-tricks-email-fax-through-the-same-output-type

    Regards,

    Ferry Lianto

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Lundi Vox

      Hi Davis,

      Plz include this code in ur print program and see the SOST after the execution with the output type as FAX.

      if nast-Nacha = 2

      • Populate the Fax Number and the country.

      Data : lv_fax_tp TYPE so_escape VALUE 'F',

      lv_fax = t_ctrl_app-recipient.

      lv_land1 = t_ctrl_app-country.

      • Create the Recipient Object

      CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

      EXPORTING

      ip_country = lv_land1

      ip_faxno = lv_fax

      ip_type_id = lv_fax_tp

      IMPORTING

      ep_recipient_id = w_recipient

      EXCEPTIONS

      invalid_recipient = 1

      OTHERS = 2.

      IF sy-subrc NE 0.

      IF write_out = 'X'.

      FORMAT COLOR 6.

      WRITE AT /5 text-004.

      ENDIF.

      RAISE other.

      ENDIF.

      • Create The Sender Object

      CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

      EXPORTING

      ip_sender = sy-uname

      IMPORTING

      ep_sender_id = w_sender

      EXCEPTIONS

      invalid_sender = 1

      OTHERS = 2.

      IF sy-subrc NE 0.

      IF write_out = 'X'.

      FORMAT COLOR 6.

      WRITE AT /5 text-003.

      ENDIF.

      RAISE other.

      ENDIF.

      • Populate the Control Data

      w_sf_control-device = 'TELEFAX'.

      w_sf_control-no_dialog = 'X'.

      w_sf_control-langu = t_ctrl_app-spras.

      • Populate the Output Options.

      w_output_options-tdteleland = lv_land1.

      w_output_options-tdtelenum = lv_fax.

      w_output_options-faxformat = 'PS'.

      endif.

  • avatar image
    Former Member
    Jun 26, 2007 at 01:48 AM

    Hi Davis,

    post your fax coding here.let me check what goes wrong.Are you using FM convert_otf_and_fax.

    thanks,

    Madhu

    Add comment
    10|10000 characters needed characters exceeded

    • Here is the code I am curently using. I am not post all of it but I am only posting the relevant code. I realize that it isn't written the best but it was the best I could do in a short amount of time. Get_Com is run and then SmartForm_Print is run:

      *---------------------------------------------------------------------*
      *       FORM get_comm                                               *
      *---------------------------------------------------------------------*
      *---------------------------------------------------------------------*
      *  -->  US_SCREEN  Output on screen                                   *
      *                  ' ' = printer                                      *
      *                  'X' = screen                                       *
      *  -->  US_COUNTRY County for telecommunication and SET COUNTRY       *
      *---------------------------------------------------------------------*
      
      FORM get_comm USING us_screen us_country.
        DATA: lvs_itcpo         TYPE   itcpo,
              lvf_device(30)    TYPE   c,
              lvf_dialog(1)     TYPE   c   VALUE ' ',
              lvs_recipient     LIKE   swotobjid,
              lvs_sender        LIKE   swotobjid,
              lvs_snast         TYPE   snast,
              lvf_program       LIKE   sy-repid,
              lvs_comm_type     TYPE   ad_comm,
              lvs_comm_values   TYPE   szadr_comm_values.
      
      
      * reset return code
        retcode = 0.
      
      
      * if there is a communication strategy used ...
        IF NOT nast-tcode IS INITIAL.
      
      *   ... use stratagy to get communication type
          CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
               EXPORTING
                    strategy           = nast-tcode
      *             ADDRESS_TYPE       =
      *             ADDRESS_NUMBER     = VBDKA-ADRNR
      *             PERSON_NUMBER      = VBDKA-ADRNP
                    address_number     = addr_key-addrnumber
                    person_number      = addr_key-persnumber
               IMPORTING
                    comm_type          = lvs_comm_type
                    comm_values        = lvs_comm_values
      *        TABLES
      *             STRATEGY_TABLE     =
               EXCEPTIONS
                    address_not_exist  = 1
                    person_not_exist   = 2
                    no_comm_type_found = 3
                    internal_error     = 4
                    parameter_error    = 5
                    OTHERS             = 6.
          IF sy-subrc <> 0.
            retcode = sy-subrc.
            syst-msgty = 'E'.
            PERFORM protocol_update.
          ENDIF.
      
        ENDIF.
      
      
      * convert communication data
        MOVE-CORRESPONDING nast TO lvs_snast.
        MOVE sy-repid           TO lvf_program.
        CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
             EXPORTING
                  pi_comm_type              = lvs_comm_type
                  pi_comm_values            = lvs_comm_values
                  pi_screen                 = us_screen
      *           PI_NEWID                  =
                  pi_country                = us_country
                  pi_repid                  = lvf_program
                  pi_snast                  = lvs_snast
             IMPORTING
                  pe_itcpo                  = lvs_itcpo
                  pe_device                 = lvf_device
                  pe_mail_recipient         = lvs_recipient
                  pe_mail_sender            = lvs_sender
             EXCEPTIONS
                  comm_type_not_supported   = 1
                  recipient_creation_failed = 2
                  sender_creation_failed    = 3
                  OTHERS                    = 4.
        IF sy-subrc <> 0.
          retcode = sy-subrc.
          syst-msgty = 'E'.
          PERFORM protocol_update.
        ENDIF.
      
        CHECK retcode EQ 0.
      
      * if there is no communication type
        IF  lvs_comm_type IS INITIAL.
      *   set device
          CASE nast-nacha.
            WHEN '1'.
              lvf_device = 'PRINTER'.
            WHEN '2'.
              lvf_device = 'TELEFAX'.
              lvs_itcpo-tdtelenum = nast-telfx.
              IF nast-tland IS INITIAL.
                lvs_itcpo-tdteleland = us_country.
              ELSE.
                lvs_itcpo-tdteleland = nast-tland.
              ENDIF.
              lvs_itcpo-tdsenddate = nast-vsdat.
              lvs_itcpo-tdsendtime = nast-vsura.
              lvs_itcpo-tdfaxuser  = nast-usnam.
            WHEN '3'.
              lvf_device = 'TELETEX'.
              lvs_itcpo-tdtelenum = nast-teltx.
              IF nast-tland IS INITIAL.
                lvs_itcpo-tdteleland = us_country.
              ELSE.
                lvs_itcpo-tdteleland = nast-tland.
              ENDIF.
              lvs_itcpo-tdsenddate = nast-vsdat.
              lvs_itcpo-tdsendtime = nast-vsura.
            WHEN '4'.
              lvf_device = 'TELEX'.
              lvs_itcpo-tdtelenum = nast-telx1.
              IF nast-tland IS INITIAL.
                lvs_itcpo-tdteleland = us_country.
              ELSE.
                lvs_itcpo-tdteleland = nast-tland.
              ENDIF.
              lvs_itcpo-tdsenddate = nast-vsdat.
              lvs_itcpo-tdsendtime = nast-vsura.
            WHEN OTHERS.
              lvf_device = 'PRINTER'.
          ENDCASE.
        ENDIF.
      
      * fill structure itcpo
        itcpo = lvs_itcpo.
        SET COUNTRY us_country.
      *  include rvadopfo.
      
      ENDFORM.                    "get_comm

      *&---------------------------------------------------------------------*
      *&      Form  smartform_print
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *      -->P_RETCODE  text
      *      -->P_PROC_SCREEN  text
      *----------------------------------------------------------------------*
      FORM smartform_print  USING    p_retcode
                                     p_proc_screen.
      
        DATA: lf_fm_name            TYPE rs38l_fnam.
        DATA: ls_control_param      TYPE ssfctrlop.
        DATA: ls_composer_param     TYPE ssfcompop.
        DATA: ls_recipient          TYPE swotobjid.
        DATA: ls_sender             TYPE swotobjid.
        DATA: lf_formname           TYPE tdsfname.
        DATA: ls_addr_key           LIKE addr_key.
      
        PERFORM set_print_param USING    ls_addr_key
                                CHANGING ls_control_param
                                         ls_composer_param
                                         ls_recipient
                                         ls_sender
                                         retcode.
      *Get the Smart Form name.
      
        IF vbdkl-vkorg = '0035'.         "DYNAIR ONLY
          IF w_regio = 'QC'.      "QUEBEC
            tnapr-fonam = 'ZPCC_PACKLST_FR'.
          ENDIF.
        ELSE.
          IF NOT tnapr-sform IS INITIAL.
            lf_formname = tnapr-sform.
          ELSE.
            MESSAGE e001(/smb40/ssfcomposer).
          ENDIF.
        ENDIF.
      
      * determine smartform function module for invoice
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
             EXPORTING  formname           = lf_formname
      *                 variant            = ' '
      *                 direct_call        = ' '
             IMPORTING  fm_name            = lf_fm_name
             EXCEPTIONS no_form            = 1
                        no_function_module = 2
                        OTHERS             = 3.
        IF sy-subrc <> 0.
      *   error handling
          retcode = sy-subrc.
          IF sy-subrc = 1.
            MESSAGE e001(/smb40/ssfcomposer).
          ENDIF.
          IF sy-subrc = 2.
            MESSAGE e002(/smb40/ssfcomposer).
          ENDIF.
          PERFORM protocol_update.
        ENDIF.
      
      
        CALL FUNCTION lf_fm_name
          EXPORTING
             archive_index              = toa_dara
      *   ARCHIVE_INDEX_TAB          =
             archive_parameters         = arc_params
             control_parameters         = ls_control_param
      *   MAIL_APPL_OBJ              =
             mail_recipient             = ls_recipient
             mail_sender                = ls_sender
             output_options             = ls_composer_param
             user_settings              = ' '
             vbdkl                      = vbdkl
             kna1                       = kna1
             nast                       = nast
             tvst                       = tvst
             vbco3                      = vbco3
             lfa1                       = lfa1
             likp                       = likp
             vbdpl                      = vbdpl
             tvko                       = tvko
             w_regio                    = w_regio
            TABLES
             tvbdpl                     = tvbdpl
      * IMPORTING
      *   DOCUMENT_OUTPUT_INFO       =
      *   JOB_OUTPUT_INFO            =
      *   JOB_OUTPUT_OPTIONS         =
      EXCEPTIONS
       formatting_error           = 1
       internal_error             = 2
       send_error                 = 3
       user_canceled              = 4
       OTHERS                     = 5.
      
       COMMIT WORK.
        IF sy-subrc <> 0.
          retcode = sy-subrc.
          PERFORM protocol_update.
      * get SmartForm protocoll and store it in the NAST protocoll
          PERFORM add_smfrm_prot.
        ENDIF.
      
      ENDFORM.                    "SMARTFORM_PRINT
      

      Regards,

      Davis