cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform - Output by email

Former Member
0 Kudos

Hi all,

Requirement:

I wnat to send the output of the smatfrom thruogh email.

May be we can do it by doing the required settings in SCOT w/o wrting any code.

Query:

What I want to know is the details about the specific things that I need to do in SCOT.

Please be very specific.

Thanks and Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can do it via SCOT (configuration needed) but you also need a piece of code attached.

Configuration part:

You need to create an output type via NACE with the transmission medium set as "External send". Pass also your print program name and smartform name. The communication strategy should be "CS01".

Code needed in print program:

CONSTANTS: lc_type TYPE c VALUE 'U'.

DATA: lv_recipient TYPE swotobjid,

lv_sender TYPE swotobjid.

"FM to pass mail address

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

ip_mailaddr = "add email address here

ip_type_id = lc_type

IMPORTING

ep_recipient_id = lv_recipient

EXCEPTIONS

invalid_recipient = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

"To send the mail to the recipeint

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = lv_sender

EXCEPTIONS

invalid_sender = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

DATA: BEGIN OF wa_sofmfol_key,

foldertype LIKE sofm-foltp,

folderyear LIKE sofm-folyr,

foldernumber LIKE sofm-folno,

type LIKE sofm-doctp,

year LIKE sofm-docyr,

number LIKE sofm-docno,

forwarder LIKE soub-usrnam,

END OF wa_sofmfol_key,

folder TYPE swc_object,

bor_key LIKE swotobjid-objkey,

lv_mail_app_obj TYPE swotobjid.

CONSTANTS: lc_fol LIKE sofm-doctp VALUE 'FOL',

lc_sofmfol(7) TYPE c VALUE 'SOFMFOL' .

SELECT *

FROM soud UP TO 1 ROWS

WHERE sapnam LIKE sy-uname

AND deleted = ' '.

ENDSELECT.

IF sy-subrc NE 0.

CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'

EXPORTING

sapname = sy-uname

EXCEPTIONS

no_insert = 1

sap_name_exist = 2

x_error = 3

OTHERS = 4.

IF sy-subrc NE 0.

CLEAR soud.

ELSE.

SELECT *

FROM soud UP TO 1 ROWS

WHERE sapnam LIKE sy-uname

AND deleted = ' '.

ENDSELECT.

IF sy-subrc EQ 0.

"do nothing

ENDIF.

ENDIF.

ENDIF.

CLEAR wa_sofmfol_key.

wa_sofmfol_key-type = lc_fol.

wa_sofmfol_key-year = soud-inbyr.

wa_sofmfol_key-number = soud-inbno.

bor_key = wa_sofmfol_key.

IF NOT bor_key IS INITIAL.

swc_create_object folder lc_sofmfol bor_key.

IF sy-subrc = 0.

swc_object_to_persistent folder lv_mail_app_obj.

IF sy-subrc NE 0.

CLEAR lv_mail_app_obj.

ENDIF.

ENDIF.

ELSE.

CLEAR lv_mail_app_obj.

ENDIF.

Finally call your smartform as usual via FM SSF_FUNCTION_MODULE_NAME. The smartform will be sent as attachment thru mail.

Regards,

Zaheed

Former Member
0 Kudos

Thanks Zaheed. Can you provide some more details abuot the configurations required in SCOT.

You can mail me at soumen.dutta@tatatea.co.in/soumen.dutta@tcs.com

Thanks and Regards,

Soumen