Sunteți pe pagina 1din 46

INTEGRATE

Microsoft DynamicTM NAV

Multi-site and International


Organizations: Integration of
SAP and Microsoft Dynamics
NAV Installation Guide
Based on Microsoft BizTalk Server 2004 with Microsoft Dynamics NAV
Commerce Gateway and SAP Business Suite

White Paper

Created by Magnus Management Consulting and Qurius

March 2007

www.microsoft.com/dynamics/nav
Contents
1. Introduction ...............................................................................................................3
1.1 Business Transactions.............................................................................................................................................................. 3

2. System Landscape......................................................................................................5
2.1 Hardware & Software platform............................................................................................................................................. 5
2.2 Installation Prerequisite........................................................................................................................................................... 5

3. System settings and Master data..............................................................................6


3.1 SAP Customization................................................................................................................................................................... 6
3.2 SAP Master Data...................................................................................................................................................................... 12
3.3 Setting up Microsoft Dynamics NAV .............................................................................................................................. 14
3.4 Microsoft Dynamics NAV Database Modifications .................................................................................................... 20
3.5 Microsoft Dynamics NAV Setup Remarks ..................................................................................................................... 22

4. Master Data Upload to Microsoft Dynamics NAV .................................................24


4.1 IDOC Setup for Master Data Transfer.............................................................................................................................. 24

5 Financial Consolidation ............................................................................................26


5.1 SAP Specific Settings/Financial Statements .................................................................................................................. 26
5.2 Interfacing with SAP .............................................................................................................................................................. 26

6. Microsoft BizTalk Server .........................................................................................28


6.1 Interfacing to and from SAP .............................................................................................................................................. 28
6.2 Interfaces.................................................................................................................................................................................... 29

7. Custom Abap in the R/3 IDES system .....................................................................31


7.1 Introduction.............................................................................................................................................................................. 31
7.2 Custom BAPIs .......................................................................................................................................................................... 31

8. EXTENDED MATERIAL MASTER IDOC.....................................................................36

9. UPDATE ABAP PROGRAM FOR EXPORTING EXTENDED MATMAS IDOC.............40

10. Appendix ................................................................................................................42


10.1 Installation Prerequisites..................................................................................................................................................... 42
10.2 List of SAP – Microsoft Dynamics NAV Interface Mappings ............................................................................... 43
10.3 Custom Modifications in Standard SAP....................................................................................................................... 44

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
1. Introduction
The Multi-site and International Organizations concept refers to a parent or holding company that uses
one business software system, which is integrated with the systems used by its individual subsidiaries or
divisions (the sites). This document describes a business scenario involving a parent company and its
sales offices (sites). In this scenario, the parent company and the sales offices have a vendor-customer
relationship. The sales offices purchase at the parent company and keep stock as a buffer for their own
sales. The end-customers receive deliveries directly from the sales office.
The parent company runs SAP R/3 while its sales offices register sales and other business activities in
Microsoft Dynamics NAV. The business transactions between parent and sales office are supported by
the exchange of messages. The content of this document is focused on the step-by-step
implementation of business processes and integration between SAP and Microsoft Dynamics NAV. It will
deal with both functional and technical issues. The business processes are explained in the first part of
the document; the second part has a more technical nature and describes the Microsoft BizTalk Server
and Microsoft Dynamics NAV Commerce Gateway interfaces and custom SAP R/3 ABAP programming.
1
A demonstration environment has been set up to implement the scenario . The business scenario can
be simulated using a demo script that describes the transactions from the user’s point of view in both
Microsoft Dynamics NAV and SAP. Please refer to this document for practical information concerning
the use of SAP and Microsoft Dynamics NAV application components in relation to the scenario. This
document describes a single sales office setting. In order to build up a similar scenario, the reader is
assumed to have basic knowledge of SAP and/or Microsoft Dynamics NAV.

1.1 Business Transactions


The parent company sells products to the sales office. The basic elements of this order-to-stock
transaction between sales office and parent are shown in the figure below.

R/3

Sales Order Purchase order

Advanced Shipping
Notification +
Purchase Receipt
Delivery

Sales Invoice Goods Receipt


Purchase Invoice

1
The scenario in this document uses Microsoft Dynamics NAV release 4.0. This same scenario can also be implemented
with release 5.0.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
In this scenario, the SAP parent and Microsoft Dynamics NAV sales office essentially have a vendor-
customer relationship. Information is exchanged; goods are shipped.

1.1.1 Purchase Order from Microsoft Dynamics NAV to SAP


In this scenario, demand planning is done locally at the sales office, and therefore, internal business
rules in the sales office trigger purchase activities. A purchase order containing quantities, prices and a
required delivery date is sent from Microsoft Dynamics NAV to SAP. A standard SAP sales order is
created upon receipt of a purchase order received from Microsoft Dynamics NAV. A SAP sales order
number is automatically created if the transaction is successful. The sales order captures the Microsoft
Dynamics NAV purchase order number, which is used as a tracking reference number both by SAP
(parent company) and Microsoft Dynamics NAV (sales office) throughout the business process.
A custom-made program and a standard SAP BAPI for sales order generation are used to transform
the inbound Microsoft Dynamics NAV purchase order into a SAP sales order.

1.1.2 Shipping Notification and Delivery from SAP to Microsoft Dynamics NAV
When the complete order can be delivered, a delivery is created after which a goods issue is done in
SAP. Both transactions are manual. The delivery note created in SAP acts as a pick request for the
warehouse to pick the order. The picked quantities are then manually updated in the delivery note. A
goods issue in SAP depletes the stock levels in the system and makes a financial posting to reduce the
value of the stock. This usually happens when the actual physical goods leave the warehouse to be
delivered.
A goods issue process results in material and accounting documents being created in SAP. The
creation of the delivery note, updating the pick quantities and goods issue can be done directly in the
delivery note (one transaction in SAP). When the goods issue is done and the delivery note is saved,
the shipping notification message is automatically triggered and sent to Microsoft Dynamics NAV.
The shipping notification creates an Inbound Microsoft BizTalk Purchase Receipt document in
Microsoft Dynamics NAV. This receipt automatically updates the Expected Receipt Date in the Purchase
Order indicating when the complete order (total quantity of all requested items) will arrive at the sales
office. The SAP shipping notification document number is also captured as the Vendor Shipment no.
in the Microsoft Dynamics NAV Purchase Order.
The mechanism for the interface uses a standard SAP IDOC. The IDOC is generated via the print
program in the order document as soon as the document is saved.

1.1.3 Invoice Document from SAP to Microsoft Dynamics NAV


Since the sales invoice is delivery-based, the outbound delivery and goods issue will first have to be
created in SAP before the sales invoice can be created. The sales invoice message consists of the sales
price for each item that has been ordered from the Microsoft Dynamics NAV sales office. The total
amount to be paid to the parent company is calculated in Microsoft Dynamics NAV. The Microsoft
Dynamics NAV purchase order number is also recorded in the sales invoice.
The invoice triggers the creation of an Inbound Microsoft BizTalk Purchase Invoice document in
Microsoft Dynamics NAV. This invoice automatically updates the Due Date in the Purchase Order
indicating when a payment is expected from the sales office. The SAP sales invoice document number
is also captured as the Vendor Invoice no. in the Microsoft Dynamics NAV Purchase Order.
The mechanism for the sales invoice interface uses a standard SAP IDOC. The IDOC is generated via
the print program in the sales invoice document as soon as the document is saved.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
2. System Landscape

2.1 Hardware & Software platform


Hardware Software
SAP R/3 Compaq ProLiant Microsoft Windows Server 2000 + SP4
2x 550 Mhz Pentium III Oracle Database 9.2.0.6
2 Gb RAM SAP R/3 470x110 IDES (ABAP 6.20)
100 Gb hard drive capacity

Microsoft Dynamics NAV Virtual Server: Windows Microsoft Dynamics NAV 4.00 build 19914
and Microsoft BizTalk Server 2003 Microsoft Dynamics NAV Application Server
Server 2004

2.2 Installation Prerequisite


NOTE: Please refer to the appendix for solutions to issues for the different systems.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
3. System set tings and Master data
The business transactions described above depend on system settings and master data. The system
settings form the organizational and technical structure, and the master data is the basis for content in
the business transactions. This section describes the system settings for both SAP and Microsoft
Dynamics NAV concerning the integration of their processes. The starting point for the SAP
configuration is a running IDES (Internet Demo and Evaluation System). The Microsoft Dynamics NAV
setup details begin at the installation of the Microsoft Dynamics NAV database and client.

3.1 SAP Customization


In SAP, configuring the system is called “customizing.” This functionality provides all the means to
configure the system and make it fit to an organization and its business processes. In other words, the
customization does not concern operational data, but rather, the business structure and business
process definition. Customizing in SAP is done in the Implementation Management Guide (IMG) and
has a tree-like structure. Screenshots of the relevant areas in this structure have been included in the
text below.

3.1.1 Customizing the Organizational Structure in SAP


A standard SAP IDES environment has been customized to incorporate the Microsoft Dynamics NAV
sales office on an operational and financial level. This paragraph describes the elements that have been
customized to create the scenario.

SAP Transaction: SPRO

SAP Implementation guide: Enterprise Structure - Definition


IMG Area Activity Description
Financial Accounting Define company code 2500 Create a company code for the parent company.
This is the smallest organizational unit where
accounting transactions are registered. There
is one single, standard company code for the
SAP parent for which a chart of accounts has
been defined. All financial transactions which
involve the parent company are registered in
this company code.
Define company code 2510 The Microsoft Dynamics NAV sales offices are
represented as separate company codes in the
SAP system. The reason for this setup is that it
facilitates the financial consolidation of the
sales offices. (This is explained on page 25)
Logistics – General Define plant 2500 Create a site which represents the operating
area of the parent company.
Define division 00 A division is an organizational part of the
sales area through which products are sold to
customers.
Sales & Distribution Define Sales Organization 2500 All sales are registered on this organizational
level.
Define Distribution Channel 12 Part of the sales area.
Materials Management Define Storage Location 0001 Physical location where stock is kept.
Logistics Execution Define Shipping Point 2500 Point from which deliveries leave the plant.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
SAP Transaction: SPRO

SAP Implementation Guide: Enterprise Structure - Assignment


IMG Area Activity Description

Financial Accounting Assign company code 2500 to credit Credit control area 1000 is the standard IDES
control area 1000 control area for Europe.

Controlling Assign company code 2500 to Activate cost accounting functionality for the
controlling area 1000 company code. Controlling area 1000 is the
standard IDES controlling area for Europe.
To make postings to cost elements possible
(for example, to distribute the costs to a cost
center, or to make an internal order), you
must assign a company code to a controlling
area. For this demo, we used account
792000, which is also presented as a cost
element in controlling
(because of the SAP standard setup). Of
course, the decision to include a controlling
area depends on many factors, which are not
really relevant for this demo.

Logistics – General Assign plant 2500 to company code A plant belongs to one company code.
2500

Sales & Distribution Assign sales organization 2500 to Link financial accounting (company code
company code 2500 level) to the sales activities.

Assign distribution channel 12 to Distribution channels and divisions are


sales organization 2500 linked to sales organizations. The sales area
can then be set up using combinations of
Assign division 00 to sales
sales organizations, distribution channels
organization 2500
and divisions. For the scenario, a single sales
Set up sales area 2500/12/00 area is used, as there is just one sales
channel for intra-company sales.

Assign sales organization – Define the plant that will provide goods for
distribution channel – plant the sales area.
Logistics Execution Assign shipping point 2500 to plant A shipping point is part of a plant.
2500

SAP Transaction: SPRO


SAP Implementation Guide: Financial Accounting
IMG Area Activity Description

Financial Accounting Assign chart of accounts INT to The standard SAP chart of accounts INT is
Global Settings company codes 2500 and 2510 used for both parent and sales office.

General Ledger Define financial statement version 2510 is the company code that corresponds
Accounting – Business 2510 to 2510 in Microsoft Dynamics NAV. The
Transactions – Closing financial statement version is a default SAP
– Documenting standard financial statement containing
assets, liabilities, P&L, financial results, taxes,
and so on. This financial statement was
already available in the system and did not
need improvement.

General Ledger Define financial statement version 2500 is the consolidation company code.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Accounting – Business 2500 Therefore, we would only like to see the
Transactions – Closing consolidation accounts in the financial
– Documenting statement version. A new financial statement
was needed.

SAP Transaction FS00


Change reconciliation account for Reconciliation accounts for a vendor or
vendor customer are setup in SAP for automatic
posting only. Therefore, you cannot post
directly to these accounts. Account 165000
needed to be changed to make manual
posting possible for this demo. Therefore, we
connected 165000 to a general ledger
account group without the check for
automatic posting. NOTE: This is a necessary
setting, without which posting is not
possible.

The resulting system setting/customizing consists of organizational structures that allow:


• General ledger accounting for company code 2500 (parent company)
• Cost accounting for company code 2500 in controlling area 1000
• Sales activities in sales area 2500/12/00 (Sales Organization/Distribution Channel/Division)

3.1.2 Customizing “Sales & Distribution” in SAP


Two sales documents are used in the scenario:
• Sales order confirmation
• Sales invoice
Both the sales order confirmation and the sales invoice used in the scenario are standard SAP IDOCs.
There are no modifications in the way the documents are generated as the scenario is based on
standard SAP functionality. All the parameters described below are available in a standard SAP IDES
environment.
The first step for sending a sales order confirmation is the Output Type definition for the sales order.
Output type BA00 is the standard type for sales order confirmation and can be accessed in the path
shown below. The sales invoice is set up in the same way, but has output type RD00. The rest of this
paragraph describes the process of setting up the sales order confirmation message.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
The output type does not define one single medium used for creating the output. The image below
shows that there are various methods to output a sales order confirmation. (Printer, fax, EDI) Medium
six allows us to send IDOC messages and will be explained in the next step.

In the second step, the system can link the output type and specific medium to a business partner.
This is useful because you might deal with some business partners who want to have paper forms
while others prefer electronic messages. The condition record created below shows that sales order
confirmations for business partner 2510 are created using medium 6, which means that an electronic
message is created as soon as the sales order has been saved in the SAP system. This is not part of the
customization but is closer to transactional/master data and thus accessed in the standard SAP user
menu as transaction W11.

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
An actual sales order document (transaction VA03 – display) contains the reference to the output type
and shows the status of this output (whether it is paper or otherwise). This is illustrated below. The log
for sales order 9366 show that output type BA00 (order confirmation) has been created in the form of
an IDOC message that has been forwarded for transmission.

At this point, we turn to the configuration of the IDOC subsystem where partner profiles are created for
every business partner, with which the system needs to exchange electronic messages. Partner profiles
are accessed using transaction WE20.

Note: for paper output, the process would stop right here.

10

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
The sales office is represented as a standard customer. A corresponding partner profile has been
created to define that the system will allow three types of IDOC messages to be sent to this particular
business partner (outbound parameters):

Message Type Description Basic Type


DESADV Advanced shipping notification DELVRY01

ORDRSP Sales order confirmation ORDERS05

INVOIC Sales invoice INVOIC01

In the details of each message type, there are further configuration settings like the basic type and their
message control. A basic type is a hierarchical division of messages types. While a message type is a
generic name for EDI messages, a basic type is the message itself. In other words, a message type
groups one or more basic types. The message control parameters define for which specific output type
an IDOC can be created. For the sales order confirmation, this is output type BA00.
This concludes the setup for the sales order confirmation and invoice messages. The configuration
above allows the automatic creation and transmission of IDOCs and uses standard SAP functionality.

Sales Order Confirmation


Sales Document Type OR Standard Order
Output type BA00 Order Confirmation

Output Determination Procedure V10000 Order Output

11

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Message Type ORDRSP Purchase order / order confirmation

Basic Type ORDERS05 Purchasing/Sales

As indicated earlier, the sales order confirmation will only reach the sales office if the parent company
cannot meet the requirements of the purchase order sent by the sales office.

Sales Invoice
Billing Type F2 Invoice

Output type RD00 Invoice

Output Determination Procedure V10000 Billing Output

Message Type INVOIC Invoice/Billing Document


Basic Type INVOIC01 Invoice/Billing document

3.1.3 Customizing “Logistics Execution” in SAP


The advanced shipping notification IDOC is customized in the same way as the sales documents
described above. The output type for this message is LAVA and is created and sent after the Goods
Issue (GI) has been posted in the system.

Shipping Notification
Delivery Type LF Delivery

Output Type LAVA Outg. ship.notifica.

Output Determination Procedure V10000 Header output

Message Type DESADV Delivery: shipping notification

Basic Type DELVRY01 Delivery interface

3.2 SAP Master Data


Besides the customizing described above, the SAP environment needs master data to process the
business transactions. The following paragraphs describe the master data needed to set up the multi-
site and international organization integration.

3.2.1 Sales Offices as Customers to Parent Company

Customer master record 2510

In an ‘all-SAP’ solution where both parent and sales offices operate within a SAP landscape, the sales
offices would be separate plants and/or sales organizations depending on whether they carried
inventory or not. This setting would make it possible to register the individual sales activities of every
sales office. However, the multi-site and international organization scenario demands another
approach where end-customer sales are registered at the parent company as monthly net figures
provided by the sales office. The replenishment of stock at a sales office takes place in a vendor-
customer relationship. This allows the parent company to capture its intra-company sales and isolate it
for financial consolidation purposes at a later stage. In order to create this scenario, the sales office is
set up as a standard customer master record in the SAP system. This customer master is referenced
when creating sales orders for the sales office. For this scenario, customer master record 2510 has been
created using transaction XD01.

12

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
3.2.2 Sales Offices as Company Codes in SAP

Company code 2510

Sales offices are set up as company codes in order to create financial postings for the consolidation at
the end of the month. Company code 2510 has been created for this purpose in the same way as the
company code 2500 for the parent company.

3.2.3 Products Used in Transactions

Material master records P-100 up till P-108


Material Masters P-100 and up until P-108 have been set up for selling to the sales office. They are
finished products (type FERT) with a standard cost price. These material masters are part of the IDES
system and have not been changed for this scenario. Access the material master using transaction
MM03.

3.2.4 Price Lists


Currently two types of price lists have been setup in SAP with the help of transaction VK31. One price
list is an “Inter-company Price List” that provides transfer prices, which are prices that are agreed upon
by the parent company and its sales offices as a purchase price. The other price list is a “Retail Price
List” that consists of prices that the parent company has set as the suggested retail price when sales are
made to end-customers. The price lists have been created using the standard SAP price list with no
modifications. Only the sales prices (no taxes) are listed. The mechanism for interfacing is using an
IDOC. Only the “Inter-company Price List” is sent to Microsoft Dynamics NAV for this scenario since
end-customer sales are outside the scope of this scenario.

3.2.5 Chart of Accounts


The standard SAP international chart of accounts (INT) is used to do G/L accounting in the parent
company code 2500 and sales office 2510.

Chart of Accounts INT

13

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
3.2.6 End-Customer Masters
The end-customer master data will be interfaced between SAP and Microsoft Dynamics NAV. The
standard SAP customer master data has been used with no modifications. The mechanism for the
interface uses a standard SAP IDOC. Each end-customer will have a SAP customer, and this same
number will be used in Microsoft Dynamics NAV when an end-customer sale is made. End-customer
master data is transferred for demonstrational purposes but is not used in actual sales transactions.

C1_2510 End-customer 1 for sales office


C2_2510 End-customer 2 for sales office

3.3 Setting up Microsoft Dynamics NAV


The organizational structure in a Microsoft Dynamics NAV sales office is simpler when compared to
SAP. There is a company definition with an area of activity represented by a division. This division sells
to end-customers in this scenario and generates sales revenues which, at a later stage, are consolidated
in the SAP Company.
The next paragraph provides the installation steps for Microsoft Dynamics NAV. The setup is based on
the FOB file bundled with this document (Microsoft Dynamics NAVRelease_MBS.zip).

3.3.1 Installation Procedures


• Install the Microsoft Dynamics NAV database server from the CD using the standard Microsoft
Dynamics NAV Installation manual.
• Install a Microsoft Dynamics NAV Client from the CD using the standard Microsoft Dynamics
NAV Installation manual.
• Install the Microsoft Dynamics NAV Application Server from the CD using the standard
Microsoft Dynamics NAV Installation manual.

Use the startup-parameter “HUBSPOKE” for the NAS.


Have the NAS run with a user account that has all rights in the folders in the chapter “Setup
information.” In Microsoft Dynamics NAV, this user has to have SUPER/ALL rights.
• Import the FOB file into the database.

3.3.2 Post Installation Setup


• Setup Company Information for inter-company message exchange for End-Customer and
Financial Consolidation
• Setup Microsoft BizTalk Management for message exchange using Commerce Gateway
• Setup Microsoft BizTalk Partner for Commerce Gateway message exchange for Product
Catalog and Purchasing

14

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Setup Company Information

In Microsoft Dynamics NAV, go to “Administration”  “Application Setup”  “General”  “Company


Information.” Fill the following fields in the Inter-company tab with the correct information:

Field Description
Timer Interval The interval the NAS uses to poll for XML documents

Item Inbox Leave blank

Customer Inbox The folder name where the customer documents are saved by SAP XI

Purchase Price Inbox Leave blank


Shipment Confirmation Inbox Leave blank

Shipment Rejection Inbox Leave blank

Invoice Inbox Leave blank

Consolidation Outbox The folder that is used as standard outbox for consolidation documents

Make sure all these folders exist. Also make sure all these folders have an “Archive” and “Error”
subfolder. Processed documents are moved into the “Archive” subfolder, and documents which result
in an error are moved into the “Error.” subfolder.
After entering and saving this information, the NAS needs to be (re)started. Check the Windows event
log for error or warning messages.
Make sure these folders are available for the user running the NAS from the machine that is running
the NAS.
Drive mappings cannot be used because they probably do not exist in the service context of the user.

Setup Microsoft BizTalk Management


In Microsoft Dynamics NAV, go to “Administration”  “IT Administration”  “Commerce Gateway” 
“Management Setup.” Fill the following fields in the Communication tab with the correct information:

15

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Field Description
Rqst. Srv. IP Address IP address of the server that contains the Microsoft BizTalk Server and the
Commerce Gateway Request Server

Rqst. Srv. Port No. Number of the port that the Commerce Gateway Request Server is listening
to

Rqst. Srv. Transport Type Transport type that is used for communicating with your business partner

Appln. Srv./Broker IP Address IP address of Microsoft Dynamics NAV Commerce Gateway Broker

Appln. Srv./Port No. Number of the port that the Microsoft Dynamics NAV Commerce Gateway
Broker is listening to

Microsoft BizTalk Organization The unique identification number that you agree with your partner to use to
ID identify your companies

Use Encryption A check mark in this field indicates that the program is set up to use strong
encryption when sending documents from the client to the Commerce
Gateway Request Server and when receiving documents from the Microsoft
BizTalk Server to the Microsoft Dynamics NAV Application Server

Setup Microsoft BizTalk PartnerCompany Information


In Microsoft Dynamics NAV, go to “Administration”  “Application Setup”  “Commerce Gateway” 
“Partner Setup.” Fill the following fields in the General tab of the Partner Setup Header with the correct
information:

16

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Field Description
Microsoft BizTalk Partner No. Automatically generated Microsoft BizTalk Partner no.
Partner Type Current Microsoft BizTalk partner is a vendor

Partner No. Microsoft Dynamics NAV vendor number for the specific Microsoft BizTalk
partner taken from the Vendor Table

Partner Name Microsoft Dynamics NAV vendor name for the specific Microsoft BizTalk
partner

Microsoft BizTalk Organization The unique identification number that you agree with your partner to use to
ID identify your companies

Destination Address Destination address for the document(s) you are sending

Use Company ID Need to add a company ID to the document you are sending, in order to
allow the receiving company’s Microsoft BizTalk Server to identify the
document

When you exchange documents electronically with your Microsoft BizTalk partners, you must indicate
both the relevant rules of exchange and which type of agreements or documents you want to include
in the Microsoft BizTalk partner agreement for each specific Microsoft BizTalk partner.
The Microsoft BizTalk Partner Setup Header contains the relevant exchange rules for each Microsoft
BizTalk partner, and the Microsoft BizTalk partner setup lines contain data on the included types of
agreements or documents, and indicates whether they are active.

17

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
For purposes of this demo, only the following types of documents were activated and exchanged:
• IC Import Product Catalog – this is an extended version of the standard Product Catalog that
contains more fields.
• Purchase Order – standard version was used.
• Purchase Receipt – standard version was used.
• Purchase Invoice – standard version was used.
Fill the following fields in the Purchase Document tab of the Partner Setup Header with the correct
information:

Field Description
Purchase Item Number Purchase item number that you and your Microsoft BizTalk partner have
agreed to use.

Auto Purchase Receipt Allows you to indicate whether the program should process a Microsoft
BizTalk purchase receipt manually or automatically.

Purch. Order Cnfmn. (Qty) If the quantity of items is different, indicate that the referenced Microsoft
Dynamics NAV purchase order should be adjusted or validated.

Ord Confmn Combd If the direct unit cost is different, indicate whether the referenced Microsoft
Amt/Cost/Disc. Dynamics NAV purchase order should be adjusted or validated.

Purch Ord Confmn. Expd Rcpt If the expected receipt date is different, indicate whether the referenced

18

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Microsoft Dynamics NAV purchase order should be adjusted or validated.

Auto. Purchase Invoice Allows you to indicate whether the program should process a Microsoft
BizTalk purchase invoice manually or automatically.

Purchase Invoice Indicate, for this specific Microsoft BizTalk partner, whether the program
should create a new Microsoft Dynamics NAV purchase invoice or find and
update the referenced Microsoft Dynamics NAV purchase order to reflect the
information in the Microsoft BizTalk purchase invoice.

Inv. Combined Amt/Cost/Disc. If the direct unit cost is different, this field allows you to indicate whether the
referenced Microsoft Dynamics NAV purchase order should be adjusted or
validated

Update Purchase Comments Indicate whether the referenced Microsoft Dynamics NAV purchase order
comments should be added or ignored.

Fill the following fields in the Product Catalog tab of the Partner Setup Header with the correct
information:

Field Description
Product Item No. Indicate what product item number you and your Microsoft BizTalk partner
have agreed to use.

Auto Product Catalog Indicate whether the program should process a Microsoft BizTalk product
catalog manually or automatically

Item Import Action Indicate whether the program should update relevant items, create new
items or update and create new items in the Microsoft Dynamics NAV Item

19

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
table when you validate Microsoft BizTalk product catalogs.

Item Import Destination Indicate to which destination the program will update the items that you
import from the Microsoft BizTalk product catalog. Options are Item Card,
Item Vendor Catalog or both.

Use Vendor Item Number Purchase item number that you and your Microsoft BizTalk partner have
agreed to use.

Def. Gen. Prod. Posting Group Default general product posting group that will be used for all items
imported from inbound product catalogs. The value in this field will be
copied to the Gen. Prod. Posting Group field in the Item table.

Def. Vat Prod. Posting Group Default VAT product posting group that will be used for all items imported
from inbound product catalogs. The value in this field will be copied to the
VAT Prod. Posting Group field in the Item table.

Def. Inv. Posting Group Default inventory posting group that will be used for all items imported from
inbound product catalogs. The value in this field will be copied to the Def.
Inv. Posting Group field in the Item table.

3.4 Microsoft Dynamics NAV Database Modifications


The following paragraphs give a summary of what has been modified in the Microsoft Dynamics NAV
database as compared to standard functionality.

3.4.1 Import Overall (NAS startup)


• Added fields to the Company Information table, which represent the import folders of the
different kinds of data.
• Created a "NAS Code unit" which initializes a timer to process the import folders.
• Added logic to Code unit 1 to use the NAS with parameter HUBSPOKE.
All data will automatically import.

3.4.2 Import of Microsoft BizTalk Inter Company Product Catalog [Items and Purchase Prices)]
• Created new Microsoft BizTalk Product Catalog Schema for new fields, i.e. Costing Method,
Standard Cost, Item Category Code, Product Group Code and Ending Date.
• Added functionality to Auto accept inbound Microsoft BizTalk IC Product Catalog.
• Added “Start date” field to the Vendor Price Table (Item Card -> Purchases -> Prices).

3.4. 3 Export of Microsoft BizTalk Purchase Order


• Standard Microsoft BizTalk Purchase Order used.
• Fixed some Microsoft BizTalk PO fields that were not correctly mapped to the corresponding
XML fields.

3.4.4 Import of Microsoft BizTalk Purchase Receipt


• Standard Microsoft BizTalk Purchase Receipt used. Referenced PO updated (config setting).
• Fixed some Microsoft BizTalk PO fields that were not correctly mapped to the corresponding
XML fields.

3.4.5 Import of Microsoft BizTalk Purchase Invoice


• Standard Microsoft BizTalk Purchase Invoice used. Referenced PO updated (config setting).

20

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
• Fixed some Microsoft BizTalk PO fields that were not correctly mapped to the corresponding
XML fields.

3.4. 6 Import End-Customers


• Created inbound table for the XML data.
• Created new Code unit which uses XMLDOM to import & validate the material data.
• Used XMLDOM because of some problems with namespace tags which are in the XML
document
• Import is done in 2 steps
• Import into inbound table.
• Process of the inbound table.
• This is done because it is now possible to split the process in two: importing and processing,
which can be done by 2 different NAS.

3.4. 7 Export of Financial Consolidation


• Created menu option to start the export.
• Created new form from which the user can enter start date, end date and filename. After this,
the user can start the export.
• Created XML Port for the export of the data.

3.4.8 Modified Microsoft Dynamics NAV Objects


The table below summarizes the objects that have been modified to implement the business scenario.

Type ID Name Version List New/Changed


Table 79 Company Information NAVW14.00,NAVNL3.70 Changed
Table 418 IC Inbox Transaction NAVW14.00 Changed

Table 420 Handled IC Inbox Trans. NAVW14.00 Changed

Table 426 IC Outbox Sales Header NAVW14.00 Changed

Table 427 IC Outbox Sales Line NAVW14.00 Changed


Table 50000 Item Synch New

Table 50001 Customer Synch New

Table 50002 Bank Synch New

Table 50003 Purchase Price Synch New


Table 99008504 Inbound Product Catalog Hdr. NAVW14.00 Changed

Table 99008505 Inbound Product Catalog Line NAVW14.00,IC,EH Changed

Table 99008513 Microsoft BizTalk Partner Setup NAVW14.00,IC,EH Changed


Header

Form 1 Company Information NAVW14.00 Changed

Form 50 Purchase Order NAVW14.00,NAVNL3.70 Changed

Form 50000 Consolidation New

Form 99008521 Product Catalog Subform NAVW13.10,IC,EH Changed

21

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Form 99008523 Microsoft BizTalk Partner Setup NAVW14.00 Changed

Report 511 Complete IC Inbox Action NAVW14.00 Changed

Report 8001 Inventory Status NAVW14.00 Changed


Report 50002 GLDel New

Dataport 50000 Import GL New

XMLPort 12 IC Outbox Imp/Exp NAVW14.00 Changed

XMLPort 50002 Consolidation Synch Export New

XMLPort 50051 IC Inb. Product Catalog IC,EH New

XMLPort 99008501 Inbound Product Catalog NAVW14.00 Changed

XMLPort 99008504 Outbound Purchase Order NAVW14.00,EH Changed

XMLPort 99008506 Inbound Purchase Receipt NAVW14.00 Changed


Codeunit 1 ApplicationManagement NAVW14.00,NL4.00 Changed

Codeunit 427 ICInboxOutboxMgt NAVW14.00 Changed

Codeunit 435 IC Inbox Import NAVW14.00 Changed


Codeunit 50000 NAS Startup Hub-Spoke EH New

Codeunit 50001 NAS Hub-Spoke process EH New


document

Codeunit 50005 XMLDOM Remove namespace New


Codeunit 50011 Import Item XMLDOM EH New

Codeunit 50012 Import Customer XMLDOM EH New

Codeunit 50013 Import Purchase Price EH New


XMLDOM

Codeunit 50050 IC Microsoft BizTalk Product IC,EH New


Catalog

Codeunit 99008504 Purchase Invoice-Accept NAVW14.00 Changed

Codeunit 99008505 Purchase Receipt-Accept NAVW14.00 Changed


Codeunit 99008507 Product Catalog-Accept NAVW14.00 Changed

Codeunit 99008515 XML Document-Receive NAVW14.00,IC,EH Changed

Codeunit 99008518 XML Document-Transform NAVW14.00,IC,EH Changed


Codeunit 99008528 Microsoft BizTalk Appln. Srv. NAVW14.00 Changed
Startup

Codeunit 99008529 XML Document-Accept NAVW14.00,IC,EH Changed


Codeunit 99008530 Product Catalog Line-Accept NAVW14.00,IC,EH Changed

MenuSuite 90 Company New

3.5 Microsoft Dynamics NAV Setup Remarks


Preprocessor: A pre-processor has been built because there are some documents that are imported
through the same XML Ports as other documents are exported, and there were problems with the
namespace.

22

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
File system for transport between SAP and Microsoft Dynamics NAV: The file system for transport is
used because this is a very easy transport. It is also the only one that is fully integrated into Microsoft
Dynamics NAV. Another possibility would have been MSMQ (communication components), especially
when both systems are not at the same location.

Costing Method for Items


The costing method is set as “Standard Costing” in Microsoft Dynamics NAV.
Expected cost posting is set to false for inventory of items
This is done to show that General Ledger postings generated by Microsoft Dynamics NAV for inventory
are the same as those generated by SAP, and thus not to complicate the consolidation. Financial
postings for inventory are generated only after goods receipt and invoicing of purchase orders.

Purchase Receipts and Invoicing


Invoices exported from SAP are imported into Microsoft Dynamics NAV as confirmation only.
Microsoft Dynamics NAV posts the purchase orders to invoice based on data available in Microsoft
Dynamics NAV and not on imported “Purchase invoice from SAP.”
For the purpose of this project, the vendor pricing of items, imported from SAP to Microsoft Dynamics
NAV, is presumed to be valid for one year. Only new prices are added for new items that are created in
SAP for export to Microsoft Dynamics NAV.

23

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
4. Master Data Upload to Micros oft Dynamics NAV
Certain SAP master data will need to be uploaded into Microsoft Dynamics NAV to facilitate the
business processes. This master data needs to be present in Microsoft Dynamics NAV before any
sales/purchase activity can take place. There are four sets of master data to be uploaded to Microsoft
Dynamics NAV:
Chart of Accounts
The chart of accounts as it is defined in SAP will be mirrored in Microsoft Dynamics NAV. A Microsoft
Excel file with all the BS/P&L accounts will be integrated in Microsoft Dynamics NAV. This makes end-
of-month financial bookings and consolidation more straightforward. The file is transferred directly to
Microsoft Dynamics NAV for manual integration and does not pass through the SAP XI server. This was
done because it is a one-time setup and would be relatively time-consuming to process through the
SAP XI server.
Product Master and Product Pricing
The standard SAP product master structure is used for purchasing and sales activities.
Two sets of price lists for the products are created. One contains the inter-company pricing
agreements and the other contains end-customer pricing recommendations for the sales offices.
For this scenario, the Product Master and its inter-company price only are interfaced with Microsoft
Dynamics NAV.
The product master with pricing is exported to Microsoft Dynamics NAV using the standard Material
Master IDOC MATMAS03 extended with an additional segment to include the product’s inter company
price.
End-Customer Master
This master data is transferred for technical/demo purposes mostly. End-Customers have SAP sales
offices (the sales offices) assigned to them. Customer master records C1_2510 and C2_2510 represent
two end-customers for sales office 2510 for example. Exported to Microsoft Dynamics NAV using
standard IDOC DEBMAS06.

Message Type Description Basic Type


DEBMAS Customer master data distribution DEBMAS06

MATMAS Material master + Price MATMAS03 + Segment : ZE1KONH

4.1 IDOC Setup for Master Data Transfer


The outbound IDOCs are set up in a similar way as the inbound IDOCs discussed earlier. However, the
difference is that the partner profile for the outbound IDOCs is linked to a logical system and not to a
customer profile.
The logical system is the Microsoft BizTalk server, which is the ‘logical’ destination of the outbound
IDOCs. Second, there is no business trigger for the distribution of master data; this is done manually
using standard SAP transactions. The process of uploading master data is described in detail in the
demo script document.

24

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
25

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
5 Financial Consolidation
End-of-month consolidation will take place in SAP and is done by uploading the total purchasing
amounts from Microsoft Dynamics NAV in an XML file to SAP. Both Microsoft Dynamics NAV and SAP
have the same chart of accounts with identical G/L accounts, so therefore, every account in Microsoft
Dynamics NAV is mirrored in SAP.

5.1 SAP Specific Settings/Financial Statements


In SAP, two company codes have been set up: 2500 and 2510. Company 2500 is the parent company
and uses financial statement version 2500 for the end consolidation. This financial statement is defined
by using the total inter-company accounts. Company 2510 serves as the financial connection between
Microsoft Dynamics NAV and SAP. Company 2510 uses a different Financial Statement Version: 2510.
This is a standard SAP financial statement version.

5.2 Interfacing with SAP


In order to post the purchasing-results from Microsoft Dynamics NAV to SAP, you must use a SAP
posting interface. This creates an official SAP posting. Therefore, we need to use standard BAPI
(Business Application Programming Interfaces). The interface used is BAPI_ACC_GL_POSTING_POST.
BAPIs in SAP allow us to post SAP standard postings with all the normal posting checks we need.

5.2.1 Graphic Display of the Consolidation Process


Exchange of purchasing total accounts/amounts:

2510

165000
Accounts Payable 1 Accounts Payable
145000
Tax Account 2 Tax Account
231100
Loss Freight Variances 3 Loss freight Variances
792000
Finished Goods Inventory 4 Finished Goods Inventory
Inventory inventory

Explanation:
• The graphics above show the matches of the accounts in both systems.
• Accounts payable are the total I/C postings on all accounts payable in Microsoft Dynamics
NAV.
• Finished goods inventory are the totals of the standard cost price of the purchased goods.

26

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
• Loss freight variances are the total of the calculated difference between the standard cost price
and the transfer price.
Showing the results on company 2510 in SAP
The results on company 2510 will be shown when running Balance/Financial Statement named 2510.
Report RFBILA00 is standard functionality used to display the Balance/Financial Statement. This
Financial statement is a standard statement.
Showing the consolidation results on company 2500 in SAP
In order to see the financial consolidation In company 2500, you must run RFBILA00 with Financial
Statement 2500. This financial statement is made with the inter company accounts to show the total
amounts of the consolidation.

27

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
6. Microsoft Bi zTalk Server
The SAP Exchange Infrastructure (XI) is used in the multi-site and international organization scenario as
an integration broker between SAP and Microsoft Dynamics NAV. The communication between SAP
and XI is carried out by IDOCs (SAP standard interfacing documents) and BAPIs (SAP Business
Objects). The picture below shows the interfaces.

6.1 Interfacing to and from SAP


There are two interfacing methods used:
• IDOC
Outbound IDOCs are documents that can be created by SAP. For example, when a sales order
has been created and saved (trigger) an IDOC with all information of the sales order is sent to
another system.
• For SAP inbound IDOCs, it is possible to trigger an action, e.g. creating a material. Another
system can send an IDOC with material master information, and SAP can create a material
based on this information.
• BAPI
BAPIs contain functions that can be executed from outside SAP by using RFC connections.
There is an RFC to create a material. The structure to call this function is far less complex than
sending an IDOC with the same information.
Choice between BAPIs and IDOCs

28

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Due to the complexity of IDOCs, the scenario uses BAPIs for the inbound SAP-interfaces. The
structures and tables as input for the BAPIs are less complex than for IDOCs. For the outbound SAP
interface, IDOCs are implemented because these are created by SAP and contain far more data than
BAPIs can return.

6.2 Interfaces
The interfaces for the multi-site and international organization model are summarized below:

Interface Source Destination


1. Materials (IDOC MATMAS03 with Segment : ZE1KONH ) SAP Microsoft Dynamics NAV

2. Customers (IDOC DEBMAS03) SAP Microsoft Dynamics NAV

3. PurchaseOrder (Z_BAPI_CREATESALESORDER FROMDAT2 Microsoft SAP


Dynamics NAV

4. ShipmentNotification (IDOC DELVRY01) SAP Microsoft Dynamics NAV

5. Invoice (IDOC INVOIC01) SAP Microsoft Dynamics NAV

6. Financial Consolidation (BAPI Bapi_Acc_GL_ Microsoft SAP


Posting_Post) Dynamics NAV

6.2 1 SAP Interface Definitions


All document definitions required for the SAP interfaces are based on SAP BAPIs and IDOCs
information. For the BAPIs, there are input/output definitions, which can be imported in Microsoft
BizTalk using the Microsoft BizTalk SAP Adapter. The IDOCs are messages defined in SAP. The structure
of an IDOC can also be automatically imported in Microsoft BizTalk using the SAP Adapter.

29

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
6.2.2 Microsoft Dynamics NAV Interface Definitions
The document definitions of Microsoft Dynamics NAV are available in Microsoft Commerce Gateway.
The definitions of the documents that are not available in Microsoft Commerce Gateway (customer
master and financial consolidation) are added to Microsoft BizTalk Server manually.

6.2.3 Interface Mappings


All mappings are included in the Visual Studio package provided. The functional descriptions of the
mappings are included in the mapping documents (See the package).

30

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
7. Custo m Abap in the R/3 I DES s ystem
The demo requires custom ABAP programming in R/3.

7.1 Introduction
All the custom ABAP is described in this section. Of course, we are assuming that
you are logged on to the SAP R/3 IDES system.

7.2 Custom BAPIs


Start transaction SE80.
Create a new Function group with the name ZMICROSOFT DYNAMICS NAV.
You have now created a container for the two custom BAPIs that will create the sales order and
perform the financial consolidation.

7.2.1 Z_BAPI_SALESORDER_CREATEFROMD2
This BAPI is creating a new sales order in the SAP system. It is a wrapper for the standard BAPI
BAPI_SALESORDER_CREATEFROMDAT2.

We use a custom wrapper in order to do explicit assumption about the business scenario and generate
an implicit database commit, so the update is made without an explicit call of a second database
commit.
Create a new function with the name Z_BAPI_SALESORDER_CREATEFROMD2.

Check the radio button “Remote-enabled module.” This enables the BAPI to be called from external
systems. Then, go to the Import sub screen and fill in the following data:

31

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Go to the Tables tab:

Now go to the Source tab and follow the menu:

32

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Utilities->more utilities->Upload/Download->Upload and upload the file
Z_BAPI_SALESORDER_CREATEFROMD2_SOURCE in the folder ABAP Source

7.2.2 Z_BAPI_ACC_GL_POSTING_POST
The next BAPI we have to make is a wrapper for the standard BAPI
BAPI_ACC_GL_POSTING_POST.

In order to make things simpler and to avoid having to call a second BAPI to do the commit end for
making the functional assumptions explicit, we created a custom BAPI.
The steps are the same as in the previous one.
Start transaction SE80 and open function group ZMICROSOFT DYNAMICS NAV (if not already open).
Go to the left navigation tree:

Mark Function Modules and in the context menu, create a new function module with the name
Z_BAPI_ACC_GL_POSTING_POST. Now, go to the Attribute tab and again mark the radio button
“Remote-enabled module”.

33

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Go to the Import tab:

Go to the Export tab:

34

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Go to the Tables tab:

Go to the Source tab and upload the following file: Z_BAPI_ACC_GL_POSTING_POST_SOURCE in the
map “ABAP source”. Activate the function group and assign it to a request.

35

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
8. EXTENDE D MATERIAL MA STER IDOC
The Standard MATMAS03 IDOC was extended to include Segment: ZE1KONH. This segment consists of
the material purchase price. The export program was updated to ensure that the Extended MATMAS03
IDOC with the pricing segment could be exported to Microsoft Dynamics NAV.
Below are the steps to extend MATMAS03 IDOC with a new segment for prices.
To create a new segment with the necessary fields for material purchase prices, go to Trx. WE31 and
enter the Segment Type: ZE1KONH – Price list conditions.

Then, select the relevant fields below to be added in this segment. Save and release the segment when
completed.

36

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Field Name Description
1. DATAB Valid-From Date

2. DATAVI Valid To Date

3. KSCHL Condition type i.e. PROO (Standard Price)

4. KBETR Rate (condition amount or percentage)

5. KONWA Rate unit (currency or percentage)


6. KPEIN Condition pricing unit, i.e. EUR

7. KMEIN Condition unit, i.e. PCS

To Extend the MATMAS IDOC with the new segment, go to Trx. WE30 and create a new Extension
Object: ZPRICES.
This object is the extension of the MATMAS03 IDOC with the new segment: ZE1KONH.
Select the segment: E1MVKEM – Master Material Sales Data and insert the new Segment: ZE1KONH.

37

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
Save and release the extension.
To assign the extension to the MATMAS03 Message Type, go to Trx. WE82 and insert a new entry for
MATMAS03 with the following values:

Message type MATMAS (supplied with the standard system)


Basic type MATMAS03
Extension ZPRICES
Release 470

Save the entry.


Update the partner profile to include the sending of MATMAS03 IDOC and the extension: ZPRICES. Go
to Trx. WE20.
Enter the ZPRICES extension in the IDOC Type section and save the entry.

38

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
39

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
9. UP DATE ABAP PROGRAM FO R EXPORTING EXTENDED
MATMA S IDOC
Importing the SAP Transport Request: MESK900127 (See 10. Appendix for the SAP modification code)
will provide all the necessary ABAP coding and allow you to export the Extended MATMAS03 IDOC
with prices. See instructions below. (The modification files are also part of the installation package
provided.)

1. Uncompress the zip file: MESK900127 containing the SAP Transport ‘MESK900127. This file
consists of the updated Export program for Material Masters.

2. In this compressed file, there are two transport files:

K900127.MES
This is the control file for the transport. The information about the transport (transport owner,
transport routes, etc., is saved in this file.

This file should be placed on the SAP Server in a directory similar to:
<filesystem>\usr\sap\trans\cofiles\

R900127.MES
The second file is the data file that contains the actual data of the transport request.

This file should be placed on the SAP Server in a directory similar to:
<filesystem>\usr\sap\trans\data\

3. Login to SAP. The user should have authorization rights for SAP’s Transport Management
System (STMS).

4. Follow the steps below to import the configuration settings into SAP IDES 4.7.
i. Goto Trx. STMS

ii. Click on the button (Import Overview) to see the Import Overview
iii. Select (double-click) the system to import the configuration into, i.e. Development
system.
iv. On the Extras menu, select Other Requests -> Add

v. Enter the Transport Request number: MESK900127 and press Enter.


vi. The transport request will then be visible in the Transport Queue.

40

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
vii. Click on the button (Import Request) to import the configuration into the
selected SAP system.
viii. There might be a Warning message that is displayed, but this can be ignored.

41

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
10. Appendix
10.1 Installation Prerequisites
Microsoft BizTalk 2004 & the Microsoft BizTalk SAP Adapter
• Install the .NET Connector 1.0.3 (SetupRuntime .NET Connector 1.0.3) prior to installing the SAP
Adapter for Microsoft BizTalk
• Apply the following patches to the Microsoft BizTalk .NET Connector (in this order):

KB 884553 FIX for: The receipt is not successful when you use the Microsoft BizTalk Adapter 2.0
for mySAP Business Suite to receive an IDOC in Microsoft BizTalk Server 2004

KB 885425 FIX for: You receive a "The adapter failed to transmit message going to send port"
error message in the Microsoft BizTalk Adapter 2.0 for the mySAP Business Suite

KB 893055 Internal Microsoft KB Article


KB 894182 FIX for: The Microsoft BizTalk Adapter for mySAP Business Suite incorrectly converts a
Unicode IDOC message stream to single-byte characters (ANSI)

SAP R/3 Modifications for the Microsoft BizTalk SAP adapter


The Microsoft BizTalk SAP Adapter generates an xsd schema from an IDOC. The SAP Material Master
schema generation for MATMAS05 is incorrect. Microsoft BizTalk uses the SAP RFC
“IDOCTYPE_READ_COMPLETE” to generate the xsd schema. The function module
“SEGMENT_EXTERNAL_NAME_GET” of the RFC “IDOCTYPE_READ_COMPLETE” needs to be modified
so that it always uses the latest version of the segments independent of the SAP release.

IF L_RESULT <> 0.
MESSAGE ID 'EA' TYPE 'E' NUMBER 238
WITH SEGMENTTYP RAISING SEGMENT_NOT_EXISTING.
ENDIF.
*3)
*{ DELETE MESK900127 1
*\ IF RELEASED = SPACE.
*\ READ TABLE LT_SEGDEF INTO L_SEGDEF INDEX 1.
*\ ELSE.
*\ LOOP AT LT_SEGDEF INTO L_SEGDEF WHERE RELEASED <= RELEASED
*\ AND RELEASED <> SPACE.
*\ EXIT. "Take first entry
*\ ENDLOOP.
*\ ENDIF.
*\ IF SY-SUBRC <> 0.
*\ MESSAGE ID 'EA' TYPE 'E' NUMBER 257 WITH SEGMENTTYP
*\ RELEASED RAISING VERSION_NOT_EXISTING.
*\ ENDIF.
*} DELETE
*{ INSERT MESK900127 2
*<AB PROJECT="SAP<->MICROSOFT BIZTALK<->MICROSOFT DYNAMICS NAV" DATE="2005/06/30"
DESCRIPTION=
* "GET LATEST VERSION INDEPENDANT OF RELEASE>
READ TABLE LT_SEGDEF INTO L_SEGDEF INDEX 1.
* </AB>
*} INSERT

IF HELP = 4. " segnam30 is not required -> we are almost finished


WA_CACHE1-SEGMENTTYP = SEGMENTTYP.
WA_CACHE1-RELEASED = RELEASED. "we use here the requested release !
WA_CACHE1-HELP = HELP.

42

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
WA_CACHE1-EXPORTLENGTH = L_SEGDEF-EXPLENG.
* wa_cache1-SEGNAM30 = " not used if help = 4.
WA_CACHE1-SEGNAM40 = L_SEGDEF-SEGDEF.
WA_CACHE1-VERSION = L_SEGDEF-VERSION.
APPEND WA_CACHE1 TO EXTERNAL_CACHE1.
EXPORTLENGTH = WA_CACHE1-EXPORTLENGTH.
SEGNAM30 = WA_CACHE1-SEGNAM30.
SEGNAM40 = WA_CACHE1-SEGNAM40.
VERSION = WA_CACHE1-VERSION.
EXIT.
ENDIF.
*4) help = 3 : segnam30 is requested
L_LENG = STRLEN( L_SEGDEF-SEGDEF ).
*4a)
IF L_LENG <= 10.
L_SEGDEF30 = L_SEGDEF-SEGDEF.
** if version 000 strip off last three zeros since in 3.0/3.1 we had
** space as initial version code
** last three characters are version number !
SUBTRACT 3 FROM L_LENG.
IF L_LENG > 5.
ASSIGN L_SEGDEF-SEGDEF+L_LENG(3) TO <TAIL>.
** if the version '000' is created in 4.0 or later and we want to send
** to release < 4.0 we will cut off the last 3 zeros since
** the very same segment defined in 3.0/3.1 will not have this zeros
IF <TAIL> EQ '000' "#EC PORTABLE
AND (
( L_SEGDEF-RELEASED GE '4' ) "#EC PORTABLE
OR ( L_SEGDEF-RELEASED EQ SPACE ) ). "#EC PORTABLE
ASSIGN L_SEGDEF-SEGDEF(L_LENG) TO <HEAD>.
L_SEGDEF30 = <HEAD>.
ENDIF.
ENDIF.
ELSE.
*4b) length of l_segdef-segdef > 10; look in translation table
SELECT * FROM SEGEXTCONV WHERE EXTNAME40 EQ L_SEGDEF-SEGDEF.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE ID 'EA' TYPE 'E' NUMBER 274 WITH L_SEGDEF-SEGDEF
SEGMENTTYP RELEASED RAISING CONVERSION_NOT_AVAILABLE.
ELSE.
L_SEGDEF30 = SEGEXTCONV-EXTNAME30.
ENDIF.
ENDIF.
* 4c) write in cache and give result for 4a (anyway) and 4b(if OK)
WA_CACHE1-SEGMENTTYP = SEGMENTTYP.
WA_CACHE1-RELEASED = RELEASED. "we use here the requested release !
WA_CACHE1-HELP = HELP.
WA_CACHE1-EXPORTLENGTH = L_SEGDEF-EXPLENG.
WA_CACHE1-SEGNAM30 = L_SEGDEF30.
WA_CACHE1-SEGNAM40 = L_SEGDEF-SEGDEF.
WA_CACHE1-VERSION = L_SEGDEF-VERSION.
APPEND WA_CACHE1 TO EXTERNAL_CACHE1.
EXPORTLENGTH = WA_CACHE1-EXPORTLENGTH.
SEGNAM30 = WA_CACHE1-SEGNAM30.
SEGNAM40 = WA_CACHE1-SEGNAM40.
VERSION = WA_CACHE1-VERSION.
ENDFUNCTION.

10.2 List of SAP – Microsoft Dynamics NAV Interface Mappings


Filename
SAP-NAV ProductCatalog_Microsoft Dynamics NAVICPCxml(Interco).xls

43

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
SAP BAPISOCreate_Microsoft Dynamics NAVPOxml.xls

SAP-NAV SalesInvoice_Microsoft Dynamics NAVPIxml.xls

SAP-NAV ShipNote_Microsoft Dynamics NAVPRxml.xls


S21 SAP-NAV Customer_Master.xls

SAP-NAV BAPI GL_POST.xls

SAP Export Program for Extended MATMAS can be found in the following file:

Filename
MESK900127.zip

10.3 Custom Modifications in Standard SAP

Sending materials
Although we put price information in the standard IDOC MATMA03, the standard BD10 transaction
ends with an error message. Therefore, use standard BD10 to send a message, and we use an extended
IDOC type ZPRICES. The reason is that the transaction BD10 always checks the generated IDOC, which
is ZPRICES, against MATMAS05; this is “hard coded” by SAP.
In order to modify SAP so that it checks against ZPRICES, the following modifications need to be
applied to the function module “MASTERIDOC_CREATE_MATMAS.”
Please go to SE37, fill in the name of the function module and change to edit mode.
You are now asked to fill in a modification key (if not available it must be required from SAP OSS).
Insert the code between the INSERT tags.

*{ INSERT MESK900127 1
* <AB PROJECT="SAP<->MICROSOFT BIZTALK<->MICROSOFT DYNAMICS NAV" DATE="2005/06/30"
DESCRIPTION=
* "STANDARD SAP TAKES ALWAYS THE LATEST IDOC, BUT IN
* OUR CASE WE ARE USING MATMAS03 EXTENSION ZPROCES INSTEAD
* OF MATMAS05>

DATA: LV_EDP13 TYPE EDP13.

* Get IDOC type for this partner and this message type.
* Standard SAP uses hard coded "MATMAS05"

SELECT SINGLE *
FROM EDP13 INTO LV_EDP13
WHERE RCVPRN = F_IDOC_HEADER-RCVPRN
AND RCVPRT = F_IDOC_HEADER-RCVPRT
AND MESTYP = F_IDOC_HEADER-MESTYP.

* Fill the relevant fields


F_IDOC_HEADER-DOCTYP = LV_EDP13-IDOCTYP.
F_IDOC_HEADER-CIMTYP = LV_EDP13-CIMTYP.

* </AB>
*} INSERT

* Distribute IDOC
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = F_IDOC_HEADER
TABLES

44

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
COMMUNICATION_IDOC_CONTROL = T_IDOC_COMM_CONTROL
MASTER_IDOC_DATA = T_IDOC_DATA
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 01
ERROR_WRITING_IDOC_STATUS = 02
ERROR_IN_IDOC_DATA = 03
SENDING_LOGICAL_SYSTEM_UNKNOWN = 04.

DESCRIBE TABLE T_IDOC_COMM_CONTROL LINES COMM_CONTROL_LINES.


CREATED_COMM_IDOCS = COMM_CONTROL_LINES.
te_IDOC_control[] = t_IDOC_comm_control[]. "note0373519

ENDFUNCTION.

Filling the extended fields


Now, in order to populate this segment in runtime, there are lots of user exits. There is always a user
exit to populate the self-defined segments. In this case, use the following enhancement projects:

Extend ZXMGVU03

*&---------------------------------------------------------------------*
*& Include ZXMGVU03 *
*&---------------------------------------------------------------------*

DATA: ze1konh TYPE ze1konh.

DATA: a306 TYPE a306,


konp TYPE konp,
e1maram TYPE e1maram,
e1mvkem TYPE e1mvkem.

CHECK message_type EQ 'MATMAS'.

CHECK segment_name EQ 'E1MVKEM'.

* <DATA SELECTION>
* MATNR EN SALESORGANISATION
LOOP AT IDOC_data.

CASE IDOC_data-segnam.
WHEN 'E1MARAM'.
MOVE IDOC_data-sdata TO e1maram.
WHEN 'E1MVKEM'.
MOVE IDOC_data-sdata TO e1mvkem.
ENDCASE.

ENDLOOP.

*CHECK e1mvkem-vkorg = '2500'.

SELECT SINGLE *
FROM a306
WHERE kappl = 'V'
AND kschl = 'PR00'
AND vkorg = e1mvkem-vkorg
AND vtweg = e1mvkem-vtweg
AND pltyp = '01'
AND matnr = e1maram-matnr
AND datab <= sy-datum
AND datbi >= sy-datum.

SELECT SINGLE *

45

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV
FROM konp
WHERE knumh = a306-knumh.

* </DATA SELECTIE>

* <FILL IDOC SEGMENT ZE1KONH>


* het hoofdprogramma moet de gegenereerde IDOC checken volgens
* de definitie van ZPRICES
IDOC_cimtype = 'ZPRICES'.

*INITIALIZE CUSTOMER SEGMENT


CLEAR: ze1konh.

MOVE-CORRESPONDING:
a306 TO ze1konh,
konp TO ze1konh.
* </FILL IDOC SEGMENT ZE1KONH>
* <ADD SEGMENT TO IDOC>
IDOC_data-segnam = 'ZE1KONH'.
IDOC_data-sdata = ze1konh.
APPEND IDOC_data.
* </ADD SEGMENT TO IDO>

About Microsoft Dynamics

Microsoft Dynamics is a line of financial, customer relationship, and supply chain management solutions that help businesses work
effectively. Delivered through a network of channel partners providing specialized services, these integrated, adaptable business
management solutions work like and with familiar Microsoft software to streamline processes across an entire business.

For more information about Microsoft Dynamics, please visit www.microsoft.com/dynamics.

Address:
Microsoft
Frydenlunds Allé 6
2950 Vedbaek
Denmark
Tel +45 45 67 80 00
Fax +45 45 67 80 01

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication.
Because Microsoft must respond to changing market conditions, this document should not be interpreted to be a commitment on the part of Microsoft,
and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.
This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION
IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be
reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording,
or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document.
Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these
patents, trademarks, copyrights, or other intellectual property.

46

MULTI-SITE AND INTERNATIONAL ORGANIZATIONS: INTEGRATION OF SAP AND MICROSOFT DYNAMICS NAV

S-ar putea să vă placă și