Sie sind auf Seite 1von 29
SDN Contribution AUTOMATED PO DOWNLOAD MESSAGE Summary The interface proposed is based on a standard

SDN Contribution

AUTOMATED PO DOWNLOAD MESSAGE

Summary

The interface proposed is based on a standard SAP interface for Purchase Orders via ALE/IDoc and Message Control type ORDRS (function module: IDOC_OUTPUT_ORDERS), which is used to generate 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 3 rd Party WMS. The condition 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 the EDI layer, which takes care of sending the message to the outbound port and, if necessary, triggers immediate further processing. This type of interface is suitable for both batch and online communication.

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

Created on: 15 Sep 2005

Author Bio

to generate the idocs. Created on: 15 Sep 2005 Author Bio Aveek has more than 11

Aveek has more than 11 years experience in software analysis and design and custom development both in India and abroad. He has handled software projects U .S., Holland, UK, Switzerland and India. He has during his association with IBM, PWC & Consultancy firms in the U.S. gathered wide experience in developing leading edge technological solutions. He has been heavily involved in developing Materials Management System, Manufacturing & Material Handlings applications, Process Control System Interfaces, Warehouse Control applications and Financial

Handlings applications, Process Control System Interfaces, Warehouse C ontrol applications and Financial © 2006 SAP AG

© 2006 SAP AG

1

applications in almost all the software projects he has undertaken. For the past 6 years, Aveek has

been associated with a number of SAP projects in India and abroad handling Process Control Interfaces in the Manufacturing area.

Aveek has been involved in

.

and abroad handling Process Control Interfaces in the Manufacturing area. Aveek has been involved in .

© 2006 SAP AG

2

Table of Contents

Table of Contents © 2006 SAP AG 3

© 2006 SAP AG

3

Data Flow Diagram

Schematic Diagram of Outbound Interfaces (Sample IDOC to message with file contents)

IDOC

Message(IDOC)

Message(FILE)

File

SAP Instance IDOC Outbound Processing Function module for outbound message processing Send IDOC Outbound Server
SAP Instance
IDOC Outbound
Processing
Function module for
outbound message
processing
Send
IDOC
Outbound
Server of SapLink
for R/3
Populate
Wrapper
Send
Message
MQ Series
Middleware Hub
Input Queue
Map
Transformation
Map
Engine
Map
MQ Series
Output Queue
Receiving
MQ Series
Input Queue
Server
Trigger
Process Message
Remove Wrapper
The initial
processing of
the message is
always triggered
by middleware
Write File
Load/Process File
Application
Scheduler
The loading of
the file can be
triggered by
middleware on
receipt or
scheduled by
the application
The loading of the file can be triggered by middleware on receipt or scheduled by the

© 2006 SAP AG

4

Customizing Overview

Our goal is to send purchase order data to an output port. The easiest way to do it is to use the IDOC output processing that is already defined in standard. Then, rather than sending the data to the vendor, 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 a partner function, an entry for the medium ALE and partner function RP (Receiving Plant, see below) has to be created. Regarding its fine-tuned control, this message should be defined for operation 1 (creation) and operation 2 (change). This message type can be linked to the existing

access sequence Z001.

Since the application EF (Purchase Order), from which the message control originates, generates only messages having as a partner type either VN or CU, dummy vendors will have to be created to represent the receiving plants. This is necessary because on entering a partner number in a condition record, a check for a corresponding vendor master record is carried out by the system. For this purpose, 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 the

above mentioned medium ALE and subroutine ALE_PROCESSING in the output type. An ALE distribution model is to be maintained with all the receiving plants as receiving logical systems and message type ORDERS. In the filter setting, the vendor number of the dummy vendors, identical

with the receiving logical systems, are to be entered.

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

This condition table has to be integrated into the access sequence as a new access. Since the message 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 to be created for every plant that needs to receive the message. Both the partner type and the partner function will be that of LS (logical system). The idoc format will be an enhancement of the standard idoc type ORDERS05. In the Message Control options, an entry for the application EF (Purchase Order), the newly created message output type Z005 and the process code ME10 has to be made.

(Purchase Order), the newly created message output type Z 005 and the process code ME10 has

© 2006 SAP AG

5

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 3 rd Party 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

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

© 2006 SAP AG

6

EDI Message Structure

EANCOM - ORDERS Message D 96A

Purchase order message

Page

Seg.N Status Max. Use

Segment

I D

UNH

BGM

DTM

FTX

Segment Name

 

1

M

1

MESSAGE HEADER

 

2

M

1

Beginning of message

3

M

35

Date/time/period

4

C

Free text

Order Notes

C

10

RFF

 

5

M

1

Reference

C

99

NAD-SG3-SG5

 

6

M

1

Name and address

 

C

10

RFF

 

7

M

1

Reference

C

5

CTA-COM

 

8

M

1

Contact information

9

C

Communication contact

C

200000

LIN-PIA-QTY-DTM-FTX-SG29

 

12

M

1

Line item

 

13

C

Additional product id

14

C

Quantity

3

M

35

Date/time/period

15

C

Free text Line Notes

Only as required

C

10

RFF

 

17

M

1

Reference

18

M

1

SECTION CONTROL

19

C

Control total

20

M

1

MESSAGE TRAILER

RFF19 C Control total 20 M 1 MESSAGE TRAILER SG2 SG1 NAD SG3 RFF SG5 CTA

SG2

SG1

NAD

SG3

RFF20 M 1 MESSAGE TRAILER RFF SG2 SG1 NAD SG3 SG5 CTA COM SG25 LIN PIA

SG5

20 M 1 MESSAGE TRAILER RFF SG2 SG1 NAD SG3 RFF SG5 CTA COM SG25 LIN
20 M 1 MESSAGE TRAILER RFF SG2 SG1 NAD SG3 RFF SG5 CTA COM SG25 LIN

CTA

COM

SG25

LIN

PIA

QTY

DTM

FTX

SG29

RFF

UNS

CNT

UNT

EDI Message Example

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

Example of proposed message

UNA:+.? '

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

message UNA:+.? ' UNB+UNOB:3+9301235852671:14+9300605123458:14+020525:1058+00000000453847' © 2006 SAP AG 7

© 2006 SAP AG

7

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

BGM+241+453847+9’

DTM+137:200205251059:203’

A "Delivery schedule" IDOC Nº, Original message

This Message Date & Time

FTX+ORI+1++PLEASE DELIVER ON CHEP PALLETS'

required

RFF+ON:4500000493’

NAD+BY+20005::92'

CTA+PD'

COM+021 9876543:TE'

NAD+SE+5001000668943::9

RFF+IA:0100000100'

CTA+SD'

COM+021 9246354:TE'

NAD+ST+9300605123458::9

LIN+10++9300605345676:EN’

GTIN – If available

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

Order Note (Delivery) Instructions –as

Customer Purchase Order Nº = 4500000493

Purchasing Plant code

Purchasing Contact

Telephone Nº 021 9876543

Vendor's GLN

Account number for the Vendor

Shipping Contact

Telephone Nº 021 9246354

Delivery Site's GLN Third Party Warehouse

First line of this Purchase Order (Line 10), Material

Material Code = 30532

QTY+21:48:CS’

DTM+2:200205260830:203’

and Vendor's Material Code

Quantity Ordered = 48 Cases

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 this

Material

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’

CNT+2:2' Two LIN segment(s) in this message UNT+143+00000000453847’ UNZ+1+00000000453847’ © 2006 SAP AG 8

© 2006 SAP AG

8

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 the destination

char(6)

fixed

yes

5

Mapping format

describe which message format will have to be produced

 

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 the Delivery GID / Delivery ID of the lookup table

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

/ Delivery ID of the lookup table The corresponding GLN code will be populated in the

© 2006 SAP AG

9

Customizing for Automated PO Download

Condition Tables

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

Automated PO Download Condition Tables SPRO-> MM->Purchasing->Me ssages->Output control © 2006 SAP AG 10
Automated PO Download Condition Tables SPRO-> MM->Purchasing->Me ssages->Output control © 2006 SAP AG 10
Automated PO Download Condition Tables SPRO-> MM->Purchasing->Me ssages->Output control © 2006 SAP AG 10

© 2006 SAP AG

10

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

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

© 2006 SAP AG

11

Access Sequence

Access Sequence used is Z002.

Access Sequence Access Sequence used is Z002. Maintain Message Types © 2006 SAP AG 12

Maintain Message Types

Access Sequence Access Sequence used is Z002. Maintain Message Types © 2006 SAP AG 12
Access Sequence Access Sequence used is Z002. Maintain Message Types © 2006 SAP AG 12

© 2006 SAP AG

12

The output type we need to consider is Z005.

General Tab when displaying the details of the output

Z005. General Tab when displaying the details of the output The access sequence in the config

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

Default values Tab:

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

© 2006 SAP AG

13

Processing Routine for the output type: for EDI

Processing Routine for the output type: for EDI © 2006 SAP AG 14
Processing Routine for the output type: for EDI © 2006 SAP AG 14

© 2006 SAP AG

14

Processing Routine for the output type: for ALE:

Processing Routine for the output type: for ALE: Partner Roles option for the output type Z005:

Partner Roles option for the output type Z005:

Processing Routine for the output type: for ALE: Partner Roles option for the output type Z005:
Processing Routine for the output type: for ALE: Partner Roles option for the output type Z005:

© 2006 SAP AG

15

Maintain Message types for message Control

Maintain Message types for message Control The Routine relevant for the Purchase Order downloa d is

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.

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

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.

* <<< INS HOTFIX.

check l_sysubrc = 0.

* Get partner information to condition record

select single PARVW PARNR from nach into (l_parvw, l_parnr) where KNUMH = l_knumh.

to condition record select single PARVW PARNR from nach into (l_parvw, l_parnr) where KNUMH = l_knumh.

© 2006 SAP AG

17

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.

*}

ENDFORM.

FORM KOBEV_911.

*{

INSERT

INSERT

G10K916219

perform KOBED_911.

*}

ENDFORM.

INSERT

l_parvw. *} ENDFORM. FORM KOBEV_911. *{ INSERT INSERT G10K916219 perform KOBED_911. *} ENDFORM. INSERT 1 ©

1

© 2006 SAP AG

18

Message Determination Schema

Message Determination Schema Click on RMBEF1 and double click the control data . This brings you

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

the control data . This brings you to the following screen. Make sure that the Z005

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

you to the following screen. Make sure that the Z005 output type is configured to the

© 2006 SAP AG

19

Config in VK01

Config in VK01 Enter the usage as B and the application as EF. This brings you

Enter the usage as B and the application as EF.

This brings you to the following screen

application as EF. This brings you to the following screen Choose Condition Types and press execute

Choose Condition Types and press execute button Choose Z005 and press the magnifying glass:

screen Choose Condition Types and press execute button Choose Z005 and press the magnifying glass: ©
screen Choose Condition Types and press execute button Choose Z005 and press the magnifying glass: ©

© 2006 SAP AG

20

This displays the following screen: © 2006 SAP AG 21

This displays the following screen:

This displays the following screen: © 2006 SAP AG 21

© 2006 SAP AG

21

Note the partner function is maintained as LS instead of VN. Press on the Partner

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

definition and enter the following details: There should be 2 entries for each EDI and ALE
definition and enter the following details: There should be 2 entries for each EDI and ALE

© 2006 SAP AG

22

For the processing program details enter the following:

For the processing program de tails enter the following: © 2006 SAP AG 23
For the processing program de tails enter the following: © 2006 SAP AG 23

© 2006 SAP AG

23

ALE Config

Partner Profile set up ( WE20).

Outbound Options

ALE Config Partner Profile set up ( WE20). Outbound Options © 2006 SAP AG 24
ALE Config Partner Profile set up ( WE20). Outbound Options © 2006 SAP AG 24

© 2006 SAP AG

24

Message Control

Message Control Note there are 2 entries in the message c ontrol one for create and

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

Message Control Note there are 2 entries in the message c ontrol one for create and

© 2006 SAP AG

25

Distribution Model

Distribution Model Setting up the automation in the master data © 2006 SAP AG 26

Setting up the automation in the master data

Distribution Model Setting up the automation in the master data © 2006 SAP AG 26
Distribution Model Setting up the automation in the master data © 2006 SAP AG 26

© 2006 SAP AG

26

The transactions we are in terested in are MN04/MN05. Enter output type Z005. In the

The transactions we are interested in are MN04/MN05.

The transactions we are in terested in are MN04/MN05. Enter output type Z005. In the following

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

Add the entries in th e screen for each plant GBEPCS1080 for ex and maintain the

© 2006 SAP AG

27

When a purchase order is deleted or changed at th e item level an idoc

When a purchase order is deleted or changed at the item level an idoc will be created but you will not be able to see the message in message control. This will be visible in the older transaction me22 instead of me22n. Enter the PO number then in the next screen click on the item- on the menu click on items ->> more functions messages. This should display the message details.

menu click on items ->> more functions messages. This should display the message details. © 2006

© 2006 SAP AG

28

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 PowerPoint 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 IBM Corporation 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 of Citrix Systems, Inc.

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

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.

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 their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves information 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 ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

These materials are provided “as is” without a warranty of any kind, either express or implied, including but not limited to, the implied warranties 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 may result 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 these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does 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 be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

by the usage of the Code, except if such dam ages were caused by SAP intentionally

© 2006 SAP AG

29