on 01-29-2014 2:23 AM
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It shouldn't be necessary since location.host will return both the server name and the port: Location host Property
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tamas
Due to in our development system, we have 2 client 100 and 110.
Client 100 for Development and configuration work and client 110 for testing,
All data is in client 110.
When we log on to personas, we log into 100 and choose the system 110,
When I did the JS to call WebRFC, if I do not put &sap-client=110, there is no result come back.
So I think it will pass to client 100.
Hi,
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.
Br,
Dong
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can write a webRFC to do pretty much anything. Details of how you call webRFCs from personas are in this blog: Calling RFCs from a Personas script. You just need to make the function body do whatever you need.
I need to add, what table entries are you planning to delete? You need to be very careful manipulating standard SAP tables in this way. It is almost always wrong...
Steve.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.