cancel
Showing results for 
Search instead for 
Did you mean: 

To send smartform output in an email without attachment

Former Member
0 Kudos

Hi All,

How to send smartform output in an email without attachment?

Thanks & Regards,

Mamta Gupta.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Try this,

DATA:

ls_control_param TYPE ssfctrlop, "Control paramters

ls_output_options TYPE ssfcompop. "Output options

DATA:

lv_ip_mailaddr TYPE so_name, "Address of a Mail Recipient

lv_ip_type_id TYPE so_escape, "Recipient type

ls_recipient_id TYPE swotobjid, "Structure for recvr obj ID

ls_sender_id TYPE swotobjid. "Structure for sender obj id

CONSTANTS:

lc_ip_type_id TYPE so_escape VALUE 'U', "For internet address.

lc_smartform TYPE tdsfname VALUE 'ZVSF_ASN_DELNOTE', "Smart form name

lc_mail TYPE tddevice VALUE 'MAIL'. "Mail device

  • Assign recipient

lv_ip_mailaddr = gv_smtp_addr. "CSAM email id

lv_ip_type_id = lc_ip_type_id. "External address

  • Create Mail title

CONCATENATE text-001

nast-objky

INTO ls_output_options-tdtitle.

  • Create recipient object

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

ip_mailaddr = lv_ip_mailaddr

ip_type_id = lv_ip_type_id

IMPORTING

ep_recipient_id = ls_recipient_id

EXCEPTIONS

invalid_recipient = 1

OTHERS = 2.

IF sy-subrc 0.

cf_retcode = sy-subrc.

PERFORM protocol_update.

ENDIF.

  • Get sender object id.

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = ls_sender_id

EXCEPTIONS

invalid_sender = 1

OTHERS = 2.

IF sy-subrc 0.

cf_retcode = sy-subrc.

PERFORM protocol_update.

ENDIF.

  • Assign the smart form name

w_ssfname = lc_smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = w_ssfname

IMPORTING

fm_name = lf_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc 0.

cf_retcode = sy-subrc.

PERFORM protocol_update.

ENDIF.

  • For Print output:

IF nast-nacha = '1'. "Print output

ls_control_param-preview = 'X'.

ls_control_param-no_dialog = 'X'.

ENDIF.

  • For Email output.

IF nast-nacha = '2'. "Email

Output options

ls_output_options-tdteleland = gs_kna1-land1.

ls_output_options-tdtelenum = gs_kna1-telfx.

ls_output_options-tdfaxuser = sy-uname.

ls_output_options-BCS_COMMIT = 'X'.

ls_control_param-device = lc_mail.

ENDIF.

  • dynamically call Fm behind the Smart form

CALL FUNCTION lf_fm_name

EXPORTING

control_parameters = ls_control_param

mail_recipient = ls_recipient_id

mail_sender = ls_sender_id

output_options = ls_output_options

user_settings = ' '

TABLES

delivery = gt_delivery

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc 0.

cf_retcode = sy-subrc.

PERFORM protocol_update.

ENDIF.

Regards,

Joan

Former Member
0 Kudos

hi mamta,

may be u can use the FM SO_NEW_DOCUMENT_SEND_API1

it will send the document created directly

I have checked its documention and it specifies that way only so ir will work

hope it helps !!

regards,

prashanti

Edited by: prashanti k on Jan 20, 2009 7:12 PM

Former Member
0 Kudos

can use the FM SO_NEW_DOCUMENT_SEND_API1

and pass the objpack-doc_type = 'RAW'. without attachement...

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 10.

objpack-body_num = tab_lines.

objpack-doc_type = 'RAW'.

APPEND objpack.

Former Member
0 Kudos
Former Member
0 Kudos

Hi madhu,

The code given in the wiki u specified sends smartform output as an attachment.

@mamta.

Just give a try by using

SO_NEW_DOCUMENT_SEND_API1

I have not tested it.

Edited by: kartik tarla on Jan 20, 2009 7:08 PM