Skip to Content
Author's profile photo Former Member

How to launch SAP transaction & pass parameters via URL

Introduction
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 ;

Assigned Tags

      19 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gregor Wolf
      Gregor Wolf
      Hi Prakash,

      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

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      My weblog has nothing to do with ITS. If you read my weblog and Durairaj's, you find anything similar in this two weblogs. My solution doesn't talk about ITS at all. Please ready carefully before posting comments.
      Author's profile photo Alexander Schuchman
      Alexander Schuchman
      Quick and to the point, like that about your blog.  You can create an IView based on that sap.appintegrator you mentioned and accomplish the same linking result in the SAP Portal, but without writing any code...then let the admins do the maintenance.
      -Alex
      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Hi 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

      Author's profile photo Former Member
      Former Member
      Hi Prakash,
      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

      Author's profile photo Former Member
      Former Member
      Hi Pakrash!

      It's createPortalComponentURI() (capital i).

      Makes copy & paste easier 😉

      Regards,
        Kashban

      Author's profile photo Former Member
      Former Member
      IPortalComponentURI componentURI = request.createPortalComponentURI();
                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?

      Author's profile photo Former Member
      Former Member
      Hi!

      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!!

      Author's profile photo Former Member
      Former Member
      Hi Prakash,

      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

      Author's profile photo Former Member
      Former Member
      Hi,
      Is there a way to specify the language of the session opened?
      There have been cases when the page is displayed in German
      Author's profile photo Former Member
      Former Member
      Hi.

      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

      Author's profile photo Durairaj Athavan Raja
      Durairaj Athavan Raja
      BSP transaction? are you talking about link to BSP application, i already posted answer to your question at /thread/361105 [original link is broken]

      Regards
      Raja

      Author's profile photo Former Member
      Former Member
      Dear Prakash,

      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

      Author's profile photo Former Member
      Former Member
      Hi!
      I'd like to know how to import com.sapportals to my view in Web Dynpro
      Thanks
      Author's profile photo Former Member
      Former Member
      Hello Prakash,
      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

      Author's profile photo Former Member
      Former Member
      Andrew, ideally you should have a floating system alias, which points to DEV on your dev portal and QA on your QA portal. For example, a lot of SAP supplied iViews assume aliases like SAP_R3_HumanResources etc.
      Author's profile photo Former Member
      Former Member
      Hi,

      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.

      Author's profile photo Former Member
      Former Member
      Hi Prakash,

      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

      Author's profile photo Former Member
      Former Member
      We created a transaction iview for a custom transaction and passing the portal user id to ecc program. if the program have the user id parameter enabled on the screen the value is being passed successfully. But if the userid field on screen is hidden it is not being passed...any solution for this..Thanks in advance..