Control Parameters, Output Options, User Settings in Smartforms

  • When we execute our smartform, we get a popup screen,



  • We need to pass output device and then we click on print preview option.

  • Now, Suppose user wants us that I don’t want to see this screen, I simply want my smartform to get execute rather than showing this popup screen.


Solution :-

  • Step 1 :- Create a executable program in ABAP Editor.

  • Step 2 :- Use SSF_FUNCTION_MODULE_NAME to get the name of the function module for our smartform.



  • Step 3 :- Call the function module of the smartform and pass the employee id as input paramater.



  • Step 4 :- We have a control parameter in the import section of our function module.



    • IF we go into this structure



    • We have these three important parameters which we can use.

      • We can pass no dialog as true so that screen will not appear.
      • Also we can pass preview as true.
    • Also in import parameter, we have output options



      • In the structure we have a field name output options which we can use for passing the output device name.
  • Step 5 :- So, we will create a structure for the same and pass the required details into the control parameters and output options.



  • Step 6 ➖

    Note :-

    • We also need to make USER_SETTING as false to see these changes take place.
    • Once we pass USER_SETTING as false, SAP will not use the built in feature, It will take what we will pass.

Code :-

*&---------------------------------------------------------------------*
*& Report ZAR_CONTROL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZAR_CONTROL.

DATA : lv_form type RS38L_FNAM.

PARAMETERS : p_emp_id type ZAR_EMPLOYEE_ID.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZAR_SMARTFORM_IMAGE'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
 IMPORTING
   FM_NAME                  = lv_form
 EXCEPTIONS
   NO_FORM                  = 1
   NO_FUNCTION_MODULE       = 2
   OTHERS                   = 3
          .

DATA : ls_control type SSFCTRLOP.
ls_control-NO_DIALOG = 'X'.
ls_control-PREVIEW = 'X'.

DATA : ls_output type SSFCOMPOP.
ls_output-tddest = 'LP01'.

CALL FUNCTION lv_form
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
   CONTROL_PARAMETERS         = ls_control
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
   OUTPUT_OPTIONS             = ls_output
   USER_SETTINGS              = ' '
    p_emp_id                   = p_emp_id
* 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
          .

Execute the Code :-



Comments

Popular posts from this blog

Understanding Different Types of SAP Function Modules: Normal, RFC, and Update

Unlocking SAP ABAP Secrets: Interactive Classical Reports with GET CURSOR, At User Command, and a Comparison of HIDE Statements

Mastering ABAP: A Step-by-Step Guide to Function Modules and Groups for Modularized Programming