Function Module in SmartForm

Hellow experts,
Here i have one Function Module like ZSAMPLE1.
I want to display it output in SmartForm.
What should I do for this. Pls help me.
with regards
babu

Hi look this code it will use ful to u
report  zpsr3m_invoice_coversheet  no standard page heading
                                      message-id zps.
tables: proj,
        prps,
        vbrk,
        vbrp,
        bseg,
        likp,
        pa0105,
        pa0002,
        t001,
        adrc,
        konv,
        tvzbt.
-{ Type Definitions } -
types: begin of typ_prps,
         pspnr  like  prps-pspnr,
       end of typ_prps,
       begin of typ_aufnr,
         aufnr  like  afko-aufnr,
       end of typ_aufnr,
       begin of typ_vbeln,
         vbeln  like  vbrk-vbeln,
       end of typ_vbeln,
       begin of typ_konv,
         knumv  like  konv-knumv,
         kposn  like  konv-kposn,
         kwert  like  konv-kwert,
       end of typ_konv.
-{ Internal Tables } -
data: gt_invitems like standard table of zpss_rrbinv_items
                  with header line,
      gt_pspnr     type standard table of typ_prps
                  with header line,
      gt_aufnr    type standard table of typ_aufnr
                  with header line,
      gt_vbeln    type standard table of typ_vbeln
                  with header line,
      gt_konv     type standard table of typ_konv
                  with header line.
data: gt_mess_att like solisti1 occurs 0 with header line.
-{ Work Areas } -
data: gst_invheader like zpss_rrbinv_header,
      begin of gwa_bseg,
        bukrs like bseg-bukrs,
        belnr like bseg-belnr,
        gjahr like bseg-gjahr,
        txdat like bseg-txdat,
        filkd like bseg-filkd,
      end of   gwa_bseg.
data: gst_control_parameters type ssfctrlop,
      gst_output_options     type ssfcompop,
      gt_job_output_info     type ssfcrescl,
      gt_output_options      type ssfcresop.
constants: gc_formname type tdsfname value 'ZPS_INVOICE_COVERSHEET1',
         gc_usrty    like pa0105-usrty value '0001'.
data: gv_fm_name  type rs38l_fnam,
      gv_pernr    like pa0105-pernr,
      gv_uname    like sy-uname.
ranges: gr_pspnr for prps-pspnr,
        gr_aufnr for afko-aufnr.
-{ Selection - Screen } -
selection-screen begin of block blk1 with frame title text-001.
parameters: gp_pspid like proj-pspid memory id psp,
            gp_vbeln like vbrk-vbeln.
selection-screen end of block blk1.
selection-screen begin of block blk2 with frame title text-002.
parameters: gp_layut type tdsfname , "LIKE vbrp-arktx ,     "DEVK933900
           gp_logo  like rstxt-tdname default 'RRB_KBR_COLOR' .
selection-screen end of block blk2.
selection-screen begin of block blk3 with frame title text-009.
parameters: gp_norm radiobutton group r1 default 'X',
            gp_pdf  radiobutton group r1 .
selection-screen end of block blk3.
-{AT SELECTION-SCREEN } -
at selection-screen on gp_pspid.
  if gp_pspid is not initial.
    perform f_validate_project.
ELSE.
   MESSAGE E000 WITH
   'Enter any Project definition...'(006).
  endif.
at selection-screen on gp_vbeln.
  if gp_vbeln is not initial.
    perform f_validate_billing_doc.
  else.
    message e000 with
    'Enter Invoice Number.....'(005).
  endif.
at selection-screen output.
  gp_pspid = gp_pspid.
at selection-screen on value-request for gp_logo.
  perform f_get_logo changing gp_logo.
at selection-screen on value-request for gp_vbeln.
  perform f_get_invoice changing gp_vbeln.
-{ START-OF-SELECTION } -
start-of-selection.
Get the other data for the form.
  perform f_get_other_invoice_details.
Call the SMART FORM to print the invoice.
  perform f_print_invoice_covsheet.
*&      Form  F_GET_LOGO
      To get the Invoice LOGO to print in the SMART FORMS
     <--EV_LOGO  text
form f_get_logo  changing ev_logo.
  ev_logo = 'RRB_KBR_COLOR'.
endform.                    " F_GET_LOGO
*&      Form  F_VALIDATE_PROJECT
      To validate the project definition entered
form f_validate_project .
  select single *
    from proj
   where pspid = gp_pspid.
  if sy-subrc ne 0.
    message e000 with
    'Project definition not found..........'(003).
  endif.
endform.                    " F_VALIDATE_PROJECT
*&      Form  f_validate_billing_doc
      To validate the Billing document
form f_validate_billing_doc .
Get all the project elements
  perform f_get_project_data.
  if gp_pspid is not initial.
    if gr_pspnr[] is not initial or
       gr_aufnr[] is not initial.
Check the billing document is from the current project only.
      select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
      vrkme
        into table gt_invitems
        from vbrp
       where vbeln eq gp_vbeln
         and ( ps_psp_pnr in gr_pspnr or
               aufnr      in gr_aufnr ).
      if sy-subrc eq 0.
        select single vbeln bstnk_vf zterm stceg
                      bukrs waerk belnr gjahr
                      ernam knumv kunrg fkdat
          into (gst_invheader-vbeln,
                gst_invheader-bstnk_vf,
                gst_invheader-zterm,
                gst_invheader-stceg,
                gwa_bseg-bukrs,
                gst_invheader-waerk,
                gwa_bseg-belnr,
                gwa_bseg-gjahr,
                vbrk-ernam,
                vbrk-knumv,
                gst_invheader-kunrg,
                vbrk-fkdat)
           from vbrk
          where vbeln = gp_vbeln.
      else.
        message e037 with gp_pspid.
Invoice does not belong to any WBS/Netowrk of the project:
      endif.
    endif.
  else.
    select single vbeln bstnk_vf zterm stceg
                  bukrs waerk belnr gjahr
                  ernam knumv kunrg fkdat
      into (gst_invheader-vbeln,
            gst_invheader-bstnk_vf,
            gst_invheader-zterm,
            gst_invheader-stceg,
            gwa_bseg-bukrs,
            gst_invheader-waerk,
            gwa_bseg-belnr,
            gwa_bseg-gjahr,
            vbrk-ernam,
            vbrk-knumv,
            gst_invheader-kunrg,
            vbrk-fkdat)
       from vbrk
      where vbeln = gp_vbeln.
  endif.
endform.                    " f_validate_billing_doc
*&      Form  f_get_project_data
      text
form f_get_project_data .
  clear: gt_pspnr, gt_pspnr[],
         gt_aufnr, gt_aufnr[],
         gr_pspnr, gr_pspnr[],
         gr_aufnr, gr_aufnr[].
Get the project
  if gp_pspid is initial.
    get parameter id 'PSP' field gp_pspid.
  endif.
  check gp_pspid is not initial.
  select single *
    from proj
   where pspid = gp_pspid.
First get all the wbs elements of the project
  select pspnr
    into table gt_pspnr
    from prps
   where psphi = proj-pspnr.
  if sy-subrc eq 0.
    loop at gt_pspnr.
      gr_pspnr-sign = 'I'.
      gr_pspnr-option = 'EQ'.
      gr_pspnr-low    = gt_pspnr-pspnr.
      append gr_pspnr.
    endloop.
  endif.
Get all the networks.
  select distinct aufnr
    into table gt_aufnr
    from caufv
   where pronr eq proj-pspnr.
  if sy-subrc eq 0.
    loop at gt_aufnr.
      gr_aufnr-sign   = 'I'.
      gr_aufnr-option = 'EQ'.
      gr_aufnr-low    = gt_aufnr-aufnr.
      append gr_aufnr.
    endloop.
  endif.
endform.                    " f_get_project_data
*&      Form  f_get_invoice
      text
     <--EV_VBELN  text
form f_get_invoice  changing ev_vbeln.
  data: lv_fieldname like help_info-fieldname,
        lv_tabname   like help_info-tabname,
        lv_value     like help_info-fldvalue,
        lv_index     like sy-tabix.
  data: lt_fields like help_value occurs 0 with header line,
        lt_dynpread like dynpread occurs 0 with header line.
  lt_dynpread-fieldname = 'GP_PSPID'.
  append lt_dynpread.
Read the screen input first.
  call function 'DYNP_VALUES_READ'
    exporting
      dyname               = sy-repid
      dynumb               = sy-dynnr
    tables
      dynpfields           = lt_dynpread
    exceptions
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      others               = 11.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    read table lt_dynpread with key fieldname = 'GP_PSPID'.
    if sy-subrc eq 0.
      gp_pspid = lt_dynpread-fieldvalue.
    endif.
  endif.
  if gp_pspid is not initial.
Get the project data first
    perform f_get_project_data.
Get the invoice list now.
    if gr_pspnr[] is not initial.
      select distinct vbeln
        into table gt_vbeln
        from vbrp
       where ps_psp_pnr in gr_pspnr.
    endif.
    if gr_aufnr[] is not initial.
      select distinct vbeln
        appending table gt_vbeln
        from vbrp
       where aufnr      in gr_aufnr .
    endif.
  else.
    select vbeln
      into table gt_vbeln
      from vbrk.
  endif.
  if gt_vbeln[] is not initial.
    lt_fields-tabname     = lv_tabname   = 'VBRK'.
    lt_fields-fieldname   = lv_fieldname = 'VBELN'.
    lt_fields-selectflag  = 'X'.
    append lt_fields.
    call function 'HELP_VALUES_GET_NO_DD_NAME'
      exporting
        cucol                        = '5'
        curow                        = '5'
        selectfield                  = lv_fieldname
        titel                        = text-008 "'Select Any Value'
      importing
        ind                          = lv_index
        select_value                 = lv_value
      tables
        fields                       = lt_fields
        full_table                   = gt_vbeln
      exceptions
        full_table_empty             = 1
        no_tablestructure_given      = 2
        no_tablefields_in_dictionary = 3
        more_then_one_selectfield    = 4
        no_selectfield               = 5
        others                       = 6.
    if sy-subrc <> 0.
      message s000 with
      'No Invoices found for the project definition..'(007).
    else.
      clear gt_vbeln.
      read table gt_vbeln index lv_index.
      ev_vbeln = gt_vbeln-vbeln.
    endif.
  else.
    message s000 with
      'No Invoices found for the project definition..'(007).
  endif.
endform.                    " f_get_invoice
*&      Form  F_PRINT_INVOICE_COVSHEET
      text
form f_print_invoice_covsheet .
Call the function module to get the name of the
function module name which will be generated dynamically for
the layout
  call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
     formname           = gc_formname
       formname          = gp_layut
    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.
Set up the output options for the smart form
  clear gst_output_options.
GST_OUTPUT_OPTIONS-tddest   = sy-pdest.
  gst_output_options-tddest   = 'FWIN'.             "Frontend printer
  gst_output_options-tdnewid  = sy-prnew.
  gst_output_options-tdimmed  = 'X'.
  gst_output_options-tddelete = sy-prrel.
  clear gst_control_parameters.
Setup to generate OTF internal table
  gst_control_parameters-no_dialog = 'X'.
  gst_control_parameters-getotf    = 'X'.
  gst_control_parameters-preview   = 'X'.       "Deactivate preview!
  if gp_norm is not initial.
Call the original function module.
    call function gv_fm_name
      exporting
        inv_header       = gst_invheader
      tables
        inv_data         = gt_invitems
      exceptions
        formatting_error = 1
        internal_error   = 2
        send_error       = 3
        user_canceled    = 4.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
  else.
Call the original function module.
    call function gv_fm_name
      exporting
        control_parameters = gst_control_parameters
        output_options     = gst_output_options
        inv_header         = gst_invheader
      importing
        job_output_info    = gt_job_output_info
        job_output_options = gt_output_options
      tables
        inv_data           = gt_invitems
      exceptions
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
Display PDF Preview Screen
    perform pdf_preview     using    gt_job_output_info-otfdata.
  endif.
endform.                    " F_PRINT_INVOICE_COVSHEET
*&      Form  f_get_other_invoice_details
      text
form f_get_other_invoice_details .
  data: lv_index     like sy-tabix,
        lwa_invitems like gt_invitems.
  data: lt_invitems  like gt_invitems occurs 0 with header line,
        lt_invitems1 like gt_invitems occurs 0 with header line.
Get the prepared by person name.
  if gst_invheader-ernam is not initial.
    select single pernr
      into pa0105-pernr
      from pa0105
     where usrty = gc_usrty
       and usrid = gst_invheader-ernam.
    select nachn vorna
      up to 1 rows
      into (pa0002-nachn, pa0002-vorna)
      from pa0002
     where pernr = pa0105-pernr.
    endselect.
    condense: pa0002-nachn, pa0002-vorna.
    concatenate  pa0002-nachn          pa0002-vorna
           into  gst_invheader-ernam
   separated by  space.
  endif.
Get logo
  move gp_logo to gst_invheader-logo.
Write the date as required.
  if vbrk-fkdat is not initial and
     vbrk-fkdat ne '00000000'.
    perform f_write_date changing gst_invheader-txdat.
  endif.
Get the description for Payment terms
  select single *
    from tvzbt
   where spras eq sy-langu
     and zterm eq gst_invheader-zterm.
  if sy-subrc eq 0.
    condense: tvzbt-vtext, gst_invheader-zterm.
    concatenate gst_invheader-zterm '-' tvzbt-vtext
           into gst_invheader-zterm.
  endif.
Get the billing address.
  select adrnr
    up to 1 rows
    into gst_invheader-adrnr
    from vbpa
   where vbeln = gst_invheader-vbeln
     and parvw = 'RE'.
  endselect.
  if sy-subrc ne 0.
    message i000 with
    'Billing Party address of Customer is not maintained..'(009).
    stop.
  endif.
Get the company code address (Registered Address).
  select single adrnr
    into t001-adrnr
    from t001
   where bukrs = gwa_bseg-bukrs.
  if sy-subrc eq 0.
    select name1 street city1 post_code1
           region country
           up to 1 rows
      into (adrc-name1, adrc-street, adrc-city1, adrc-post_code1,
            adrc-region, adrc-country)
      from adrc
     where addrnumber = t001-adrnr
       and date_from le sy-datum.
    endselect.
    if sy-subrc eq 0.
      condense: adrc-name1, adrc-street, adrc-city1,
                adrc-post_code1, adrc-region, adrc-country.
      concatenate adrc-name1 ',  ' adrc-street
             into gst_invheader-zzregoff_line1.
      concatenate adrc-city1 ',  '  adrc-region ',  '
                  adrc-country ' ' adrc-post_code1
             into gst_invheader-zzregoff_line2.
    endif.
  endif.
  gv_uname = vbrk-ernam.
Get the Prepared by Person name.
  call function 'CRIF_GET_EMPLOYEE_FOR_USER'       "just like this
    exporting
      user_name               = gv_uname
      begindate               = sy-datum
      enddate                 = sy-datum
    importing
      employeenumber          = gv_pernr
    exceptions
      no_employeenumber_found = 1
      subtype_not_available   = 2
      others                  = 3.
  if sy-subrc eq 0.
    select single *
      from pa0002
     where pernr = gv_pernr
      and begda le sy-datum
      and endda ge sy-datum.
    concatenate pa0002-vorna pa0002-nachn into
                gst_invheader-ernam separated by space.
  endif.
Get the  Invoice items
  if gt_invitems[] is initial.
    select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
      into table gt_invitems
      from vbrp
     where vbeln eq gp_vbeln.
    if sy-subrc eq 0.
      sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 arktx matnr.
    endif.
  endif.
Get the VAT on the billing items through condition
type 'MWST'.
  if gt_invitems[] is not initial.
    select knumv kposn kwert
      into table gt_konv
      from konv
      for all entries in gt_invitems
     where knumv = vbrk-knumv
       and kposn = gt_invitems-posnr
       and kschl = 'MWST'.
    if sy-subrc eq 0.
Now loop through the condition value table and modify the invoice item
table.
      sort gt_konv by knumv kposn.
      loop at gt_invitems.
        lv_index = sy-tabix.
        read table gt_konv with key knumv = vbrk-knumv
                                    kposn = gt_invitems-posnr
                                    binary search.
        if sy-subrc eq 0.
          gt_invitems-kwert = gt_konv-kwert.
          modify gt_invitems index lv_index transporting kwert.
        endif.
        lt_invitems = gt_invitems.
        at end of arktx.
          sum.
          move: gt_invitems-netwr to lt_invitems-netwr,
                gt_invitems-kwert to lt_invitems-kwert.
          collect lt_invitems.
        endat.
      endloop.
Take the summarized table for display in the output.
      clear gt_invitems[].
      gt_invitems[] = lt_invitems[].
      clear lt_invitems[].
      free lt_invitems[].
    else.
      loop at gt_invitems.
        lt_invitems = gt_invitems.
        clear: lt_invitems-vbeln, lt_invitems-posnr.
        at end of arktx.
          sum.
          move: gt_invitems-netwr to lt_invitems-netwr,
                gt_invitems-kwert to lt_invitems-kwert.
          collect lt_invitems.
        endat.
      endloop.
Take the summarized table for display in the output.
      clear gt_invitems[].
      gt_invitems[] = lt_invitems[].
      clear lt_invitems[].
      free lt_invitems[].
    endif.
sort the table.
    lt_invitems1[] = gt_invitems[].
    delete lt_invitems1 where mvgr1 ne space or
                              mvgr2 ne space or
                              mvgr3 ne space or
                              mvgr4 ne space or
                              mvgr5 ne space.
    delete gt_invitems where mvgr1 = space and
                             mvgr2 = space and
                             mvgr3 = space and
                             mvgr4 = space and
                             mvgr5 = space.
    sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5.
Now, construct the output table with mat grp descriptions
    loop at gt_invitems.
      lwa_invitems = gt_invitems.
      clear: lt_invitems-arktx,
             lt_invitems-netwr,
             lt_invitems-kwert.
Material group 1
      at new mvgr1.
        if lwa_invitems-mvgr1 is not initial.
          select single bezei from tvm1t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr1 = lwa_invitems-mvgr1.
          append lt_invitems.
        endif.
      endat.
Material group 2
      clear: lt_invitems-arktx,
             lt_invitems-netwr,
             lt_invitems-kwert.
      at end of mvgr2.
        if lwa_invitems-mvgr2 is not initial.
          select single bezei from tvm2t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr2 = lwa_invitems-mvgr2.
          if lt_invitems-mvgr3 is initial and
             lt_invitems-mvgr4 is initial and
             lt_invitems-mvgr5 is initial.
            sum.
            move: gt_invitems-netwr to lt_invitems-netwr,
                  gt_invitems-kwert to lt_invitems-kwert.
          endif.
          concatenate '->' lt_invitems-arktx into lt_invitems-arktx.
          append lt_invitems.
        endif.
      endat.
Material group 3
      clear: lt_invitems-arktx,
             lt_invitems-netwr,
             lt_invitems-kwert.
      at end of mvgr3.
        if lwa_invitems-mvgr3 is not initial.
          select single bezei from tvm3t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr3 = lwa_invitems-mvgr3.
          if lt_invitems-mvgr4 is initial and
             lt_invitems-mvgr5 is initial.
            sum.
            move: gt_invitems-netwr to lt_invitems-netwr,
                  gt_invitems-kwert to lt_invitems-kwert.
          endif.
          concatenate '-->' lt_invitems-arktx into lt_invitems-arktx.
          append lt_invitems.
        endif.
      endat.
Material group 4
      clear: lt_invitems-arktx,
             lt_invitems-netwr,
             lt_invitems-kwert.
      at end of mvgr4.
        if lwa_invitems-mvgr4 is not initial.
          select single bezei from tvm4t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr4 = lwa_invitems-mvgr4.
          if lt_invitems-mvgr5 is initial.
            sum.
            move: gt_invitems-netwr to lt_invitems-netwr,
                  gt_invitems-kwert to lt_invitems-kwert.
          endif.
          concatenate '--->' lt_invitems-arktx into lt_invitems-arktx.
          append lt_invitems.
        endif.
      endat.
Material group 5
      clear: lt_invitems-arktx,
             lt_invitems-netwr,
             lt_invitems-kwert.
      at end of mvgr5.
        if lwa_invitems-mvgr5 is not initial.
          select single bezei from tvm5t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr5 = lwa_invitems-mvgr5.
          sum.
          move: gt_invitems-netwr to lt_invitems-netwr,
                gt_invitems-kwert to lt_invitems-kwert.
          concatenate '---->' lt_invitems-arktx into lt_invitems-arktx.
          append lt_invitems.
        endif.
      endat.
Material group 1
      at end of mvgr1.
        if lwa_invitems-mvgr1 is not initial.
          select single bezei from tvm1t into lt_invitems-arktx
           where spras = sy-langu
             and mvgr1 = lwa_invitems-mvgr1.
          concatenate 'Total ' lt_invitems-arktx into lt_invitems-arktx
                           separated by space.
          if lt_invitems-mvgr2 is initial and
             lt_invitems-mvgr3 is initial and
             lt_invitems-mvgr4 is initial and
             lt_invitems-mvgr5 is initial.
            sum.
            move: gt_invitems-netwr to lt_invitems-netwr,
                  gt_invitems-kwert to lt_invitems-kwert.
          endif.
          append lt_invitems.
        endif.
      endat.
    endloop.
Now keep all the records with non material groups.
    sort lt_invitems1 by arktx.
    loop at lt_invitems1.
      lwa_invitems = lt_invitems1.
      at end of arktx.
        lt_invitems = lwa_invitems.
        sum.
        move: lt_invitems1-netwr to lt_invitems-netwr,
              lt_invitems1-kwert to lt_invitems-kwert.
        append lt_invitems.
      endat.
    endloop.
  endif.
Take the summarized table for display in the output.
if gp_layut <> 'ZPS_INVOICE_COVERSHEET3'.
  clear gt_invitems[].
  gt_invitems[] = lt_invitems[].
  clear lt_invitems[].
  free lt_invitems[].
endif.
endform.                    " f_get_other_invoice_details
Form:  pdf_preview
Desc:  Preview PDF Debit/Credit memo
form pdf_preview  using      iv_otfdata    type tsfotf.
PREVIEW PDF Credit Memo
  call function 'SSFCOMP_PDF_PREVIEW'
    exporting
      i_otf                    = iv_otfdata
    exceptions
      convert_otf_to_pdf_error = 1
      cntl_error               = 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.
endform.                    "pdf_preview
*&      Form  f_write_date
      To write the date in format
     <--CV_date  date
form f_write_date  changing cv_date.
  data: lv_date like sy-datum.
  lv_date = vbrk-fkdat.
  clear cv_date.
  case lv_date+4(2).
    when '01'.
      write '-Jan-' to cv_date.
    when '02'.
      write '-Feb-' to cv_date.
    when '03'.
      write '-Mar-' to cv_date.
    when '04'.
      write '-Apr-' to cv_date.
    when '05'.
      write '-May-' to cv_date.
    when '06'.
      write '-Jun-' to cv_date.
    when '07'.
      write '-Jul-' to cv_date.
    when '08'.
      write '-Aug-' to cv_date.
    when '09'.
      write '-Sep-' to cv_date.
    when '10'.
      write '-Oct-' to cv_date.
    when '11'.
      write '-Nov-' to cv_date.
    when '12'.
      write '-Dec-' to cv_date.
  endcase.
  condense cv_date.
  concatenate lv_date6(2) cv_date lv_date0(4)
         into cv_date.
endform.                    " f_write_date
thanks
suresh

Similar Messages

  • HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM

    PLEASE ANYONE TELL ME, ABOUT  HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM. IT IS VERY URGENT!!!!!!!!!1

    Hi,
      Under Global Definitions, we have 'Form Routines' tab. Under this tab, u can have a dynamic subroutine call. With in FORM and ENDFORM, you can call the Function Module.With in the Program Lines editor, u can define the subroutine........PERFORM. 
    If helpful, reward points.
    Rgds,
    CK

  • Call Function not Generating Function Module for Smartform

    Hi Gurus,
    We have a work copy print program use to print deliveries (smartforms). This program works fine in Production but right now we are doing some testing and I found out that when we run this program in QUALITY environtment, it shortdumps with error saying "Function Module Not Found"
    Basically when it gets to the Function Module "SSF_FUNCTION_MODULE_NAME", it could not generate any function module for the form it Sy-Subrc = 2 Exception meaning NO_FUNCTION_MODULE.
    The problem is this only happens in our QUALITY environment.I compare the function module in the 2 systems, there was not diff as this is a Standard SAP module. I passed diff smartforms we have in QUALITY through the FM and it will not generating any FM for any of them. So this is not an error from the smartforms, bcos all the same smartforms generates FM in Prod.
    So what I did next is to Debug the FM "SSF_FUNCTION_MODULE_NAME" in the 2 systems to see where the diff is coming from. I noticed 2 views that the FM is using, they are STXFADM and D010SINF . So on the Production system, STXFADM-LASTDATE and D010SINF-UDAT fields are the same value, so it generates the FM. On the QUALITY systems, the values are different hence it skips the code to generate the FM.
    Thanks Guys.
    Points will greatly be awarded for this.

    Please guys, help me look into this, I really need a solution fast.
    Thanks

  • Printing options in parameters of function module of smartforms

    HI experts,
    i hav a loop inside driver program where for every loop it calls smartform and the printing is continuous. But can any one help me how to control this by not displaying LPD. So that directly i can see the preview after all loop passes
    Advanced
    thanks
    Krish

    Hi,
    In this I suggest you to capture the data in the OTF format adn append the details after every LOOP pass and finally after ENDLOOP. Now use this OTF data to display the details in PDF where you have option to save the details and Print the form details.
    Pass the below variable as 'X' in the control parameters of the Smartform.
    ssfctrlop-getotf = 'X'.
    Now capture the OTF data return from the Smartform Function Module in the Importing Parameter "job_output_info" as shown below.
    data : wa_otf          TYPE ssfcrescl,
              it_otf type standard table of ssfcrescl with header  line.
    *ssfctrlop-getotf* = 'X'.
    Loop you Internal_table.
    *--Call the Smartform Function Module for Displaying the Details
        CALL FUNCTION lv_fname
          EXPORTING
            control_parameters = wa_ssfctrlop
            output_options     = wa_ssfcompop
            user_settings      = k_space1
            wa_output          = p_details
          IMPORTING
            job_output_info    = wa_otf
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
    append wa_otf to it_otf.
    Endloop.
    *--To display the Smartform the PDF format where thr Printing the Form
    *--can be done
          CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
            TABLES
              otf_table = it_otf-otfdata.

  • Smartform function module

    HI,
      is it same development client smartform function module (meane when we execute the smartform) and test client smartform function module?pls help me?
    regrds,
    dhanan

    HI,
    We have two function modules in smartforms,
    One is when we activate the smartform it iwll give at runtime which will encapsulate all the attributes of that particular smartform we cant run the smartform in different client if we use that function module.
    Second One is We have one more function module is there which is main SSF_FUNCTION_MODULE_NAME
    output of this function module is another function module. we can run the program in any client if we use this function module

  • How to print the texts retrived by using READ_TEXT fun module in Smartform

    Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
    I have coded all things in the program lines and in that i am retriveing the long texts.
    I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text.
    I have to print the trouble ticket. in that the notes log I have to pass.
    its urgent. Points will be rewarded for any type of clue. whether it will work or not.

    There are a few ways to do it. If you need to take all of the text in the text type, in your SF text element choose "Include Text".
    Populate the fields with the data that corresponds to the text type. It is similar to the interface to the FM "Read_Text.
    Text Name
    Text Obje
    Text ID 
    Language
    Encase any variables with the "&" symbol.
    If you have already coded the call to the FM "READ_TEXT" and loaded the text into an internal table, create a loop and loop through the itab. Inside of the loop create a text element and add a variable in the text element for the field you are looking to output.

  • How to print text rertrived by using the READ_TEXT fun module in smartform

    Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
    I have coded all things in the program lines and in that i am retriveing the long texts.
    I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text module.
    its urgent. Points will be rewarded for any type of clue. whether it will work or not.

    loop the table into which u have retrieved the text .
    in the form interface of the smartform ... in importing parameter give the that table name .
    and in smartform whereever u want to print there insert the data into work area and pass to fields for dispaly .
    decalre ur work area in global defintions
    thnaks .

  • No function module has been generated  , when transported to quality ?

    Hi People,
    I created a zsmartform and transported to quality,  but when i checked the function module of smartform in quality its saying ' No function module has been generated yet '  but the smartform is in active status . when i tried to activate it again the program jus running and not getting activated ?
    Thanks,
    Siva

    Ok.
    I am not sure, If this would work . But, would like you to try the below solution can get back:
    1. IN the Development Server, take the FM name...from SMARTFORMS tcode for a particular smartform...by entering the smartfom..then Environment-->Function Module Name.
    2.Now, give the name in SE37 tcode and then in the Menu> Function Module> Release--> Release..
    Now, after releasing it..check If the smartform is able to get activated in Quality Server.
    Revert Back with the result.
    VIshwa.

  • How can I debug a Function Module used by smartforms

    Hello everyone,
    i have a problem with the function module /1BCDWB/SF00000040.
    It's a module executed from a smartforms form. I need to debug this
    function module while printing an invoice. While printing it should jump
    to the place of the function module.
    Would be grateful if someone could help me.
    Best regards
    F. Hoppe

    This is exactly what i have done last time.
    The problem is that the breakpoint does not stay at the same place
    when i activate it in the module itself.
    Isn't there a transaction you can put breakpoints specific to a FM?

  • How to use parameters in smartform genrated  function module

    i executed smartform one functional module is genrated  '/1BCDWB/SF00000002'
    now the problem is that  i want to send  output of this smartform through email
    now how to use ' MAIL_RECIPIENT   '      and  ' MAIL_SENDER   ' to send smartform output through email .
    please check following module which generated by smartform.
    plz suggest me  .
    CALL FUNCTION '/1BCDWB/SF00000002'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        ITAB_PA0001                =   ITAB_PA0001
    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.

    Hi
    You can do it while passing these parameters in the CONTROL_PARAMETERS.
    data: ls_CONTROL_PARAMETERS type SSFCTRLOP.
    ls_CONTROL_PARAMETERS-DEVICE  = 'LOCL'.
    ls_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
    ls_CONTROL_PARAMETERS-PREVIEW = ' '.
    Pass this ls_CONTROL_PARAMETERS to the importing parameter of the FM .
         CALL FUNCTION LF_FM_NAME
               EXPORTING
                          CONTROL_PARAMETERS   = LS_CONTROL_PARAM
    In addition to this, you might also want to set the print immediately field on the same structure to 'X'.
    Generally you leave the device field empty, the user master record default printer will be used

  • Can you call a function module from within a smartform?

    I was told that yu can not call a function module from a smartform - that does not make sense to me because you can do tons of ABAP within a smartform.
    Well - can you?
    Thanks.
    Scott

    Yes, you can call function modules.

  • SEND_ERROR in the SMARTFORM function module

    Hi All,
    I want to send the PO via e-mai as attached PDF file. It is working fine in DEV. But in PRD i am getting SEND_ERROR in the SMARTFORM function module.
    can any one hep me to fix this????
    CALL FUNCTION fm_name
        EXPORTING
          archive_index      = toa_dara
          archive_parameters = arc_params
          control_parameters = ssfctrlop
          output_options     = ls_composer_param
          user_settings      = 'X'
          nast               = nast
          zxekko             = zxekko
          zxpekko            = zxpekko
        IMPORTING
          job_output_info    = job_output_info
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
    Rgds,
    Rajesh.

    Hi,
    Go to se37,enter ur generated function module name .
    Put a brkpoint at first executable statement of that FM.
    If u run ur program,then it will stop.
    Then put brk point on SSRFT_READ_ERROR(From menu).
    after press f8,u will know what is the reason of ur error.
    and check thjis also
    http://wiki.sdn.sap.com/wiki/display/Snippets/Unique+Driver+Program+for+any+smartform+of+a+transaction
    Try like this.
    Thanks
    Gourav.

  • SmartForm Function Module not generated in Production

    Hi
    I have a smartform in DEV(Box A). It works fine. I trasnsported it to PROD(Box B). It appears as Active state in PROD. But there is no Function module generated for this smartform. As a result my program dumps in PROD.
    I am running it on 4.6C Release.
    Any suggestions ?
    Murali.

    Hi again,
    1.  I dont find any Function Module name under ENVIRONMENT -
    > FUNCTION MODULE NAME
    Click on
    FUNCTION MODULE NAME
    and it will give a pop-up window
    displaying the FM name.
    2. If its not there,
       then u can do 3 things :
      a) in prd server, activate the smart form again.
       (this will generate the FM)
      b) try to transport a new request,
        for the same smartform.
      c) ask basis team to check the LOG
        of this transport request.
      (whether any error / warning was there in the
       transport log)
       From this log, if any warning/error is there,
       then we can come to know, that there is some problem.
    regards,
    amit m.

  • Regarding Smartform Function module

    Hi,
    When i am executing the smartform function module via print program, Smart form output is displaying properly but it is not showing any OTF data in the importing parameter  JOB_OUTPUT_INFO . (JOB_OUTPUT_INFO-OTFDATA). Why it is happening? Could you please help me in this regard?

    To get the OTF data you need to set the GETOTF parameter in the Control Parameters of the Smartforms.
        DATA: LS_CONTROL  TYPE SSFCTRLOP.  " Controlling info
        LS_CONTROL-GETOTF    = 'X'.
        CALL FUNCTION WF_FM
          EXPORTING
            CONTROL_PARAMETERS         = LS_CONTROL
         IMPORTING
            JOB_OUTPUT_INFO            = WF_OUTDATA
    I guess, when we set the GETOTF flag, it will not generate the output and only puts the data JOB_OUTPUT_INFO-OTFDATA.
    Regards,
    Naimesh Patel

  • Function module for converting sap script to smartforms?

    hi ,
       wat is the name of  function module for converting sap script to smartforms?
    regard's
    Deepak sharma

    Hi,
    No function module is there..
    But go to T-code..Smartforms and in the menubar..
    Utilities-->Migration->Import SApScript Form.
    U can thus migrate SAPScipt to smartforms...
    How ever a lot of changes have to be done in the migrated one,,
    Regards

Maybe you are looking for