Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
JL23
Active Contributor

In this blog I want to show one of my most used and preferred migration option using IDOC and LSMW

The business case: Data migration with a SAP legacy system. Many companies use already SAP for several years. Companies buy other companies. Both run SAP. The decision is taken to consolidate many SAP systems into just one.

Challenge: the legacy system has data for plants that were shut down, closed companies and abandoned purchasing and sales organisations.

The good thing: your company actually owns all systems and you can customize and develop in all those systems.

The bad thing: all love their data and want rescue as much as possible. While in many cases where the legacy system is not a SAP system you just get an Excel extract with maybe 20 or 30 fields, with SAP as legacy system you have to deal with several hundred fields for material, vendor and customer master migration.

Writing extract programs is a huge effort, downloading data from maybe 10 or more different tables not really less work and you still have to get the data together again.

This was the basis to search for a better option where I finally found a well known feature that saves us a lot of work, especially for the extract: ALE

In brief: I setup an ALE distribution in the legacy system to send e.g. vendors as IDOC  to a file. And in the target system I develop my LSMW object using this file as source file for my data migration.

I do not explain any single LSMW step in this blog in deep detail as I described it in in my other blogs:

LSMW Material master by BAPI method - Part 1

LSMW Material master by BAPI method - Part 2

So i am just focusing here on the difference to these other blogs and the specific setup of ALE distribution and IDOC import method

The homepage of LSMW can be found here in SCN at http://scn.sap.com/docs/DOC-26158

In that document you can find the links to the general documentation in help.sap.com too: SAP Library - Legacy System Migration Workbench


Setup ALE distribution in legacy system:


1)   Define Logical System

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) > Basic Settings > Logical systems > Define Logical System: 

name it ZFILESY  and enter Filesystem for IDocs as description


2)  Maintain ALE Port Definition

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) > Modelling and Implementing Business Processes > Configure Predefined ALE Business Processes > Logistics > Logistics <-> External Systems > External Transportation Planning Systems > Maintain ALE Port Definition (Transaction WE21) 


The port need to be defined in  FILE  folder

Define Port: name it ZFILESY   enter a description:  IDOC to FILE in /DC_EX/M/

The IDOC record types for SAP Release 4.x need to be selected if you are in a system with release 4 or higher

The Unicode-Format field has to be activated if you are in a Unicode system

Enter physical directory /DC_EX/M/.   (I have to use a certain directory - this is due to a policy)

Select a Function module: I usually use EDI_PATH_CREATE_CLIENT_DOCNUM  , See F4 for alternatives

In order to prevent unprocessed files being overwritten, you use function modules which generate file or directory names dynamically, that is to say, at runtime.

Carry out an Access Test, this helps to identify wrongly entered directories and uncovers authorization issues.


3) Define Cross-System Company Codes

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) >  Modelling and Implementing Business Processes > Global Organizational Units > Cross-System Company Codes (Transaction OB72, SALE, OBB5)

a) Cross-System Company Codes

b) Assign Cross-System Company Code to Chart of Accounts

c) Assign Company Code to Cross-System Company Code

Cross-system company codes are used in the distribution in financial accounting. There is exactly one central system for each cross-system company code in the distributed environment. One company code has to be assigned to this cross-system company code on each system involved in the distribution.

When sending an IDoc with company code-dependent data, the company code is replaced with the cross-system company code in all company code fields.

Example:

Company Code

Migration

8740

8740

Company Code

Migration

4982

4982

Company Code

Migration

8787

8787

Company Code

Migration

8788

8788

4) Maintain Distribution Model

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) >  Modelling and Implementing Business Processes > Maintain Distribution Model and Distribute Views (Transaction BD64)

Here we need a distribution model

            Structure: model view (call it ZFILESY)

                                   Sending system (your choice)

                                               Receiving system  (ZFILESY)

!!! there is a valid from / valid to date – double click at distribution icon in front of the model!!!

Start with clicking the change icon, because this transaction starts as display

click Create Model view, enter technical name ZFILESY and a short text of your choice

then continue with Add message type, enter ZFILESY as Model view, you system as sender, ZFILESY as receiver and CREMAS as message type for vendor master distribution. Make use of F4, this helps to avoid typing mistakes

Actually for customer and vendors you can generate the distribution model and do not need to add each message type manually in BD64

Just go to

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) >  Modelling and Implementing Business Processes > Configure Predefined ALE Business Processes > Logistics > Master Data Distribution > Proposal for distribution model: Customer and vendor masters (Transaction WYL2)



5) Maintain ALE Partner Profiles

IMG > SAP NetWeaver > Application Server > IDoc Interface / Application Link Enabling (ALE) > Modelling and Implementing Business Processes > Configure Predefined ALE Business Processes > Logistics > Logistics <-> External Systems > External Transportation Planning Systems >  Maintain ALE Partner Profiles (Transaction WE20)

click the create button, then enter this data in the screen:


Partner profile type/Partner type: LS  logical system

Partner profile/Partner number: ZFILESY

Details at Post Processing agent

Typ: US user

Agent: your user ID

Lang: EN

Now click the icon for create outbound parameter below the section for outbound parameters

in next screen enter Message type e.g. CREMAS for vendors 

enter Receiver Port ZFILESY and Basic type CREMAS03

Very important: set the radio button to Collect IDocs, and do not start subsystem, and flag the box for Cancel processing after Syntax error


Send data by ALE.


BD14 Send vendors

Enter the message type CREMAS  and your target system, the logical system ZFILESY

Enter 1, several or none account number of vendor for distribution. No entry means you send ALL vendors, this can take some time as SAP has to read the vendor master and create IDOCs.

After execution you get a pop-up telling you how much IDocs got created for your message type

after you click continue you get another pop-up telling you how much communication IDOCs got created:

The IDocs are still not send at this time, continue with transaction BD87

If this second Pop-up shows error B1039   0 communication IDocs generated, then you have done some setting wrong

  • Check if message type exists in a distribution model (BD64)
  • Check if the distribution model is avctive for the current date (BD64)
  • Make sure the message type is added to the partner profiles (WE20)


BD87 Status Monitor for ALE Messages


In the selection screen of BD87 just enter your partner system and execute to find all your IDOCs

SAP lists per status (e.g. yellow - ready for dispatch; green - successfully dispatched) each message type with its number of IDOCs

Place the cursor on a message type below the yellow status.

If you just have a few IDocs, then you can continue and click the Process button.

If you have more than 5000 IDocs and you want them all in one file (which makes most sense, especially if you use partner functions for vendors, then you should migrate all vendors in one shot) then choose from menu EDIT > Restrict and process.

Don't be confused with this name "restrict" as you actually want the contrary.

SAP has now taken all your IDOCs into the multiple selection. And the best part is, that this multiple selection can take hundred thousands while multiple selections in normal selection screen may only take 3000 vendor numbers until the application dumps.

You only need to extend the value of maximum numbers of IDocs  beyond the numbers of IDOCs you have. This ensures that all IDOCs are going into one file. Otherwise SAP would create several files.

Execute.

you get a pop-up telling you how much IDOCs got selected,  then choose from menu Program > Execute in Background

as it may take several hours to distribute those IDOCs

After the background job has finished, you can find the file with the IDOCs via AL11 transaction in the directory that you entered in your Port definition

Further it has the name that was automatically created via the function module entered in the port defintion.

The detail looks unstructured compared to normal flat files created from an Excel Spreadsheet:

In the second part of this blog I will describe how to read this file as source file in LSMW.

This second part can be found here:

LSMW migration with IDOC method  and using IDOC as source  Part2: Import

20 Comments
Labels in this area