Upgrading to SAP PI 7.1: last time ABAP saved my life
During an upgrade project (XI 3.0 to PI 7.1) my team had the need to manage a real complex scenario with more then 300 Legacy Systems defined in the System Landscape Directory.
For each environment we had to create the corresponding Business Systems in the SLD, which means 300 for the Development + 300 for the Quality + 300 for the Production, a total of 900 Legacy Business Systems.
If you are familiar with the SLD and its fast response time, you probably know that the creation of 900 Business Systems by a single person in a single life is nearly impossible..
To reduce the time needed to create all Third Party Business Systems and also to minimize the risk of errors during the manual definition we created our own tool.
Before explaining how the tool works, let me give a short introduction about the SLD and how components are defined.
The system Landscape Directory can be seen as an LDAP containing information about systems and software, every object that exists in the SLD is defined using Classes, collection of properties, and Associations, relations between classes.
For instance the class LogicalALESystem defines an Ale Logical System Name and obviously one of it’s key properties, used to uniquely identify the object inside the SLD, is the ALE Name.
The association ALESystemViewedBusinessSystem is a link between two classes, the LogicalALESystem and the LogicalBusinessSystem and its role is to associate the ALE Name to the Business System.
Associations are technically based on handles, unique references (pointers) to specific objects, for this reason, before creating an association it is necessary to gather the handles of all objects to be linked.
All possible classes and associations, together with their properties and key values, are defined in the SLD under the Cim Instances Area.
In order to understand which classes and associations are created while a user defines a new Business System via user interface, we created a new Business System and analyzed the change log available under SLD >> Administration >> Change Log.
During the creation the Wizard asks for the following parameters:
- Name of the Business System (to be created)
- Name of the Logical System Name (to be created)
- Name of the Technical System (existing)
- Name of the Host Name (existing)
- Name of the Integration Server Business System (existing)
- Name of the Group (existing)
To Summarize, the steps for the creation of the Business System are:
1. Validate input parameters
2. Connect to the SLD
3. Identify handle of existing objects needed during the following steps
3.1. Technical System
3.3. Integration Server Business System
3.4. Business System Group (Collection)
4. Create Objects
4.1. SAP_BusinessSystem: create a Business System instance
4.2. SAP_GlobalUniqueID: create a general Global Unique Identifier (GUID)
4.3. BusinessSystemGuid: associate the GUID to the Business System
4.4. LogicalSystemViewedSystem: associate the Technical System to the Business System
4.5. SAP_LogicalALESystem: create the Logical System Name
4.6. SAP_ALESystemViewedBusinessSystem: associate the Logical System Name to the Business System
4.7. SAP_InstalledProductLogicalApplicationSystem: associate the Product to the Business System
4.8. SAP_BusinessSystemExchangeServer: associate the Business System to the Integration Server
4.9. Modify SAP_BusinessSystem (add Role): add the Role “Application System” to the Business System
4.10. SAP_CollectedBusinessSystems: associate the Business System to the Group
Additionally, the tool has to implement a transactional behavior so that the creation of the business system is never partial but always fully completed or rolled back.
Unfortunately, there is no way to create all objects and give a final commit or rollback also because in order to create an association, all objects linked by the association must exists in the SLD. For this reason every time an object is created, the reference (handle) to the object is stored in an internal table and in case something is wrong during the procedure, all objects previously created are deleted from the SLD.
Here you can see a sample ABAP report that following the procedure described above, creates a Business System with the parameters specified.
And this is the result of the execution directly on the SLD
It’s easy to imagine how to create a report that taking a csv file containing the parameters for several Systems and reusing the functionalities described above, creates all the Business Systems in the SLD.
You can find the complete source code of the application here.
As a kind of Appendix I would like to list all the tools and utilities that allowed us to reduce the effort of tasks that are necessary in all upgrade/system copy and that normally require a lot of time:
- https://wiki.sdn.sap.com/wiki/display/Snippets/Apply+Note+1172942+automaticallyApply Note 1172942 automatically by Francesco Bersani
- SLD Transport Target Creator by Sandro Garofano
- SLD Massive Transport Target Check Utility by Sergio Cipolla
- Using the Communication Channel Web Service with ABAP: A Sample Report by Alessandro Frontini