This blog explains how to use the
S/4HANA Migration Cockpit to mass import locations in SAP Environment, Health and Safety. It is applicable for recent versions of
S/4HANA and
S/4HANA Cloud, public edition and private edition. It contains a brief description how to do the import and an example.
Preface
Creating a lot of locations manually and adding them to the location hierarchy can be a tedious task using the
UI. First, you have to create all locations and secondly you need to add them to the location hierarchy. This can sum up to many clicks. With the
S/4HANA Migration Cockpit, you can model your locations and their hierarchy in Excel files and mass import them.
Importing Locations using the Migration Cockpit
There are two relevant migration objects:
EHS - Location and
EHS - Location hierarchy. Add both objects to an existing or new migration project. The prerequisite objects are not mandatory.
Importing Locations
First, download the migration template for the
EHS - Location migration object and fill it with your locations. Most fields are optional. All mandatory fields are on tab
Location Revision.
Each row on this tab represents a revision of a location. If your locations haven't changed over time, you need only one revision per location which in turn means one row per location. You can enter them like this:
Once you've filled your location template, you can upload and migrate the locations.
In the mapping step, you can upload the mapping templates to avoid manual mapping of the values for location type and status:
Importing the Location Hierarchy
Secondly, download the migration template for the
EHS - Location hierarchy object.
The file contains only two tabs for data entry
Location Hierarchy Revision and
Location Hierarchy.
On tab
Location Hierarchy Revision, you need to create exactly one row with a name for the fields
Location Hierarchy Revision Key and
Revision Name, for example "Initial Revision". The interesting thing here is the field
Revision Start Date. The import can either add locations to an existing hierarchy revision or create a new hierarchy revision. Usually, you want to import locations into an existing revision where you already have some locations. For that, set
Revision Start Date to the start date of that existing hierarchy revision. You can look it up on the
Edit Location Structure screen reachable from the
Manage Locations app. If you choose a
Revision Start Date that does not match an existing revision, it will create a new blank hierarchy revision with just the locations you provide.
In the downloaded template goto tab
Location Hierarchy and create a row for each of your locations by copying the location keys from the
EHS - Location template into the columns
Location Hierarchy Key and
Location Key.
Fill in the
Location Hierarchy Revision Key that you have used for the previous tab.
Now, you just have to specify which is the parent location for each location, by providing its location key in field
Parent Location Key. If a location should be on top of the hierarchy, just leave the field blank.
You don't need to provide any values in the
Location ID and
Parent Location ID columns. These are alternative ways to build up the hierarchy using the numeric IDs instead of the key. Since, yo've first imported all the locations, the system already knows the mapping between the textual keys entered in the template and the technical keys in the database.
Once the template is ready, upload it and migrate the data.
After successful migration, you can view your location hierarchy in the app
Manage Location.
Example Locations
You can download an example for location and location hierarchy from SAP-samples on GitHub:
https://github.com/SAP-samples/ehs-environment-management-samples/tree/main/locations
If you want to import it into your system, make sure the
Revision Start Date is right.
This is the resulting location hierarchy:
Further Information