auto po download message

Upload: samik-biswas

Post on 03-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Auto PO Download Message

    1/29

    SDN Contribu tion

    AUTOMATED PO DOWNLOAD MESSAGE

    Summary

    The interface proposed is based on a standard SAP interface for Purchase Orders via ALE/IDoc andMessage Control type ORDRS (function module: IDOC_OUTPUT_ORDERS), which is used togenerate an IDOC (IDoc type " ORDERS01") directly whenever Purchase Orders are approved.

    This technique (message control) can be used to send purchase order data to a 3rdParty WMS. Thecondition technique is used to determine in which cases (e.g. only for specific purchase order types)and to which partners the data is to be sent. When the message is processed, an intermediate

    document (IDoc) is generated that contains the purchase order data. The IDoc is forwarded to theEDI layer, which takes care of sending the message to the outbound port and, if necessary, triggersimmediate further processing. This type of interface is suitable for both batch and onlinecommunication.

    There has been a requirement to generate idocs whenever the Purchase Order is created, changed ordeleted. The deletion of the purchase order is at the line item level and the idocs are created at theline item level and not in the header part. The user need not enter the data in the message control inorder to generate the idocs.

    Created on: 15 Sep 2005

    Author Bio

    Aveek has more than 11 years experience in software analysis and design andcustom development both in India and abroad. He has handled software projects UHolland, UK, Switzerland and India. He has during his association with IBM, PWC& Consultancy firms in the U.S. gathered wide experience in developing leadingtechnological solutions. He has been heavily involved in developing MaterialsManagement System, Manufacturing & Material Handlings applications, ProcessControl System Interfaces, Warehouse Control applications and Financial

    .S.,

    edge

    2006 SAP AG 1

  • 7/29/2019 Auto PO Download Message

    2/29

    applications in almost all the software projects he has undertaken. For the past 6 years, Aveek hasbeen associated with a number of SAP projects in India and abroad.. Aveek has been involved inhandling Process Control Interfaces in the Manufacturing area.

    .

    2006 SAP AG 2

  • 7/29/2019 Auto PO Download Message

    3/29

    Table of Contents

    2006 SAP AG 3

  • 7/29/2019 Auto PO Download Message

    4/29

    Data Flow Diagram

    Application

    Process Message

    Schematic Diagram of Outbound Interfaces

    (Sample IDOC to message wi th file contents)

    Middleware Hub

    Receiving

    Server

    Message(IDOC)

    Message(FILE)

    File

    MQ SeriesInput Queue

    MQ SeriesOutput Queue

    TransformationEngine

    Map

    Map

    Map

    MQ SeriesInput Queue

    Remove Wrapper

    Write File

    Trigger

    Load/Process FileThe loading ofthe file can betriggered by

    middleware onreceipt or

    scheduled bythe application

    The initialprocessing ofthe message isalways triggeredby middleware

    Scheduler

    OutboundServer of SapLink

    for R/3

    SendIDOC

    SAP Instance

    SendMessage

    PopulateWrapper

    IDOC

    IDOC OutboundProcessing

    Function module for

    outbound message

    processing

    2006 SAP AG 4

  • 7/29/2019 Auto PO Download Message

    5/29

    Customizing Overview

    Our goal is to send purchase order data to an output port. The easiest way to do it is to use the IDOCoutput processing that is already defined in standard. Then, rather than sending the data to thevendor, we send it to our interfaced system.

    A new message type Z005 has to be created, for which a processing routine using medium type a(ALE) and the program RSNASTED with subroutine ALE_PROCESSING is to be set up. As apartner function, an entry for the medium ALE and partner function RP (Receiving Plant, seebelow) has to be created. Regarding its fine-tuned control, this message should be defined foroperation 1 (creation) and operation 2 (change). This message type can be linked to the existingaccess sequence Z001.

    Since the application EF (Purchase Order), from which the message control originates, generatesonly messages having as a partner type either VN or CU, dummy vendors will have to be created torepresent the receiving plants. This is necessary because on entering a partner number in a conditionrecord, a check for a corresponding vendor master record is carried out by the system. For thispurpose, a new partner function RP (Receiving Plant) with partner type LI is to be created.

    It is possible, though, to map this partner function with partner type LI to partner type LS using theabove mentioned medium ALE and subroutine ALE_PROCESSING in the output type. An ALEdistribution model is to be maintained with all the receiving plants as receiving logical systems andmessage type ORDERS. In the filter setting, the vendor number of the dummy vendors, identicalwith the receiving logical systems, are to be entered.

    The output of the idoc message will have to be conditioned to the keyfields purchasing documenttype and plant, possibly purchasing organization. To facilitate this, a new condition table 923 withthese key fields will be created.

    This condition table has to be integrated into the access sequence as a new access. Since themessage is only to be sent on release of the purchase order, an additional requirement needs to be

    specified for this access.For the set up of the partner profiles, an outbound partner profile of the message type ORDERS is tobe created for every plant that needs to receive the message. Both the partner type and the partnerfunction will be that of LS (logical system). The idoc format will be an enhancement of the standardidoc type ORDERS05. In the Message Control options, an entry for the application EF (PurchaseOrder), the newly created message output type Z005 and the process code ME10 has to be made.

    2006 SAP AG 5

  • 7/29/2019 Auto PO Download Message

    6/29

    Interface Overview

    SAP

    Release Purchase Order (note that each Purchase Order change has to be approved)

    IDoc Created with Header and Detail Information

    tRFC Initiates IDoc Pass through ALE Adapter to Mercator/translator

    Mercator/Translator

    IDoc Information Mapped to Format for Purchase Orders in the 3rdParty WMS

    One message created for each Line-Delivery Point in Purchase Order

    Mercator Output delivered to Correct WMS Instance (SAP Plant)

    WMS

    Import File from SAP (through Mercator /Translator)Add to Current List of Purchase Orders

    2006 SAP AG 6

  • 7/29/2019 Auto PO Download Message

    7/29

    EDI Message Structure

    EANCOM - ORDERS Message D 96A

    Purchase order message

    Segment Page

    Seg.N Status Max. Use Segment Name

    UNH 1 M 1 MESSAGE HEADER

    SG2 C 99 NAD-SG3-SG5

    NAD 6 M 1 NameandaddressSG3 C 10 RFFRFF 7 M 1 Referenc

    -

    - - - - -

    TY 1 C uantitDTM 3 M 35 Datetime eriodFTX 15 C Freetex LineNotes Onl asre uired

    EDI Message Example

    Purchase Order from Nestl to Vendor for delivery to a 3rd. Party Warehouse

    Example of proposed message

    UNA:+.? '

    UNB+UNOB:3+9301235852671:14+9300605123458:14+020525:1058+00000000453847'

    2006 SAP AG 7

  • 7/29/2019 Auto PO Download Message

    8/29

    UNH+00000000453847+ORDERS :D:96A:EN:EAN008

    BGM+241+453847+9 A "Delivery schedule" IDOC N, Original message

    DTM+137:200205251059:203 This Message Date & Time

    FTX+ORI+1++PLEASE DELIVER ON CHEP PALLETS' Order Note (Delivery) Instructions asrequired

    RFF+ON:4500000493 Customer Purchase Order N =4500000493

    NAD+BY+20005::92' Purchasing Plant code

    CTA+PD' Purchasing Contact

    COM+021 9876543:TE' Telephone N 021 9876543

    NAD+SE+5001000668943::9 Vendor's GLN

    RFF+IA:0100000100' Account number for the Vendor

    CTA+SD' Shipping Contact

    COM+021 9246354:TE' Telephone N 021 9246354

    NAD+ST+9300605123458::9 Delivery Site's GLN Third Party Warehouse

    LIN+10++9300605345676:EN First line of this Purchase Order (Line 10), MaterialGTIN If available

    PIA+1+02:PV+30532:IN+30532:SA GTIN Variant =02,

    Material Code =30532

    and Vendor's Material Code

    QTY+21:48:CS Quantity Ordered =48 Cases

    DTM+2:200205260830:203 Requested Delivery date (time) only available at line level.

    FTX+MKS+1++PLEASE DELIVER ON ONE PALLET'Shipping marks/ Instructions (free text)

    if required at line-level

    LIN+20 Second line of this Purchase Order, No GTIN for thisMaterial

    PIA+41643:IN+ Only have Material Code =41643

    QTY+21:5000:MTR Quantity Ordered =5 000 Metres

    DTM+2:200205280700:203 Requested Delivery date (time) only available at line level.

    RFF+ZSS:K' It is "Consignment " Material

    UNS+S' Detail/summary section separation

    CNT+2:2' Two LIN segment(s) in this message

    UNT+143+00000000453847

    UNZ+1+00000000453847

    2006 SAP AG 8

  • 7/29/2019 Auto PO Download Message

    9/29

    Routing lookup table

    Seq Field name Description Format Pad Mandatory

    1 GLN code EANCOM value char(13) fixed yes

    2 Logical system Idoc header value char(10) fixed yes

    3 Delivery_GID Middleware Hub char(2) yes, with space yes

    4 Delivery_ID Middleware value for thedestination

    char(6) fixed yes

    5 Mapping format describe which messageformat will have to beproduced

    no yes

    Routing rule

    A lookup table is used

    Read the Idoc field EDIDC-RCVPRN

    Read the MW lookup table where Idoc field EDIDC-RCVPRN =Logical system

    If Mapping field =EANCOM, map the Idoc to an EANCOM message and send it to theDelivery GID / Delivery ID of the lookup table

    The corresponding GLN code will be populated in the EANCOM message.

    2006 SAP AG 9

  • 7/29/2019 Auto PO Download Message

    10/29

    Customizing for Automated PO Download

    Condition Tables

    SPRO->MM->Purchasing->Messages->Output control

    2006 SAP AG 10

  • 7/29/2019 Auto PO Download Message

    11/29

    The condition table used in the config is 925 which is by Purchasing document type and plant.

    2006 SAP AG 11

  • 7/29/2019 Auto PO Download Message

    12/29

    Access Sequence

    Access Sequence used is Z002.

    Maintain Message Types

    2006 SAP AG 12

  • 7/29/2019 Auto PO Download Message

    13/29

    The output type we need to consider is Z005.

    General Tab when displaying the details of the output

    The access sequence in the config for message type should be Z002.

    Default values Tab:

    2006 SAP AG 13

  • 7/29/2019 Auto PO Download Message

    14/29

    Processing Routine for the output type: for EDI

    2006 SAP AG 14

  • 7/29/2019 Auto PO Download Message

    15/29

    Processing Routine for the output type: for ALE:

    Partner Roles option for the output type Z005:

    2006 SAP AG 15

  • 7/29/2019 Auto PO Download Message

    16/29

    Maintain Message types for message Control

    The Routine relevant for the Purchase Order download is 911 which is linked to the application EF.

    Routine 911 source Code:

    FORM KOBED_911.

    *{ INSERT G10K916219 1

    * Remove duplicate entries for output conditioning by DocTyp/Plant

    * in xnast

    data: l_objkey_from like nast-objky,

    l_objkey_to like nast-objky,l_parnr like nast-PARNR,

    l_parvw like nast-PARVW,

    l_knumh like nach-knumh,

    l_lines type i,

    l_sysubrc like sy-subrc,

    i_objky like table of nast-objky with header line.

    2006 SAP AG 16

  • 7/29/2019 Auto PO Download Message

    17/29

    local: l_objkey_from,

    l_objkey_to,

    l_parnr,

    l_parvw,

    l_knumh,

    l_lines,

    l_sysubrc,

    i_objky.

    refresh i_objky.

    * Check for the name of the condition table. If changed in customizing,

    * it has to be maintained!

    check T682I-KOTABNR = '925'.

    * KNUMH: number of valid condition record

    select single KNUMH from B925 into l_knumh

    where KAPPL = KOMT1-KAPPL and

    KSCHL = KOMT1-KSCHL and

    BSART = KOMKBEA-BSART and

    WERKS = KOMPBEA-WERKS.

    * sy-subrc = 0 has to be returned to calling program, otherwise no

    * further access to conditions is executed!

    l_sysubrc = sy-subrc.

    clear sy-subrc.

    * >>> INS HOTFIX

    * Check if failed Idocs exist already

    loop at xnast where kappl = komt1-kappl

    and kschl = komt1-kschl

    and vstat = '2'.

    xnast-vstat = '0'.

    modify xnast.

    endloop.

    *

  • 7/29/2019 Auto PO Download Message

    18/29

    l_sysubrc = sy-subrc.

    clear sy-subrc.

    check l_sysubrc = 0.

    * Exist other xnast records with identical partner?

    loop at xnast where KAPPL = KOMT1-KAPPL

    and KSCHL = KOMT1-KSCHL

    and SPRAS = sy-langu

    and PARNR = l_parnr

    and PARVW = l_parvw

    and ERDAT = sy-datum

    and VSTAT = '0'.

    i_objky = xnast-objky.

    append i_objky.

    clear i_objky.

    endloop.

    l_sysubrc = sy-subrc.

    clear sy-subrc.

    check l_sysubrc = 0.

    sort i_objky.

    describe table i_objky lines l_lines.

    read table i_objky index 1 into l_objkey_from.

    read table i_objky index l_lines into l_objkey_to.

    * Delete duplicate xnast records for partner currently processed

    CALL FUNCTION 'RV_MESSAGES_DELETE_PARTNER'

    EXPORTING

    msg_objky = l_objkey_from

    MSG_OBJKY_TO = l_objkey_to

    msg_parnr = l_parnr

    msg_parvw = l_parvw.

    *} INSERT

    ENDFORM.

    FORM KOBEV_911.

    *{ INSERT G10K916219 1

    perform KOBED_911.

    *} INSERT

    ENDFORM.

    2006 SAP AG 18

  • 7/29/2019 Auto PO Download Message

    19/29

    Message Determination Schema

    Click on RMBEF1 and double click the control data. This brings you to the following screen.

    Make sure that the Z005 output type is configured to the 911 routine.

    2006 SAP AG 19

  • 7/29/2019 Auto PO Download Message

    20/29

    Config in VK01

    Enter the usage as B and the application as EF.

    This brings you to the following screen

    Choose Condition Types and press execute button

    Choose Z005 and press the magnifying glass:

    2006 SAP AG 20

  • 7/29/2019 Auto PO Download Message

    21/29

    This displays the following screen:

    2006 SAP AG 21

  • 7/29/2019 Auto PO Download Message

    22/29

    Note the partner function is maintained as LS instead of VN. Press on the Partner definition andenter the following details: There should be 2 entries for each EDI and ALE ie 6 and A.

    2006 SAP AG 22

  • 7/29/2019 Auto PO Download Message

    23/29

    For the processing program details enter the following:

    2006 SAP AG 23

  • 7/29/2019 Auto PO Download Message

    24/29

    ALE Config

    Partner Profile set up ( WE20).

    Outbound Options

    2006 SAP AG 24

  • 7/29/2019 Auto PO Download Message

    25/29

    Message Control

    Note there are 2 entries in the message control one for create and one for change.

    2006 SAP AG 25

  • 7/29/2019 Auto PO Download Message

    26/29

    Distribution Model

    Setting up the automation in the master data

    2006 SAP AG 26

  • 7/29/2019 Auto PO Download Message

    27/29

    The transactions we are interested in are MN04/MN05.

    Enter output type Z005. In the following screen enter the PO type as Z002 or Z008 depending onthe PUR teams requirement. Add the entries in the screen for each plant GBEPCS1080 for ex andmaintain the entries as follows:

    2006 SAP AG 27

  • 7/29/2019 Auto PO Download Message

    28/29

    When a purchase order is deleted or changed at the item level an idoc will be created but you willnot be able to see the message in message control. This will be visible in the older transaction me22instead of me22n. Enter the PO number then in the next screen click on the item- on the menu

    click on items ->>more functionsmessages. This should display the message details.

    2006 SAP AG 28

  • 7/29/2019 Auto PO Download Message

    29/29

    Copyright

    Copyright 2006 SAP AG. All rights reserved.

    No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.The information contained herein may be changed without prior notice.

    Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

    Microsoft, Windows, Outlook, and P owerPoint are registered trademarks of Microsoft Corporation.

    IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries,zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBMCorporation in the United States and/or other countries.

    Oracle is a registered trademark of Oracle Corporation.

    UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

    Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks ofCitrix Systems, Inc.

    HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, MassachusettsInstitute of Technology.

    J ava is a registered trademark of Sun Microsystems, Inc.

    J avaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented byNetscape.

    MaxDB is a trademark of MySQL AB, Sweden.

    SAP, R/3, mySAP , mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as theirrespective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. Allother product and service names mentioned are the trademarks of their respective companies. Data contained in this document servesinformation purposes only. National product specifications may vary.

    These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAPGroup") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors oromissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in theexpress warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting anadditional warranty.

    These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the impliedwarranties of merchantability, fitness for a particular purpose, or non-infringement.

    SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that mayresult from the use of these materials.

    SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within thesematerials. SAP has no control over the information that you may access through the use of hot links contained in these materials anddoes not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages.

    Any software coding and/or code lines / strings (Code) included in this documentation are only examples and are not intended to beused in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules ofcertain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errorsor damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.