on 12-15-2004 1:42 PM
I created an r3 system and it's working well.
How can i get, from my code, the system properties(system number, client,host...) if i know the system alias.
Florin
Hi,
IEPSystem system = landscapeService.getEPSystem("systemAlias",user);
Enumeration keyEnum = system.getAttributeKeys().elements();
while (keyEnum.hasMoreElements())
{
String attributeName = (String) keyEnum.nextElement();
if(attributeName.equals("ashost"))
{
ashost = system.getAttribute(attributeName);
}
else if(attributeName.equals("sysnr"))
{
sysnr = system.getAttribute(attributeName);
}
else if(attributeName.equals("SystemType"))
{
type = system.getAttribute(attributeName);
}
else if(attributeName.equals("client"))
{
client = system.getAttribute(attributeName);
}
lang = "EN";
}
HTH,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Florin, hi Roman,
this is even a bit easier:
ISystemLandscapeService service = (ISystemLandscapeService)
PortalRuntime.getRuntimeResources().getService(ISystemLandscapeService.KEY);
IDesigntimeSystemLandscapeService desTimeSLService =
service.getIDesigntimeSystemLandscapeService();
try {
IUser user = (IUser) request.getUser();
ISystemObject so = (ISystemObject)
desTimeSLService.getObjectRunTime("someAlias", user);
} catch (NamingException e) {
} catch (PrivilegedActionException e) {
}
The following services need to be referenced: com.sap.portal.ivs.systemlandscapeservice, com.sap.portal.pcmbuilderservice. Include public libs of these apps.
Hope it helps
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
the only <u>released</u> API I know is the old Landscape service.
ILandscapeService landscape = (ILandscapeService) PortalRuntime.getRuntimeResources().getService(ILandscapeService.KEY);
IEPSystem system = landscape.getEPSystem("alias", userObject);
system.get...
->
Regards, Karsten
Hi Karsten,
in the referred thread (and in others), this is discussed not "in deep" but with different options, which service API is useful, easy to be used, deprecated, deprecated from which version on etc.
It's not very nice that there is no "stable, released, will-'never'-be-deprecated-or-'old'"-API.
Just the link you are givin' is somehow funny: "preNW04/SP2/.../compatibility50"... shudder... (it's not your fault, of course (I hope))
Best regards
Detlev
> in the referred thread (and in others), this is
> discussed not "in deep" but with different options,
> which service API is useful, easy to be used,
> deprecated, deprecated from which version on etc.
Yes. And I wanted to contribute the in my opinion most easy-to-use code. As you can see in the API reference, the method calls I listed are not deprecated.
> It's not very nice that there is no "stable,
> released, will-'never'-be-deprecated-or-'old'"-API.
True, I would appreciate that as well.
> Just the link you are givin' is somehow funny:
> "preNW04/SP2/.../compatibility50"... shudder...
> (it's not your fault, of course (I hope))
Due to the fact, that I'm only a poor implementing consultant, it's not my fault
This code is working and released at least for SP2.
If you have a look in the Netweaver portal javadocs, you won't find anything related to the system landscape. I guess we might use the semantic layer of the PCD GL in future.
But even in Netweaver releases, there is the compatibility50 service, which internally translates the calls into valid code (which is a jndi lookup).
So don't shudder.
Regards, Karsten
Try this code:
String alias = "SAP_R3";
IUser user = <portal user>;
ISystems mm_systemsService = (ISystems) PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
String mm_systemID = mm_systemsService.getSystemId(alias);
Hashtable env = new Hashtable();
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
env.put(IPcdContext.SECURITY_PRINCIPAL, user);
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, user);
InitialContext iCtx = new InitialContext(env);
ISystem system = (ISystem)iCtx.lookup(mm_systemID);
system.getAttribute(<attribute>);
Hope it will help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.