How to launch SAP transaction & pass parameters via URL
This is going to be one of my shortest weblog but it is going to provide quick help on creating a URL via Java to call a transaction and pass parameters to it.
Step1
Get the IPortalComponentURI object from IPortalComponentRequest object. Then get the url for com.sap.portal.appintegrator.sap.bwc.Transaction from IPortalComponentURI.
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentURI componentURI = request.createPortalComponentURi();
componentURI.setContextName(“com.sap.portal.appintegrator.sap.bwc.Transaction”);
Step2
Build the URL to call the transaction. In the following lines of code , i will build a URL which will call SE38 transaction and displaying the text elements of a particular program.
String url = componentURI.toString() + “?System=DEV&TCode=SE38&GuiType=WinGui&WinGui_Type=Shortcut&OkCode=SHOP&ApplicationParameter=RS38M-PROGRAMM=ZTEST001;RS38M-FUNC_TEXT=X”
Details of parameters in the above url
System -> You shuld pass the alias of the system you have defined
TCode -> Transaction you are calling
GuiType -> Can be WinGui, WebGui or JavaGui
WinGui_Type -> Shortcut ..if you want the Gui to launc outside of the portal
OkCode -> The OkCode that you want to be executed after the transcation is called by SAP Gui.
ApplicationParameter -> You use this pass values to your screen fields which needs to be be separated by ;
your Weblog looks very similar to Pass Parameter to ITS URL Upadated 21st June 2008 from Durairaj Athavan Raja. Could be caused by the matter that the SDN Search currently is not working :-). But I would suggest that you crosslink to the other weblog to get the information together.
Regards
Gregor
-Alex
Thank you for the feedback. This code be used to build a system launch pad and that is what i am going to present in another weblog. I agree with you that it could be done via transaction iView configuration.
thank you
Prakash Singh
In this way the parameters I pass to the transaction iView are visible on the browser URL address bar.
Is there a way to pass the parameters in a different way so they wont be visible ? (like POST method ?)
Thanks
Ami
It's createPortalComponentURI() (capital i).
Makes copy & paste easier 😉
Regards,
Kashban
componentURI.setContextName("com.sap.portal.appintegrator.sap.bwc.Transaction");
String url = componentURI.toString() + "?System=SAP_R3&TCode=RZ10&GuiType=WinGui&WinGui_Type=Shortcut" ;
How do I include that URI to IPortalComponentResponse?
Congratulations on this blog. I'ts been very helpful!! it helped me to build a portal applications that calls some user prefered R/3 Transactions.
I have a little inconvenient with this:
When I open my R/3 system via Sap Logon, if I already have an open session it shows me a message indicating the action to take: Close the previous session or continue working with it.
Question N. 1:
When I Call any transaction via URL from the portal, is it possible to keep this behaviour??? (validate if I had another session opened)
The URL looks like this:
String url = componentURI.toString() + "?System=" + sysAlias + "&TCode=" + transac + "&GuiType=WinGui";
Question No. 2:
I could have an internal counter, and if the user tries to open a new R/3 transaction, show an error.
The thing is that I don't know when the win gui window is closed. Is there a way of knowing this via Javascript??
Thank you very much Pakrash!!
we have the same problem with the different behaviour of your solution unlike the SAP Logon Pad with open sessions (see question N.1 of Felipe Vieira).
How is it possible to reach the behaviour of the SAP Logon Pad in this point (do not open two sessions with the same user at the same time).
Regards,
Wolfgang
Is there a way to specify the language of the session opened?
There have been cases when the page is displayed in German
Sorry for this perhaps superfluous question but I have to be sure: does it work the same with a link opening a BSP transaction iview? And is there always a specific OkCode or is there generic ones?
Best regards
Benny Lange
Regards
Raja
Thanks for this excellent article. Would you be able to provide any inputs on how we can achieve the same using NetWeaver EP - Java WebDynpro.
We have the table with list of Transaction names (eg: se37) and I have the system details as well.
The below snippet does not work for WebDynpro. What we want is exactly the same, but in WebDynpro.
Thanks,
Sandeep
I'd like to know how to import com.sapportals to my view in Web Dynpro
Thanks
This is indeed very useful and we have this working successfully in our development environment.
My only question is when transporting from DEV to QA, our link still points back to the DEV system.
Is there anyway are aware of of using a variable for the system. Like this when it is transported to QA the URL system variable would determine that it should point to QA not DEV?
Any thoughts would be much appreciated.
Thanks
Andrew
my issue is very close to this blog.
Does anybody know, how to dynamically call a transaction (iView) with (dynamic name and count of parameters passed) from an another web dynpro java application, which is also embedded as iview in portal?
Thanks for your help!
Regards Patrick.
perhaps you can tell me how I can change the LOGON LANGUAGE to the transaction using an URL-parameter.
example:
String url = componentURI.toString() + "?System=DEV&TCode=SE38&LANGUAGE=de"
In this example LANGUAGE is a placeholder for the parametername, that I am searching for. Sadly i couldn't find a documentation for the com.sap.portal.appintegrator.sap.Transactions component, including a list with available parameters.
Thanks in advance if you have any suggestions.
Alex