Skip to Content

Keeping the WebRFC URL dynamic in Personas

I'm not sure if this is common knowledge so I thought I'd mention it 😊

In order to avoid a hard coded server name when performing a WebRFC, there is a very simple way to build the URL in a dynamic fashion. Just precede the WebRFC step with a Javascript step which builds a variable from the current protocol and host name and use that in the WebRFC step. So something like this:

Calculate in JavaScript args.server = location.protocol + '//' +;

Call WebRFC {server}/sap/bc/webrfc?_FUNCTION=functionnname...etc...

This avoids having to alter the flavor when it gets transported to another environment like from Dev to QA and so on.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 29, 2014 at 10:08 AM

    Thanks Tamas. I've been meaning to add this info to my WebRFC blog for a while. Now I just need to add a link pointing here 😊

    Is it worth also adding the port number to the calculation?


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 26, 2015 at 01:20 PM


    Can we delete the Table entries through the ABAP Logic by calling the Web RFC from the personas screen ??

    if yes can you please demonstrate how to do it ?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 25, 2015 at 12:30 PM


    Just want to provide simplified info for doing RFC regarding the info split into several posts. Here is the script of calling RFC with dynamic domain (from Tamas) and random number for constantly updating UI value:

    It works fine even with special (eg danish chars), see below:

    Hope this help someone to get RFC work a bit easily.


    Dong Zhu

    RFCscript.png (7.5 kB)
    RFCGUI.png (2.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2016 at 12:46 AM

    Hi Tamas

    Thank for your post on Dynamic URL.

    Due to I have to add another parameter for sap client in URL as below

    Call WebRFC {server}/sap/bc/webrfc?_FUNCTION=XXXXX&_name={name}&sap_client=110

    I don't want to hard code 110, how do I get the sap-client dynamic, Please advise.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Nattawat Sopontammarak


      In your case, I guess you can do like this:

      You can set 100 and 110 on Dev system using SPRO so that when you logon Personas, you have to choose which client system is to be used (or put client in url of your app).

      Your Personas app can be made for both systems, and the WebRFC module may have to be copied onto the two systems too. Then on UI, you will need to call the module without specifying the client number.

      Just for testing purpose, I haven't done dynamic client number by just 'name' as normally you don't specify that in the url as you can specify that in your personas app url.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.