Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

smartforms output in HTML format

Former Member
0 Likes
530

Hi Experts,

I want to save my smartforms in HTML format.Is there any Standard programe is available for it.

Like as RSTXPDFT4 for converting output in PDF format.

1 REPLY 1
Read only

Clemenss
Active Contributor
0 Likes
430

Hi Rakesh,

you can use smartforms to create HTML output directly:

form send_smartform_html_email
tables et_return type bapiret2_t
receivers structure somlreci1 "receivers
using iv_smartform type tdsfname
send_partner type bu_partner "from address
mail_subject type so_obj_des.


  data: control_parameters type ssfctrlop,
  output_options type ssfcompop,
  document_output_info type ssfcrespd,
  job_output_info type ssfcrescl,
  job_output_options type ssfcresop,
  xsfparam_line type ssfxsfp,
  p_html type trfresult,
  p_graphics type tsf_xsf_gr,
  form_name type rs38l_fnam. " generated function


  data: wa_return type bapiret2.
  data: v_receiver type ad_smtpadr.
* "CLI20061030
  data: ls_orderadm_h type crmt_output_orderadm_h_com.
  select single * into corresponding fields of ls_orderadm_h
    from crmd_orderadm_h
    where object_id = p_zzma.


*SET SMARTFORM OUTPUT OPTIONS
  output_options-tdnoprev = 'X'.                            "#EC NOTEXT
  output_options-xsfcmode = 'X'.                            "#EC NOTEXT
  output_options-xsf = 'X'.                                 "#EC NOTEXT
  output_options-xsfoutmode = 'A'.                          "#EC NOTEXT
  output_options-xsfformat = 'X'.                           "#EC NOTEXT
  output_options-xsfaction = 'http://www.ashland.com'.
  clear output_options-xsfoutdev.


  xsfparam_line-name = 'GRAPHICS'.                          "#EC NOTEXT
  xsfparam_line-value = 'EXTRACT'.                          "#EC NOTEXT
  append xsfparam_line to output_options-xsfpars.


  xsfparam_line-name = 'GRAPHICS-DIRECTORY'.                "#EC NOTEXT
  xsfparam_line-value = c_gr_dir.
  append xsfparam_line to output_options-xsfpars.


  xsfparam_line-name = 'CONTENT-ID'.                        "#EC NOTEXT
  xsfparam_line-value = 'ENABLE'.                           "#EC NOTEXT
  append xsfparam_line to output_options-xsfpars.


* SILENT MODE ON
  output_options-tdimmed = space.
  output_options-tdnewid = space.
  control_parameters-no_dialog = 'X'.                       "#EC NOTEXT


* Get the generated function name of the smartform
  call function 'SSF_FUNCTION_MODULE_NAME'                  "#EC NOTEXT
    exporting
      formname = iv_smartform
    importing
      fm_name = form_name
    exceptions
      no_form = 1
      no_function_module = 2
    others = 3.
  if sy-subrc <> 0.
* Error receiving the generated function module
    clear wa_return.
    message e398 with iv_smartform into wa_return-message.
    wa_return-type = 'E'.                                   "#EC NOTEXT
    insert wa_return into table et_return.
    exit.
  endif.


* Get the smartform content
  call function form_name
    exporting
      control_parameters   = control_parameters
      output_options       = output_options
      orderadm_h           = ls_orderadm_h
    importing
      document_output_info = document_output_info
      job_output_info      = job_output_info
      job_output_options   = job_output_options
    exceptions
      formatting_error
      =1
      internal_error
      =2
      send_error
      =3
      user_canceled        = 4.


  if sy-subrc <> 0.
* FAILED TO GET CONTENT FROM SMARTFORM
    clear wa_return.
    message e398 with form_name sy-subrc into wa_return-message.
    insert wa_return into table et_return.
    exit.
  endif.


  p_html = job_output_info-xmloutput-trfresult.
  p_graphics[] = job_output_info-xmloutput-xsfgr[].

...

This is taken from Pavan Bayyapu's fantastic and still existing August 2005 blog [Sending HTML Email from SAP CRM/ERP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2273] [original link is broken] [original link is broken] [original link is broken];

Regards,

Clemens