Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

The System Landscape Directory (SLD) is software that nowadays is effectively mandatory to install at a customer site. It is used to help Solution Manager, amongst other things. SLD has two main areas - a set of data that is updated from SAP the organisation by the Basis team that "knows" about products and support packs, and a set of data that represents a customer's landscape.

Looking inside the product and software software component area of SLD you will see that there are also a set of associations which describe product history in a fairly broad way. The association is called SuccessorPredecessor, and as the name suggests, it holds some details about different products plus their successors.

Ok, so let's try to read this using some Java code. I have decided to only look at a subset of the products, namely those relating to ERP, ECC, SAP NetWeaver and some enhancement packages. In the software components, I have concentrated on SAP_APPL, which can be thought of as the functional side, and SAP_BASIS, which is the techie part.

The code is designed to run using JRE 1.4.2, and requires a few external libraries.

The following Windows batch file can be considered a starting point for your own system:

I used NWDS to build a Java project called SLDStandalone, and I have the libraries in a few directories due to installing a Java system XYX with central instance number 02.

Please note that I have hardcoded the hostname, username and password to access the SLD in the batch file.

cd \sap\SLDStandalone
java -cp \usr\sap\XYZ\JC02\j2ee\cluster\server0\bin\ext\com.sap.lcr.api.cimclient\lcrclient.jar;C:\usr\sap\XYZ\JC02\j2ee\cluster\server0\bin\ext\tc.httpclient\httpclient.jar;\usr\sap\XYZ\JC02\j2ee\cluster\server0\bin\ext\tc~sld~sldclient_sda\sldclient.jar;\usr\sap\XYZ\JC02\j2ee\cluster\server0\bin\system\logging.jar;\usr\sap\XYZ\JC02\j2ee\cluster\server0\bin\ext\com.sap.util.monitor.jarm\Jarm.jar;. com.sap.anz.History tn7tdc00:50000 bit400-00 goaway1

 

Here's the code:

 

/*

  • Created on 19/01/2011

*

  • To change the template for this generated file go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

package com.sap.anz;

import java.net.URL;

import java.util.Vector;

import com.sap.lcr.api.cimclient.CIMClient;

import com.sap.lcr.api.cimclient.CIMOMClient;

import com.sap.lcr.api.cimclient.ClientFactory;

import com.sap.lcr.api.cimclient.HttpRequestSender;

import com.sap.lcr.api.sapmodel.SAP_SuccessorPredecessor;

import com.sap.lcr.api.sapmodel.SAP_SuccessorPredecessorAccessor;

 

/**

  • @author Me

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

public class History {

     static Vector antes = new Vector();

     static Vector depends = new Vector();

     static Vector combos = new Vector();

     static int level;

     public static void main(String[] args) {

          ClientFactory factory = ClientFactory.newInstance();

          

          if (args.length!=3) {

               System.err.println("Usage: java History sldhost:port username password");

               System.exit(1);

          }

          

          try {

               URL url = new URL("http://"args[0]"/sld/cimom");

               String user = args[1];

               String password = args[2];

          

               HttpRequestSender requestSender = new HttpRequestSender(url, user, password);

//

               CIMOMClient cimomClient = new CIMOMClient(requestSender);

//

               CIMClient cimClient = new CIMClient(cimomClient);

               SAP_SuccessorPredecessorAccessor sucpred = new SAP_SuccessorPredecessorAccessor(cimClient);

               SAP_SuccessorPredecessor[] sucpreds = sucpred.enumerateSAP_SuccessorPredecessorInstances();

               for (int i=0;i<sucpreds.length;i++) {

                    SAP_SuccessorPredecessor s = sucpreds[i];

                    if (s.getAntecedent().getClassName().equals("SAP_SoftwareComponent")) {

                         String aName = s.getAntecedent_WT().getKeyValue("Name").toString();

                         String aVersion = s.getAntecedent_WT().getKeyValue("Version").toString();

                         String dName = s.getDependent_WT().getKeyValue("Name").toString();

                         String dVersion = s.getDependent_WT().getKeyValue("Version").toString();

                         if (aName.equals("SAP_APPL")

                              || aName.equals("SAP_BASIS")) {

                              antes.add(aName" "aVersion);

                              depends.add(dName" "dVersion);

                              Vector combo = new Vector();

                              combo.add(aName" "aVersion);

                              combo.add(dName" "dVersion);

                              combos.add(combo);

//                              System.out.println(aNameaVersion"="dNamedVersion);

                         };

                    };

                    if (s.getAntecedent().getClassName().equals("SAP_Product")) {

                         String aName = s.getAntecedent_WT().getKeyValue("Name").toString();

                         String aVersion = s.getAntecedent_WT().getKeyValue("Version").toString();

                         String dName = s.getDependent_WT().getKeyValue("Name").toString();

                         String dVersion = s.getDependent_WT().getKeyValue("Version").toString();

                         if (aName.equals("SAP ERP ENHANCE PACKAGE")

                              || aName.equals("SAP ERP")

                              || aName.equals("SAP ECC")

                              || aName.startsWith("SAP NETWEAVER")

                              || aName.startsWith("SAP R/3")) {

                              antes.add(aName" "aVersion);

                              depends.add(dName" "dVersion);

                              Vector combo = new Vector();

                              combo.add(aName" "aVersion);

                              combo.add(dName" "dVersion);

                              combos.add(combo);

                         };

                    };

               };

               level = 0;

               for (int i=0;iSAP R/3 3.0C

-SAP R/3 3.0D

--SAP R/3 3.0E

---SAP R/3 3.0F

-


SAP R/3 3.1G

-


SAP R/3 3.1H

-


SAP R/3 3.1I

-


SAP R/3 4.0A

-


SAP R/3 4.0B

-


SAP R/3 4.5A

-


SAP R/3 4.5B

-


SAP R/3 4.6A

-


SAP R/3 4.6B

-


SAP R/3 4.6C

-


SAP R/3 ENTERPRISE 47X110

-


SAP R/3 ENTERPRISE 47X200

-


SAP ECC 5.0

-


SAP ECC 6.0

SAP NETWEAVER CE 7.1

-SAP NETWEAVER CE 7.1.1

SAP_APPL 30C

-SAP_APPL 30D

--SAP_APPL 30E

---SAP_APPL 30F

-


SAP_APPL 31G

-


SAP_APPL 31H

-


SAP_APPL 31I

-


SAP_APPL 40A

-


SAP_APPL 40B

-


SAP_APPL 45A

-


SAP_APPL 45B

-


SAP_APPL 46A

-


SAP_APPL 46B

-


SAP_APPL 46C

-


SAP_APPL 470

-


SAP_APPL 500

-


SAP_APPL 600

-


SAP_APPL 602

-


SAP_APPL 603

-


SAP_APPL 604

-


SAP_APPL 605

SAP ERP 2004

-SAP ERP 2005

SAP_BASIS 40A

-SAP_BASIS 40B

--SAP_BASIS 45A

---SAP_BASIS 45B

-


SAP_BASIS 46A

-


SAP_BASIS 46B

-


SAP_BASIS 46C

-


SAP_BASIS 46D

-


SAP_BASIS 610

-


SAP_BASIS 620

-


SAP_BASIS 640

-


SAP_BASIS 700

-


SAP_BASIS 710

-


SAP_BASIS 711

-


SAP_BASIS 720

-


SAP_BASIS 730

-


SAP_BASIS 800

-


SAP_BASIS 701

-


SAP_BASIS 702

-


SAP_BASIS 703

SAP ERP ENHANCE PACKAGE SAP ERP VALUE PACK 2005.1

-SAP ERP ENHANCE PACKAGE 2005.1

--SAP ERP ENHANCE PACKAGE 2005.2

---SAP ERP ENHANCE PACKAGE SAP ENH PACK 3 FOR SAP ERP 6.0

-


SAP ERP ENHANCE PACKAGE SAP ENH PACK 4 FOR SAP ERP 6.0

-


EHP4 FOR SAP ERP 6.0_NW701 EHP4 FOR ERP 6.0_NW701

SAP NETWEAVER 04

-SAP NETWEAVER 7.0 (2004S)

--SAP NETWEAVER AS ABAP 7.1

---SAP NETWEAVER AS ABAP 7.11

--SAP NETWEAVER MOBILE 7.1

---SAP NETWEAVER MOBILE 7.11

--SAP NETWEAVER SAP EHP1 FOR SAP NETWEAVER 7.0

---SAP NETWEAVER SAP EHP2 FOR SAP NETWEAVER 7.0

--SAP NETWEAVER PI 7.1

---SAP NETWEAVER PI 7.11

</textarea></p>

1 Comment