Skip to Content

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

ALE.JPG

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) 

we21.JPG


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

BD64 Model view.JPG

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

BD64 message type.JPG

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)


WYL2.JPG


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

WE20 Detail.JPG

Send data by ALE.


BD14 Send vendors

BD14.JPG

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

BD14_a.JPG

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

BD14_b.JPG

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

BD87 Selection.JPG

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

BD87 b.JPG

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.

BD87 c.JPG

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.

AL11.JPG

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

AL11 detail.JPG

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

To report this post you need to login first.

19 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member

    Hi Jurgen,

    I am testing the tool for Material Masters Upload. As a tool LSMW was chosen using BAPI SAVEDATA. All the fields are updated in the material masters except for the one – Profit Center. I have no clue what could be the point.

    1) this field is populated into IDOC when I check the IDOC.

    2) there is a tick in the MARCX structure.

    The only problem I see as this field is marked as mandatory. Could it be the issue then?

    (0) 
    1. Jürgen L Post author

      Profit Center is as well mandatory in my materials and I have no issue with the BAPI.

      What does the application log tell you? did you eventually miss leading zeros?

      (0) 
      1. Former Member

        Thanks for the reply, Jurgen. In my case, there are no leading zeros as the profit center field is 10 characters long and the name of the profit center is exactly 10 characters. It is just a real miracle.
        Just a quick question: in the structure E1BP_MARCX, what is the value in the PROFIT_CTR field?

        The idoc is created sucessfully with status 53 so there are no application logs availabe.

        (0) 
        1. Jürgen L Post author

          E1BP_MARCX-PROFIT_CTR should have a capital X.


          Can you please open a seperate discussion on that, as this question is not really related to this blog. And comments should not be used to ask new questions.

          thank you.

          (0) 
  2. Ali Dai

    Hi Jurgen,

    I am trying to do this procedure for mass opening of materials to another company code and during step 4) Maintain Distribution Model i have an error that “Logical system ZFILESY unknown”. I have done all the steps from the beggining.

    Shall i first define ZFILESY as a logical system?

    (0) 
      1. Ali Dai

        Sorry…you are sooo wright! 🙂

        I continued to the next steps and i processed the Idoc. I have a sucess message that IDoc written to file and if i double click it it says the directory, but i do not see it in AL11.

        Why is that?

        (0) 
            1. Jürgen L Post author

              If it got stored in the file system and you have these extraordinary rights then you should be able to click the configure button in AL11 to create a name for this directory so that it can be displayed in AL11

              (0) 
  3. Former Member

    Hi Jurgen,

    I could process IDoc and it was written to file ‘/int/V16/outboundO_300_0000000093721725’, but I cannot see in that directory this file.

    What do you think there may be the issue?

    (0) 
    1. Jürgen L Post author

      Usually authorization issues for AL11, talk to your basis team, they have certainly options and rights to locate that file and have usually as well the role to grand access rights.

      (0) 
      1. Former Member

        Thanks, for prompt response.

        Finally found out why it is not inserting the file in the directory.

        Directory should be specified with ‘/’ (slash) at the end like this ‘/int/v16/outbound/’.

        Previously it was ‘/int/v16/outbound’. So therefore system could not understand the final folder.

        (0) 
        1. Jürgen L Post author

          but that actually means you could not process the IDOC successfully, you must have received an error directly that you can’t write to that directory. The button “Access Test” in WE21 should have shown an error already.

          (0) 
              1. Former Member

                i don’t know where it wrote.

                i guess we do not have that directory, at least i don’t have it in AL11.

                i do have directory ‘/int/v16/’ with slash at the end, but i don’t have file written in it.

                my opinion – the root-cause:

                The message was ‘/int/V16/outboundO_300_0000000093721725’.

                If you noticed there is no slash between ‘/int/V16/outbound’ and ‘O_300_0000000093721725’, so i think it just did not written anywhere.

                I just can state that the issue solved by putting slash at the end of directory name, maybe this is specific for my system (in youtr screenshot i see slash at the end).

                sorry for spamming your post with this ))

                (0) 
                1. Jürgen L Post author

                  If SAP says it has written /int/V16/outboundO_300_0000000093721725

                  then I would search for file outboundO_300_0000000093721725  in the directory /int/V16/

                  (0) 

Leave a Reply