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

For MIGo

Former Member
0 Likes
545

Hi all,

When i save in migo transaction code . A mail should trigger to stores manager.

Please give a code how to write it.

thanks

venkat

Hi all,

When i save in migo transaction code . A mail should trigger to stores manager.

Please give a code how to write it.

thanks

venkat

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
496

You may do that in BADI MB_DOCUMENT_UPDATE or Enhancement MB_CF001 customer exit EXIT_SAPLMBMB_001.

These are executed in update task just after the write/update of goods movement tables (MKPF, MSEG)

Check that XMKPF-TCODE is 'MIGO'.

Use function modules like SO_NEW_DOCUMENT_ATT_SEND_API1 and don't use any COMMIT (update task) ([There are many samples at sdn|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=so_new_document_att_send_api1&cat=sdn_all])

Regards

Read only

Former Member
0 Likes
496

Hi,

To send an email please use this sample code:

code

Declarations.

PARAMETERS: p_email(50) LOWER CASE.

DATA: document_data LIKE sodocchgi1.

DATA: t_content LIKE STANDARD TABLE OF solisti1.

DATA: s_content LIKE solisti1.

DATA: t_receivers LIKE STANDARD TABLE OF somlreci1.

DATA: s_receivers LIKE somlreci1.

START-OF-SELECTION.

Receivers.

s_receivers-receiver = p_email.

s_receivers-rec_type = 'U'.

s_receivers-express = 'X'.

APPEND s_receivers TO t_receivers.

Subject

document_data-obj_descr = 'New mail from Sap'.

Body

s_content = 'Hi,'.

APPEND s_content TO t_content.

CLEAR: s_content.

APPEND s_content TO t_content.

s_content = 'Test email from sap, please don''t reply to this email'.

APPEND s_content TO t_content.

CLEAR: s_content.

APPEND s_content TO t_content.

s_content = 'Thanks,'.

APPEND s_content TO t_content.

s_content = 'Naren.'.

APPEND s_content TO t_content.

Send the email.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = document_data

TABLES

object_content = t_content

receivers = 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 e208(00) WITH 'Error in sending email :-(('.

ELSE.

MESSAGE s208(00) WITH 'Email sent )'.

ENDIF.

SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.[/code]

In order to do it automaticly either:

create program which will read a table and look for new entries and schedule it SM36

use workflow (configure event handling)

regards,

venkat.