標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 爬蟲 (1) 音樂 (2) 產業 (5) 郭語錄 (3) 無聊 (3) 統計 (4) 新聞 (1) 經濟學 (1) 經營管理 (42) 解析度 (1) 遊戲 (5) 電學 (1) 網管 (10) 廣告 (1) 數學 (1) 機率 (1) 雜趣 (1) 證券 (4) 證券期貨 (1) ABAP (15) AD (1) agentflow (4) AJAX (1) Android (1) AnyChart (1) Apache (14) BASIS (4) BDL (1) C# (1) Church (1) CIE (1) CO (38) Converter (1) cron (1) CSS (23) DMS (1) DVD (1) Eclipse (1) English (1) excel (5) Exchange (4) Failover (1) Fedora (1) FI (57) File Transfer (1) Firefox (3) FM (2) fourjs (1) Genero (1) gladiatus (1) google (1) Google Maps API (2) grep (1) Grub (1) HR (2) html (23) HTS (8) IE (1) IE 8 (1) IIS (1) IMAP (3) Internet Explorer (1) java (4) JavaScript (22) jQuery (6) JSON (1) K3b (1) ldd (1) LED (3) Linux (117) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) OpenSSL (1) Oracle (126) Outlook (3) PDF (6) Perl (60) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (5) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium (3) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) sqlplus (1) SQuirreL SQL Client (1) SSH (2) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (24) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (37) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) VirtualBox (1) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) Xvfb (2) youtube (1) yum (2)

2014年3月26日 星期三

SAP PO設定列印

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(12TYPE C,
        I_PURID2(12TYPE 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 

沒有留言:

張貼留言