cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform EMAIL functionality

radhushankar
Participant
0 Kudos

Hi all,

I have developed a smartform as well the driver program of my own for invoice output which is used to trigger the smartform output through fb03 transaction.

Based on the user option in the output type if the email functionality is selected it needs to send out an email.

Can any one give me some idea how to make the email functionality??? is there is any standard routine available so that we can use the same in the z version?

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

For getting the E-mail Functionality .

Please follows this order.

1st Call this Function Module 'SSF_FUNCTION_MODULE_NAME'

  • get SF function module from

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

2nd Call

the Print form using this Function Module v_function_name.

Check this Condidion -

if nast-nacha = 1.

  • print form.

CALL FUNCTION v_function_name

IF sy-subrc = 0.

  • email the form out put to the user

PERFORM mail_users TABLES tbl_lines.

ENDIF.

endif.

Please Create a Distribution Module Using SO23 T-code.

c_dist_list LIKE somlreci1-receiver VALUE 'XXXXXXXXXX',

DATA: tbl_lines TYPE TABLE OF tline WITH HEADER LINE.

Data: tbl_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE.

  • Sap Inbox Address

tbl_receivers-receiver = sy-uname.

tbl_receivers-rec_type = 'B'.

APPEND tbl_receivers.

CLEAR tbl_receivers.

  • Internet address

select single * from usr21 where bname = sy-uname.

if sy-subrc eq 0.

select single * from adr6 where addrnumber = usr21-addrnumber

and persnumber = usr21-persnumber.

if sy-subrc eq 0 and adr6-smtp_addr ne space.

tbl_receivers-receiver = adr6-smtp_addr.

tbl_receivers-rec_type = 'U'.

APPEND tbl_receivers.

CLEAR tbl_receivers.

endif.

endif.

  • List of Receivers

  • Shared Distribution List.

tbl_receivers-receiver = c_dist_list. "Dis list

tbl_receivers-rec_type = 'C'.

APPEND tbl_receivers.

CLEAR tbl_receivers.

For sending Mail Please use this Function Module.'SO_DOCUMENT_SEND_API1'

And Passed the all value.

  • send mail.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

I thing U can do this and it will help u.

Former Member
0 Kudos

check this code tutorial on how to send smartform output thru email.

https://wiki.sdn.sap.com/wiki/display/Snippets/emailsendthroughoutputcontrols

radhushankar
Participant
0 Kudos

Hi Karthik,

Thanks 4 ur reply.But i am not looking for this option.

I have z function module with me to send the email functionality,,

All i am looking for is a logic when my smartform got attached to a standard transaction when ever the output type email is selected it should trigger the email and should not show any output in the screen

Is this possible and any other ways to do this??

Former Member
0 Kudos

when this transaction runs, it must be calling a report which is calling the smartform fm SSF_FUNCTION_MODULE_NAME at the point u need to pass the output options.

set getotf parameter as 'X' and it will supress print.

If u cant get where ur smartform is getting called then start ur transaction with /h and set breakpoint at fm SSF_FUNCTION_MODULE_NAME , now hit f8 the point where it will stop, will give u program name of where smartform is getting called

кu03B1ятu03B9к

radhushankar
Participant
0 Kudos

Hi Karthik,

Once again thanks for your suggestions.

But i could c any getotf parameter in the function module u specified can u provide some sample code.

Thanks in advance

radhushankar
Participant
0 Kudos

Hi All,



REPORT  ZFERS_INVOICE.

TABLES : NAST.

DATA : LV_DOCUMENT TYPE RBKP-BELNR,
       LV_FMNAME TYPE RS38L_FNAM.


*&---------------------------------------------------------------------*
*&      Form  ENTRY_NEU
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->ENT_RETCO  text
*      -->ENT_SCREEN text
*----------------------------------------------------------------------*
FORM ENTRY_NEU USING ENT_RETCO ENT_SCREEN.
  LV_DOCUMENT = NAST-OBJKY.
  ENT_RETCO = SY-SUBRC.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZTEST
    IMPORTING
      fm_name            = LV_FMNAME
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
  ENDIF.

  CALL FUNCTION LV_FMNAME
    EXPORTING
      LV_DOCUMENT      = XX_DOCUMENT
    EXCEPTIONS
      formatting_error = 1
      internal_error   = 2
      send_error       = 3
      user_canceled    = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
  ENDIF.
Endform.                    "ENTRY_NEU

I have done like this for invoice output. In order to include the email option wer i need to pass the respective parameter..

I am just passing only the document number to smartform and inside the smartform only i am retrieving all the wanted values.

Thanks

Former Member
0 Kudos

data: ls_control_param      type ssfctrlop,"<----
         ls_control_param-getotf = 'X'.  "<-------

CALL FUNCTION LV_FMNAME
    EXPORTING
     control_parameters = ls_control_param  "use this
     LV_DOCUMENT      = XX_DOCUMENT
   EXCEPTIONS
      formatting_error = 1
      internal_error   = 2
      send_error       = 3
      user_canceled    = 4
      OTHERS           = 5.

Edited by: kartik tarla on Mar 23, 2009 8:22 PM

radhushankar
Participant
0 Kudos

Hi Karthik,

Thanks 4 u r reply.

Can any one tell me how to automatically send an email when the medium is selceted as email.

Thanks in advance

Former Member
0 Kudos

check the wiki link that i posted before it has code to send email