http://scn.sap.com/thread/830302
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
Note:
Cutomisation steps for Output of Purchase Order are
1. Condition Table
SPRO
> Material Management> Purchasing -> Message -> Output Control->Condition Tables->Define Condition Table for Purchase Order
Select:
Purchasing Doc. Type,
Purch. Organization,
Vendor
2. Access Sequences
SPRO
-> Material Management-> Purchasing -> Message -> Output
Control->Access Sequences->Define Condition Table for Purchase
Order
3. Message Type
SPRO -> Material Management->
Purchasing -> Message -> Output Control->Message
Types->Define Message Type for Purchase Order
呼叫PROGRAM中的FORM routine,而FORM routine呼叫smartForm Form
底下貼上ZSAPFM06P範例
4. Message Determination Schemas
4.1. Message Determination Schemas
SPRO
-> Material Management-> Purchasing -> Message -> Output
Control->Message Schema->Define Message Schema for Purchase
Order-> Maintain Message Determination Schema
4.2. Assign Schema to Purchase Order
SPRO
-> Material Management-> Purchasing -> Message -> Output
Control->Message Schema->Define Message Schema for Purchase
Order-> Assign Schema to Purchase Order
5. Partner Roles per Message Type
SPRO
-> Material Management-> Purchasing -> Message -> Output
Control-> Partner Roles per Message Type ->Define Partner Role for
Purchase Order
6. Condition Record
Navigation Path: SAP
Menu-> Logistics -> Material Management -> Purchasing->
Master data->Messages-> Purchase Order-> MN04-> Create
Now you create PO (ME21N) and save it. Go to ME22N and print the PO by giving output type.
FORM ZENTRY_NEU
USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO
LIKE T166K-DRUVO,
L_NAST
LIKE NAST,
L_FROM_MEMORY,
L_DOC
TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
IF NAST-AENDE
EQ SPACE.
L_DRUVO =
'1'.
ELSE.
L_DRUVO =
'2'.
ENDIF.
* "***************************************************
DATA: LS_PONUM
LIKE EKKO-EBELN.
DATA: LF_FORMNAME
TYPE TDSFNAME
VALUE 'ZSFMM001',
LF_FM_NAME
TYPE RS38L_FNAM.
DATA ITAB
LIKE ZSMM001
OCCURS 10 WITH HEADER LINE.
DATA FRGKE
LIKE EKKO-FRGKE.
DATA T_RTAX1U15
LIKE RTAX1U15
OCCURS 1 WITH HEADER LINE.
"20080407 By Matt Calculate Tax
DATA: IT_PDF
TYPE ITCOO
OCCURS 0 WITH HEADER LINE,
"@03
PDF_TAB
LIKE TLINE
OCCURS 0 WITH HEADER LINE,
BIN_FILESIZE
TYPE I,
FILE_SIZE
TYPE I,
LS_JOB_INFO
TYPE SSFCRESCL,
PATH_NAME
TYPE STRING,
VEKORG
TYPE EKORG.
* "***************************
CLEAR LS_PONUM .
LS_PONUM = NAST-OBJKY+
0(
10) .
*
INCLUDE MM_MESSAGES_MAC.
"useful macros for message handling
SELECT SINGLE FRGKE EKORG
INTO (FRGKE, VEKORG)
FROM EKKO
WHERE EBELN = LS_PONUM.
IF FRGKE
EQ 'B'.
"Block doc cannot be printed, agreed on 4/20/07' PO process meeting
MMPUR_MESSAGE_FORCED
'E' 'ZMM01' '999' 'Unreleased document cannot be printed !' '' '' ''.
EXIT.
ENDIF.
*
SELECT H~EBELN H~LIFNR H~AEDAT H~BEDAT H~WKURS H~KUFIX
H~WAERS H~BUKRS H~ZTERM H~INCO1 H~INCO2 H~EKGRP
I~EBELP
I~MATNR
I~AFNAM
I~MEINS
I~MENGE
I~WERKS
I~NETPR
I~PEINH
I~BPRME
I~NETWR
I~RETPO
I~PSTYP
I~TXZ01
I~IDNLF
I~MWSKZ
I~ADRNR
I~ADRN2
I~EMLIF
I~KUNNR
INTO CORRESPONDING
FIELDS OF TABLE ITAB
FROM EKKO
AS H INNER
JOIN EKPO
AS I
ON I~EBELN = H~EBELN
WHERE H~EBELN = LS_PONUM
AND H~LOEKZ =
' ' AND I~LOEKZ =
' '.
"2007/02/14[+1]JASON
LOOP AT ITAB.
IF ITAB-TXZ01
IS INITIAL .
SELECT SINGLE MAKTX
INTO ITAB-TXZ01
FROM MAKT
WHERE MATNR = ITAB-MATNR.
ENDIF.
IF ITAB-RETPO =
'X'.
"Return Item
ITAB-NETPR = ITAB-NETPR * -
1.
ITAB-NETWR = ITAB-NETWR * -
1.
ENDIF.
*-- [ ADD BY Katy ITEM 交期 DATA +3 ]
SELECT SINGLE EINDT
INTO ITAB-EINDT
FROM EKET
WHERE EBELN = ITAB-EBELN
AND EBELP = ITAB-EBELP.
*20080407 By Matt Calculate Tax
IF ITAB-MWSKZ
NE ''.
CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
EXPORTING
I_BUKRS = ITAB-BUKRS
I_MWSKZ = ITAB-MWSKZ
I_WAERS = ITAB-WAERS
I_WRBTR = ITAB-NETWR
TABLES
T_MWDAT = T_RTAX1U15.
IF SY-SUBRC <>
0.
"MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
ENDIF.
ITAB-WMWST = T_RTAX1U15-WMWST.
ENDIF.
IF ITAB-ADRNR
EQ ''.
"20091201 Ship-to Address
IF ITAB-ADRN2
NE ''.
"Address
ITAB-ADRNR = ITAB-ADRN2.
ELSEIF ITAB-EMLIF
NE ''.
"Vendor
SELECT SINGLE ADRNR
INTO ITAB-ADRNR
FROM LFA1
WHERE LIFNR
EQ ITAB-EMLIF.
ELSEIF ITAB-KUNNR
NE ''.
"Customer
SELECT SINGLE ADRNR
INTO ITAB-ADRNR
FROM KNA1
WHERE KUNNR
EQ ITAB-KUNNR.
ENDIF.
ENDIF.
MODIFY ITAB.
ENDLOOP.
**@04 2012/12/21 Add APPROVE_ID For 串簽名檔 (Begin) ===========================**
DATA: I_PURID1(
12)
TYPE C,
I_PURID2(
12)
TYPE C.
SELECT SINGLE APPROVE_ID
INTO I_PURID1
FROM ZTMM019
WHERE DOC_NO
EQ LS_PONUM
AND SERIAL_NO
EQ 1 AND DOC_TYPE
EQ 'PO'.
SELECT SINGLE APPROVE_ID
INTO I_PURID2
FROM ZTMM019
WHERE DOC_NO
EQ LS_PONUM
AND SERIAL_NO
EQ 2 AND DOC_TYPE
EQ 'PO'.
CONCATENATE 'ZPUR_' I_PURID1
INTO I_PURID1.
CONCATENATE 'ZPUR_' I_PURID2
INTO I_PURID2.
**@04 2012/12/21 Add APPROVE_ID For 串簽名檔 (End) ===========================**
* "**************************************
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = TNAPR-SFORM
"Smartform name - Get from IMG 041207'
IMPORTING
FM_NAME = LF_FM_NAME
EXCEPTIONS
NO_FORM =
1
NO_FUNCTION_MODULE =
2
OTHERS =
3.
IF SY-SUBRC <>
0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF LF_FM_NAME
IS INITIAL .
LF_FM_NAME =
'/1bcdwb/sf00000001' .
ENDIF.
DATA ST_SFCTRLOP
LIKE SSFCTRLOP.
DATA LS_COMPOSER_PARAM
TYPE SSFCOMPOP.
LS_COMPOSER_PARAM-TDNEWID =
'X'.
"CREATE NEW SPOOL ID EVERYTIME
IF TNAPR-FORMTYPE =
'2'.
"@03 Convert as PDF
ST_SFCTRLOP-GETOTF =
'X'.
ST_SFCTRLOP-NO_DIALOG =
'X'.
ENDIF.
ST_SFCTRLOP-LANGU = NAST-SPRAS.
CALL FUNCTION LF_FM_NAME
EXPORTING
CONTROL_PARAMETERS = ST_SFCTRLOP
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
I_PURID1 = I_PURID1
"@04
I_PURID2 = I_PURID2
"@04
IMPORTING
JOB_OUTPUT_INFO = LS_JOB_INFO
TABLES
ITAB = ITAB
EXCEPTIONS
FORMATTING_ERROR =
1
INTERNAL_ERROR =
2
SEND_ERROR =
3
USER_CANCELED =
4.
IF TNAPR-FORMTYPE =
'2'.
"@03 Convert as PDF file
PERFORM DOWNLOAD_AS_PDF
TABLES LS_JOB_INFO-OTFDATA
USING VEKORG.
ENDIF.
ENDFORM.
"ZENTRY_NEU