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 + '//' + location.host;
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.
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?
Steve.
Hello,
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 ?
Hi,
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.
Br,
Dong Zhu
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.
Regards
Nat
Add a comment