Smartform : Disable Print Preview Button in Print Dialog

To disable print preview button in print dialog of smartform, just set the TDNOPREV flag of OUTPUT_OPTIONS of the smartform function module.

*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: gv_formname TYPE tdsfname VALUE 'ZZDEMO',
      gv_fm_name  TYPE rs38l_fnam.
DATA: gwa_ssfcompop TYPE ssfcompop.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Get the function module name using form name
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = gv_formname
    IMPORTING
      fm_name            = gv_fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*Disable print preview
  gwa_ssfcompop-tdnoprev = 'X' .

*Trigger the smartform
  CALL FUNCTION gv_fm_name
    EXPORTING
      output_options   = gwa_ssfcompop
    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.
  ENDIF.

smartforms-disable-print-preview-button

To disable the print button in print dialog of smartform, just set the TDNOPRINT flag of OUTPUT_OPTIONS of the smartform function module.

*Disable print button
  gwa_ssfcompop-tdnoprint = 'X'.

smartforms-disable-print-button


Be the first to comment

Leave a Reply

Your email address will not be published.


*