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

user exit

Former Member
0 Likes
586

hi,

can any one tell me how can i send an email to the concer user after document is posted in the mb1b transaction.this is speacially for vendor.

5 REPLIES 5
Read only

Former Member
0 Likes
558

Hi,

You can make use of the BADIs availabale with the transaction, MB1B. I hope MB_DOCUMENT_BADI may work for you. Inside the BADI Implementation you can select the customer's e-mail id from the customer master and send mail by using the function module SO_NEW_DOCUMENT_ATT_SEND_API1 .

If you have doubts pls ask. Please reward if you find this useful.

Regards,

Renjith Michael.

Read only

0 Likes
558

Hi Renjith Michael,

I have the same requirement boss which u had explained, but can u please tell me in this BADI MB_DOCUMENT_BADI, where should i go to select the customers email id. what the procedure to do it.

Since this a urgent requirement for me, can u please tell how to overcome from this issue.

Read only

0 Likes
558

Hi,

The table ADR6 contains the e-mail id of the customer. The SAP users have to maintain it properly. You will get the customer number from the order document. use the customer number in table KNA1 to get the address number. After this use the address number to find the e-mail id from ADR6.

See the sample code below.

SELECT SINGLE adrnr FROM kna1

INTO adrnr_sv

WHERE kunnr = vbdka-kunnr.

SELECT SINGLE *

FROM adrc

INTO adrc_sv

WHERE addrnumber = adrnr_sv.

SELECT SINGLE smtp_addr FROM adr6

INTO email

WHERE addrnumber = adrnr_sv

AND flgdefault = 'X'.

mailrec-receiver = email.

mailrec-rec_type = 'U'.

APPEND mailrec.

*Sending Mail

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = maildata

put_in_outbox = ' '

TABLES

packing_list = mailpack

object_header = mailhead

contents_bin = mailbin

contents_txt = mailtxt

receivers = mailrec

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

Regards,

Renjith Michael.

Read only

0 Likes
558

Hi,

I think its very helpfull thanks very much. Can u please tell what r all the tables we use for this, like for example

document_data = maildata

packing_list = mailpack

object_header = mailhead

contents_bin = mailbin

contents_txt = mailtxt

for all these to be given in the function module.

If possible can u pl. send me the sample code boss.

Appriciate ur kind help.

Read only

0 Likes
558

Hi,

Those attributes are used to fill the mail contents(that you want to inform the customers). For this you can try the Standard program RSWNSENDMAIL1 which clearly describes the process of sending mail from SAP. Hope this would be useful.

Regards,

Renjith Michael.