cancel
Showing results for 
Search instead for 
Did you mean: 

how to send purchase order via e-mail.

Former Member

Please could someone let me know how to send purchase order via e-mail.

I am an BC.

e-mailing is functionning however I am not very familiar in settings for MM

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member

Sending PO by email

In order to send PO, your Basis team must configure the system first so that external email can be send out from SAP. If it is not configured, no settings you do on MM will work.

1. You must maintain email address in vendor master data.

2. The same applies to your user master data. For the output type for default values, a communication strategy needs

to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the

Customizing via the following path:

(SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy).

As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).

3. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.

4. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).

5. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.

6. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node.

Former Member
0 Kudos

thank you the solution seems to function

0 Kudos

No, you do not need to touch ME_PRINT_PO. You need to put code before and after ME_PRINT_PO in the print program.

Step 1 - Copy the standard print program SAPFM06P to make a Z version, lets call it ZSAPFM06P

Step 2 - Copy include FM06PE02 to make a Z version, lets call that ZFM06PE02.

Step 3 - ZSAPFM06P change the statement "Include FM06PE02" to read "Include ZFM06PE02".

Step 4 - In include ZFM06PE02 you will find a subroutine called "ENTRY_NEU". In this subroutine you will see it first calls ME_READ_PO_FOR_PRINTING then calls ME_PRINT_PO. Before it calls ME_PRINT_PO just put:

l_nast-nacha = 1.

CLEAR l_nast-dimme.

This means that ME_PRINT_PO will not e-mail, it will create a spool request.

Step 5 - Still in ZFM06PE02, after ME_PRINT_PO has been called, add new code. First check that ent_retco EQ 0. If it does not then exit.

Step 6 - Get the spool ID created by ME_PRINT_PO by either moving sy-msgv1 to a variable or select from NAST.

Step 7 - Call function CONVERT_OTFSPOOLJOB_2_PDF using the spool ID from step 6, and put the result from table PDF into an internal table you can use later. ALso store the export variable pdf_bytecount, you will need it later.

Step 8 - Call function SX_TABLE_LINE_WIDTH_CHANGE using the table from step 7 as content_in and put the results from content_out into a new internal table.

Step 9 - Add some text into a internal table of type solisti1, this will be the body text of the e-mail.

Step 10 - Add whatever receivers you want into an internal table of type somlreci1. If you just want it to go to the address that the PO would have gone to anyway, select the e-mail address from ADR6 where the address number = l_doc-xekko-adrnr, that is the data from the PO.

Step 11 - Populate an internal table of type sopcklsti1 with data relevant to your PDF table from step 8 and the text table from step 9. You will have to put the size of the PDF from step 7 (pdf_bytecount) on the PDF line and the size of the text will be the number of lines of text * 255.

Step 12 - Add info to a structure of type sodocchgi1. You can add the e-mail title in here, field obj_descr. Also add the size of the PDF and the size of the text from step 12 into doc_size, and give the doc a name in field obj_name. This can be anything, ZPDFPO for example.

Step 13 - Call SO_DOCUMENT_SEND_API1 using the tables from steps 8, 9, 10 and 11 and the structure from step 12. You can amend the sending e-mail also. Set commit_work to space.

Step 14 - That is all you need, but I actually call function RSPO_R_RDELETE_SPOOLREQ to delete the spool request created in step 4, then call NAST_PROTOCOL_UPDATE to add some more messages to the processing log of the PO.

That is all.

Former Member
0 Kudos

Hi All!

Someone tested the last solution given by Syed Muzammil and can send me the code?

Thanks, CD

Former Member
0 Kudos

Hi,

You can send purchase order via e-mail in SAP system, there are some configurations and pre-requisites to do as follow:

1. You must maintain an e-mail address in the address in the vendor master.

2. The same applies to your own user master. You also have to specify an e-mail address there in order to identify the sender.

Note that it is not possible to change the e-mail address of the vendor via the SAP purchase order transaction (ME21N, ME22N, and so on). The system only uses the e-mail address of the vendor that is maintained in the vendor master!

3. For the output type for default values, a communication strategy needs to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the Customizing via the following path: (SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy). As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).

4. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.

5. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).

6. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.

7. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node.

For more details, check out the OSS note :191470

Hope this will help.

Reward if useful

Aasif

Former Member
0 Kudos

Hello Tina,

Also check in the first thread of this forum which has link for the same.

Regards

Arif Mansuri

Former Member
0 Kudos