Skip to Content

How to suppress pop-up print window for smartforms

Hi,

When executing a smartform's function module to get the OTFDATA only, is there any way that we can suppress the pop-up print window (this window prompts the user for the print device and has the buttons, "Print Preview" and "Print" -- shown below)?

My codes are written as below, but the pop-up print window still keeps on appearing - I need this to be suppressed.

Appreciate any help here. Thanks.

* Determine GV_FM_NAME by first executing the FM, SSF_FUNCTION_MODULE_NAME.

CLEAR gwa_bil_invoice.

CALL FUNCTION 'LB_BIL_INV_OUTP_READ_PRTDATA'

  EXPORTING

    if_bil_number         = gwa_nast-objky

    if_parvw              = gwa_nast-parvw

    if_parnr              = gwa_nast-parnr

    if_language           = gwa_nast-spras

    is_print_data_to_read = gwa_print_data_to_read

  IMPORTING

    es_bil_invoice        = gwa_bil_invoice

  EXCEPTIONS

    records_not_found     = 1

    records_not_requested = 2

    OTHERS                = 3.

IF sy-subrc = 0.

  CLEAR gwa_job_info.

  gwa_control-no_dialog = 'X'.

  gwa_control-preview   = 'X'.

  gwa_control-getotf    = 'X'.

  CALL FUNCTION gv_fm_name

    EXPORTING

      control_parameters = gwa_control

      user_settings      = c_true

      is_bil_invoice     = gwa_bil_invoice

      is_nast            = gwa_nast

      is_repeat          = space

      copy_count         = '1'

    IMPORTING

      job_output_info    = gwa_job_info

    EXCEPTIONS

      formatting_error   = 1

      internal_error     = 2

      send_error         = 3

      user_canceled      = 4

      OTHERS             = 5.

  IF sy-subrc = 0.

  ENDIF.

ENDIF.


print.png (14.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    Oct 26, 2015 at 03:03 PM

    Just pass "user_settings" as space.

    Thanks,

    Juwin

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks, Rudra. This finally worked.

      I assigned GWA_COMPOSER = 'LOCL' in my codes, and the codes looks like this:-

                  CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'

                    EXPORTING

                      pi_nast       = gwa_nast

                      pi_country    = gv_land

                      pi_addr_key   = gwa_addr_key

                      pi_repid      = sy-repid

                      pi_screen     = 'X'

                    IMPORTING

                      pe_returncode = gv_returncode

                      pe_itcpo      = gwa_itcpo

                      pe_device     = gv_device

                      pe_recipient  = gwa_recipient

                      pe_sender     = gwa_sender.

      *            MOVE-CORRESPONDING gwa_itcpo TO gwa_composer.

                  gwa_control-no_dialog = c_true.

                  gwa_control-langu     = gwa_nast-spras.

                  gwa_control-getotf    = c_true.

                  gwa_composer-tddest = 'LOCL'.

                  CALL FUNCTION gv_fm_name

                    EXPORTING

                      control_parameters = gwa_control

                      output_options     = gwa_composer

                      user_settings      = space

                      is_bil_invoice     = gwa_bil_invoice

                      is_nast            = gwa_nast

                      is_repeat          = space

                      copy_count         = '1'

                    IMPORTING

                      job_output_info    = gwa_job_info

                    EXCEPTIONS

                      formatting_error   = 1

                      internal_error     = 2

                      send_error         = 3

                      user_canceled      = 4

                      OTHERS             = 5.

                  IF sy-subrc = 0.

                  ENDIF.

      Here, the print windows did get suppressed even though the default output device for the user settings is blank in SU3. Also, more importantly, the GWA_JOB_INFO-OTFDATA was populated.

  • Oct 22, 2015 at 02:18 PM

    Hello

    You need define a device(default) in your SAP user by transaction SU01

    Regards

    Gregory

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 21, 2015 at 01:10 PM

    Hi,

    You need to pass the DEVICE field in gwa_control. and pass the OUTPUT_OPTION while calling the smartform correctly.

    Check the standard program RLB_INVOICE.( Include : RLB_PRINT_FORMS Line 81 )

    The code that I took from the standard program

    CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'

         EXPORTING

           PI_NAST       = NAST

           PI_COUNTRY    = IS_DLV-LAND

           PI_ADDR_KEY   = IS_ADDR_KEY

           PI_REPID      = LF_REPID

           PI_SCREEN     = XSCREEN

         IMPORTING

           PE_RETURNCODE = CF_RETCODE

           PE_ITCPO      = LS_ITCPO

           PE_DEVICE     = LF_DEVICE

           PE_RECIPIENT  = CS_RECIPIENT

           PE_SENDER     = CS_SENDER.

       IF CF_RETCODE = 0.

         MOVE-CORRESPONDING LS_ITCPO TO CS_COMPOSER_PARAM.

    *   CS_CONTROL_PARAM-NO_OPEN

    *   CS_CONTROL_PARAM-NO_CLOSE

         CS_CONTROL_PARAM-DEVICE      = LF_DEVICE.

         CS_CONTROL_PARAM-NO_DIALOG   = 'X'.

         CS_CONTROL_PARAM-PREVIEW     = XSCREEN.

         CS_CONTROL_PARAM-GETOTF      = LS_ITCPO-TDGETOTF.

         CS_CONTROL_PARAM-LANGU       = NAST-SPRAS.


    R

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 21, 2015 at 01:26 PM

    gwa_control-device = 'LOCL'


    i hope you have LOCL / LP01 as a local printer in your system

    Add comment
    10|10000 characters needed characters exceeded

    • I tried this, but it still didn't work. 😔

      I've also placed DEVICE = 'MAIL', but it didn't work -- the print window was suppressed, but no OTFDATA could be generated.

  • Oct 21, 2015 at 02:33 PM

    Try to pass required print parameters (mandatory fields in the popup) in output_options (so start with output device, you could get some of those values from a call of GET_PRINT_PARAMETERS with NO_DIALOG set)

    Regards,

    Raymond

    Add comment
    10|10000 characters needed characters exceeded

    • You must pass a printer identification as most print requires a driver so a printer (mandatory) to identify type of printer, if none defined in current user profile, use a generic printer (Look for with SPAD transaction) don't use alocal printer as LOCL as it may (so will) generate errors in background.

      Regards,

      Raymond

  • Oct 22, 2015 at 03:59 AM

    Hi,

    This is a code fragment from:

    The case of sending mail with graphs . | SCN

    I can see that the PREVIEW field is not used .

    FORM mail_1_prep_5

      CHANGING

        ob_document_bcs TYPE REF TO cl_document_bcs .

      DATA: customer    TYPE  scustom .

      DATA: bookings    TYPE  ty_bookings .

      DATA: connections TYPE  ty_connections   .

      DATA: formname TYPE tdsfname .

      DATA: fm_name     TYPE rs38l_fnam .

      formname = p_fname .

      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.

      IF sy-subrc NE 0 .

        RETURN .

      ENDIF .

      DATA: st_control_parameters TYPE ssfctrlop .

      DATA: st_output_options     TYPE ssfcompop .

      DATA: st_job_output_info    TYPE ssfcrescl .

      st_control_parameters-no_dialog = abap_true .

      st_control_parameters-getotf    = abap_true .

      CALL FUNCTION fm_name

        EXPORTING

          control_parameters = st_control_parameters

          output_options     = st_output_options

          customer           = customer

          bookings           = bookings

          connections        = connections

        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 EQ 4 .

        RETURN .

      ENDIF .

      IF sy-subrc NE 0.

        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      DATA: bin_file TYPE xstring .

      DATA: it_lines_dummy TYPE tline_tab .

      DATA: bin_filesize TYPE i .

      CALL FUNCTION 'CONVERT_OTF'

        EXPORTING

          format                = 'PDF'

        IMPORTING

          bin_file              = bin_file

          bin_filesize          = bin_filesize

        TABLES

          otf                   = st_job_output_info-otfdata

          lines                 = it_lines_dummy

        EXCEPTIONS

          err_max_linewidth     = 1

          err_format            = 2

          err_conv_not_possible = 3

          err_bad_otf           = 4

          OTHERS                = 5.

      DATA: it_solix TYPE solix_tab .

      CALL METHOD cl_bcs_convert=>xstring_to_solix

        EXPORTING

          iv_xstring = bin_file

        RECEIVING

          et_solix   = it_solix.

      DATA: attachment_subject TYPE so_obj_des .

      MESSAGE s000(oo) WITH 'attachment PDF hex' space INTO attachment_subject .

      TRY.

          CALL METHOD ob_document_bcs->add_attachment

            EXPORTING

              i_attachment_type    = 'pdf'

              i_attachment_subject = attachment_subject

              i_att_content_hex    = it_solix.

        CATCH cx_document_bcs .

      ENDTRY.

    ENDFORM .                    "mail_1_prep_5

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2015 at 12:25 PM

    Hi Deborah,

    use below code.

    data: control TYPE ssfctrlop,

    control_parameters TYPE ssfctrlop.

      control-preview   = ' '.

      control-no_open   = 'X'.

      control-no_close  = 'X'.

      control-no_dialog = 'X'.

      control-device    = p_pid.

      control_parameters-no_dialog = 'X'.

      control_parameters-no_open   = 'X'.

      control_parameters-no_close  = 'X'.

      output_options-tddest    = p_pid.

    CALL FUNCTION 'SSF_OPEN'

        EXPORTING

          output_options     = output_options

          control_parameters = control_parameters

          control            = control

          user_settings      = ' '

        EXCEPTIONS

          formatting_error   = 1

          internal_error     = 2

          send_error         = 3

          user_canceled      = 4

          OTHERS             = 5.

      IF sy-subrc <> 0.

        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

        EXIT.

      ENDIF.

    Add comment
    10|10000 characters needed characters exceeded