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

Fm required

Former Member
0 Likes
698

Hi Experts,

I have a requirement lik this:

When i am trying to read a directory from App.server,

due to system problem or any hardware problem if i am not able to read i need to send a mail to System admin.

The mail should go automatically is not able to connect to app.server.

Is there any FM available for this type of requirement or can any body tell me how can we do this?

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
666

hi Ravi,

Use SO_NEW_DOCUMENT_SEND_API1 FM if the Open dataset fails i.e,

open dataset ..

if sy-subrc ne 0.

Call Function ' SO_NEW_DOCUMENT_SEND_API1'.

endif.

hi Ravi,

Use SO_NEW_DOCUMENT_SEND_API1 FM if the Open dataset fails i.e,

open dataset ..

if sy-subrc ne 0.

Call Function ' SO_NEW_DOCUMENT_SEND_API1'.

endif.

6 REPLIES 6
Read only

Former Member
0 Likes
666

Hi,

use this codings.

open dataset p_filename for output.

if sy-subrc ne 0.

use SO_NEW_DOCUMENT_SEND_API1 function module to send mail to your administrator.

endif.

Plz mark useful answers.

Regards

Divakar

Read only

0 Likes
666

Hi,

You can use this func module also.

MESSAGE_SEND_AS_MAIL

give ur message and receipient add

Plz mark useful answers.

Regards

Divakar

Read only

Former Member
0 Likes
666

Check the following code it may help u.

FORM send_mail USING p_y16m_rcp_par STRUCTURE y16m_rcp_par.

  • Have a subject for the mail

g_s_document_data-obj_name = text-t02.

g_s_document_data-obj_descr = text-t03.

  • Fill receiver information

g_s_receivers-rec_type = p_y16m_rcp_par-rec_type.

g_s_receivers-rec_id = p_y16m_rcp_par-rec_id.

g_s_receivers-express = 'X'.

APPEND g_s_receivers TO g_t_receivers.

  • Call function to send mail

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = g_s_document_data

document_type = 'RAW'

  • PUT_IN_OUTBOX = ' '

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

  • OBJECT_HEADER =

object_content = g_t_object_content

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

receivers = g_t_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8

.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM. " SEND_MAIL

Regards

Read only

Former Member
0 Likes
667

hi Ravi,

Use SO_NEW_DOCUMENT_SEND_API1 FM if the Open dataset fails i.e,

open dataset ..

if sy-subrc ne 0.

Call Function ' SO_NEW_DOCUMENT_SEND_API1'.

endif.

Read only

0 Likes
666

Hi all,

Thanks. I will try that

Read only

Bema
Active Participant
0 Likes
666

OPEN DATASET v_filepath FOR INPUT IN TEXT MODE

.

IF sy-subrc NE 0.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = wa_document_data

put_in_outbox = 'X'

sender_address = ''

sender_address_type = ''

commit_work = 'X'

IMPORTING

sent_to_all = v_sys_admin

TABLES

packing_list = i_packing_list

contents_bin = i_attach

contents_txt = i_contents_txt

receivers = i_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

endif.