Application Development 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: 

Sales Order Ack.. To Customer

Former Member
0 Kudos

Hi Experts:

I am using Mail output type to send a email to the customer for sales order ack..

the Mail output type uses the RSNASTSO.

But it generates the Empty PDF file(without content) . so, how can i fill the content and ACK email to the customer.

please throw some light on it.

Thanks,

Venkat J.

2 REPLIES 2

Former Member
0 Kudos

Sending you the code for sending the mail

*Data declaration for mail FM

DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,

it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,

it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,

gd_cnt TYPE i,

gd_sent_all(1) TYPE c,

gd_doc_data LIKE sodocchgi1,

gd_error TYPE sy-subrc.

*Internal table for message body

DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0

WITH HEADER LINE,

it_messagewa LIKE LINE OF it_message .

psubject = 'SO Regarding'.

*Accessing name and address number of a vendor

SELECT SINGLE name1 adrnr FROM lfa1 INTO it_vname WHERE lifnr EQ

i_ekko-lifnr.

*Accessing mail id of a vendor

SELECT SINGLE smtp_addr FROM adr6 INTO it_vemail WHERE addrnumber EQ

it_vname-adrnr.

  • Mail Text

clear it_message.

REFRESH it_message.

CONCATENATE 'Dear' it_vname-name1 ',' INTO it_messagewa SEPARATED BY

space.

APPEND it_messagewa TO it_message.

APPEND 'This is the sales order ack mail.' TO

it_message.

CLEAR it_messagewa.

CONCATENATE 'SO NUmber : ' i_ekko-ebeln INTO it_messagewa SEPARATED

BY space.

APPEND it_messagewa TO it_message.

APPEND 'you can view it at www.mindteck/sap/mm/login.' TO it_message.

APPEND 'Regards,' TO it_message.

APPEND 'Saurabh.' TO it_message.

  • Fill the document data.

gd_doc_data-doc_size = 1.

  • Populate the subject/generic message attributes

gd_doc_data-obj_langu = sy-langu.

gd_doc_data-obj_name = 'SAPRPT'.

gd_doc_data-obj_descr = psubject.

gd_doc_data-sensitivty = 'F'.

  • Describe the body of the message

CLEAR it_packing_list.

REFRESH it_packing_list.

it_packing_list-transf_bin = space.

it_packing_list-head_start = 1.

it_packing_list-head_num = 0.

it_packing_list-body_start = 1.

DESCRIBE TABLE it_message LINES it_packing_list-body_num.

it_packing_list-doc_type = 'RAW'.

APPEND it_packing_list.

  • Add the recipients email address

CLEAR it_receivers.

REFRESH it_receivers.

it_receivers-receiver = it_vemail-email.

it_receivers-rec_type = 'U'.

it_receivers-com_type = 'INT'.

it_receivers-notif_del = 'X'.

it_receivers-notif_ndel = 'X'.

APPEND it_receivers.

  • Call the FM to post the message to SAPMAIL

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = gd_doc_data

put_in_outbox = 'X'

commit_work = 'X'

IMPORTING

sent_to_all = gd_sent_all

  • NEW_OBJECT_ID =

TABLES

packing_list = it_packing_list

  • OBJECT_HEADER =

  • CONTENTS_BIN =

contents_txt = it_message

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

receivers = it_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.

Former Member
0 Kudos

s