cancel
Showing results for 
Search instead for 
Did you mean: 

Sending mail using standard SAP functionality

Former Member
0 Kudos

Hi Experts,

I have a functionality to implement that sends mail using transaction ME22N. I have created an output type as External Send. I am trying to use the SAP standard functionality to send the mail.

The mail should be send as PDF.

But, when I use this output type, and click on the save of ME22N, I am getting an express message saying that the output is terminated.

Can anyone explain me what is the problem, and what should I do to the mail properly via ME22N.

Answers will be rewarded.

Thanks and Regards,

Zaheed.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

if u recieve an exprees mail to ur sap inbox with an error message then it means that u have error in ur me22n transaction or ur data is not getting saved.

and for sending an automated mail u have to write the code which is as follows in the std print program ....

&----


*& Form nacha_5

&----


  • Send the Form as an Email

----


  • -->P_FOUND Flag 'X' if sub routine is found

----


FORM nacha_5 USING write_out TYPE xfeld

CHANGING p_found TYPE xfeld.

DATA : lv_mail_id TYPE so_name,

lv_mail_tp TYPE so_escape VALUE 'U',

l_subrc TYPE sy-subrc.

p_found = 'X'.

  • Get the Mail ID from the Control Table

lv_mail_id = t_ctrl_app-recipient.

  • Create The Recipient Object

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

ip_mailaddr = lv_mail_id

ip_type_id = lv_mail_tp

IMPORTING

ep_recipient_id = w_recipient

EXCEPTIONS

invalid_recipient = 1

OTHERS = 2.

IF sy-subrc NE 0.

IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-001.

ENDIF.

RAISE other.

ENDIF.

  • Create The Sender Object

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = w_sender

EXCEPTIONS

invalid_sender = 1

OTHERS = 2.

IF sy-subrc NE 0.

IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-002.

ENDIF.

RAISE other.

ENDIF.

  • Populate the Control Data & Title

w_sf_control-device = 'MAIL'.

w_sf_control-no_dialog = 'X'.

w_sf_control-langu = t_ctrl_app-spras.

***************************************************

Nacha = 2

  • Populate the Fax Number and the country.

Data : lv_fax_tp TYPE so_escape VALUE 'F',

lv_fax = t_ctrl_app-recipient.

lv_land1 = t_ctrl_app-country.

  • Create the Recipient Object

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

ip_country = lv_land1

ip_faxno = lv_fax

ip_type_id = lv_fax_tp

IMPORTING

ep_recipient_id = w_recipient

EXCEPTIONS

invalid_recipient = 1

OTHERS = 2.

IF sy-subrc NE 0.

IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-004.

ENDIF.

RAISE other.

ENDIF.

  • Create The Sender Object

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = w_sender

EXCEPTIONS

invalid_sender = 1

OTHERS = 2.

IF sy-subrc NE 0.

IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-003.

ENDIF.

RAISE other.

ENDIF.

  • Populate the Control Data

w_sf_control-device = 'TELEFAX'.

w_sf_control-no_dialog = 'X'.

w_sf_control-langu = t_ctrl_app-spras.

  • Populate the Output Options.

w_output_options-tdteleland = lv_land1.

w_output_options-tdtelenum = lv_fax.

w_output_options-faxformat = 'PS'.