on 05-04-2015 5:31 PM
Hi experts,
for a customer request we have to write a toolbar script which opens a specific web page.
Usual java libraries seem not to work in SAP Sourcing.
This is the script which works fine in eclipse
URI uriToken;
try {
uriToken = new URI(urlToken);
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
desktop.browse(uriToken);
}
} catch (Exception e1) {
throw doc.createApplicationException("", e.toString());
}
But the page is not opened when calling the script in sourcing.
Does anyone have experiences with this topic?
Thanks in advance and regards,
Özlem
Hello Özlem,
Problem is that the requirement itself is not valid from the perspective of Java architecture. The Desktop class is designed to be a link between native and java apps on a host system.
Your code will work in eclipse because both host and client are the same machine; and will not work in a java web app running on a central server. The actual code will **try** to open a browser on the SAP Sourcing server.
Given the fact that all of the SAP Sourcing scripts are executed server-side, I believe that there is no possibility of opening a new browser or tab on the client from a script context.
One alternative solution would be to create an URL extension field and generate/save the link there, instructing the users to click on the link after generation.
Regards,
Bogdan Toma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.