Smartforms demo

data l_work type ypm_st_pmord.
* Language
  g_control-langu = sy-langu.     "Language
* Printer dialog
  if s_diag = 'X'.
    g_control-no_dialog = ' '.
  else.
    g_control-no_dialog = 'X'.
  endif.
* Print options
  g_output-tddest     = s_print.   "Printer name
  g_output-tdcopies   = s_copy.    "Number of copies
  g_control-preview   = s_prev.    "Preview
  g_output-tdimmed    = s_pnow.    "Print immediately.
  g_output-tdnewid    = s_spol.    "New spool request


call function 'SSF_FUNCTION_MODULE_NAME'
       EXPORTING
            formname           = 'YPM_DIMMING'
       IMPORTING
            fm_name            = g_f_name
       EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            others             = 3.
  if sy-subrc = 1.
    message e300 with 'Form '                                 "#EC NOTEXT
                      'YPM_DIMMING '
                      'Not found!'.                           "#EC NOTEXT
  endif.
  if sy-subrc = 2.
    message e300 with 'Function module for form '             "#EC NOTEXT
                      'YPM_DIMMING '
                      'Not found!'.                           "#EC NOTEXT
  endif.
  if sy-subrc = 3.
    message e300 with 'Error calling function '               "#EC NOTEXT
                      'SSF_FUNCTION_MODULE_NAME'.
  endif.
*
endform.                    " set_smartform_controls
*&---------------------------------------------------------------------*
*&      Form  call_smartforms
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form call_smartforms.
  g_control-langu = a_spras.                                " C01
* Call smartform
  call function g_f_name
   exporting
     control_parameters         = g_control
     output_options             = g_output
     user_settings              = ' '
*     is_dimming                = Ypms_dimming
   importing
*   DOCUMENT_OUTPUT_INFO       =
     job_output_info            = g_jobinfo
*   JOB_OUTPUT_OPTIONS         =
    tables
    ypm_equip                  = gi_equip
    ypm_pmord                  = gi_pmord
    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.
  if g_jobinfo-tdnewid <> space.
    message i200 with
    'New spool request created'.            "#EC NOTEXT

  elseif g_jobinfo-outputdone <> space.
    message i300 with
    'PM Order '                             "#EC NOTEXT
    'Printed, OK'.                          "#EC NOTEXT
  endif.

Comments

Popular posts from this blog

Export data to xls using OOPS

Factory method ALV sap abap

Delete Selected Record in ALV Report