Calling Smartform from Driver Program

 

 T-code:SMARTFORMS

 Design your smart from to display Sales Order Details

1.Enter parameters in Form Interface

Create Global structure(Use for Work areas) and Table Type for Internal tables.

 

2.Enter Global Definitions

Driver Program  :

T-code:SE38

*&---------------------------------------------------------------------*
*& Report ZSD_SF_TEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zsd_sf_test.
tables:vbak.
DATA:lr_vbak TYPE zssd_vbak_01,
     lt_vbap TYPE TABLE OF zssd_vbap_01.
DATA: lf_fun_name TYPE rs38l_fnam.
DATA: lr_contr TYPE ssfctrlop,
      lr_outpr TYPE ssfcompop.

PARAMETERS:p_vbeln type vbak-vbeln DEFAULT '60'.

*Fetch data
SELECT SINGLE vbeln,
              erdat,
              erzet,
              ernam,
              vbtyp
  FROM vbak
  INTO @lr_vbak
  WHERE vbeln = @p_vbeln.
IF sy-subrc = 0.
  SELECT vbeln,
         posnr,
         netwr,
         waerk
    FROM vbap
    INTO TABLE @lt_vbap
    WHERE vbeln = @lr_vbak-vbeln.
ENDIF.

*Fetch Function Module
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'ZVB_SO_SF'
  IMPORTING
    fm_name            = lf_fun_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    OTHERS             = 3.

lr_contr-no_dialog = 'X'.
lr_contr-preview   = 'X'.

lr_outpr-tddest    = 'LP01'.   "O/p Device

*Calling FM of Smart Form
CALL FUNCTION lf_fun_name
  EXPORTING
    control_parameters = lr_contr
    output_options     = lr_outpr
    user_settings      = ' '        "To pass O/P device
    p_vbeln            = p_vbeln
    lr_vbak            = lr_vbak
    lt_vbap            = lt_vbap
  EXCEPTIONS
    formatting_error   = 1
    internal_error     = 2
    send_error         = 3
    user_canceled      = 4
    OTHERS             = 5.

Output:


Comments

Popular posts from this blog

CDS Views: Table Functions with Example

Passing Dynamic Variables to SO10 TEXT

Adobe Form/PDF Form Introduction