cancel
Showing results for 
Search instead for 
Did you mean: 

how to access browser url parameters in personas flavor script

0 Kudos
882

Hi Personas Experts,
Is it possible to access browser URL parameters in my personas flavor script? Screenshot attached.

Requirement:
User clicks on "F.On Order" in IW32. Order number to prepopulate when user navigates from user navigates from IW32 screen to IW31 screen to create "Follow on order" via browser.

Behavior:

  • Gui - New Gui session opens; “Create Follow-on Order” checkbox is checked & Order number copied from previous screen
  • Browser - New browser window opens with Original-screen; “Create Follow-on Order” checkbox not checked & Order number not copied from previous screen


I created a custom flavor and OnLoad of the screen, I want to access browser URL parameters and get "EAMS_REF_AUFNR" value (for example: 90000183) and set Order field's value (on the screen) via scripting.

I have played around with document.location & window.location.search objects, but didn't help.


Does someone know if Is it possible?

Thanks in advance!

Former Member
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're new in asking questions here, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question now by selecting Actions, then Edit.

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS By personalizing your profile with a photo of you, you encourage readers to respond.

Best regards,

SAP Community moderator

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi All,

Implementing OSS note 2849051 resolved the issue. Thanks

Answers (2)

Answers (2)

bjarne_nielsen
Discoverer

Hi

If you want to get URL parameters from Personas I have with success used this function

you will need to add your parameter to the URL in order for the next "onload" event to read the value

function getUrlVars() {

var vars = {};

var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value;

});

return vars; }

var mytext = getUrlVars()["text"];

and if the URL = HTTPS:/servername/..../index.html?text=hello_again

0 Kudos

Hi Bjarne,
Thanks for your reply.

I am trying to read the browser URL parameters in the OnLoad event.

As shown in screenshot above, the browser URL already has the parameters (key/value pairs) i need. So, i don't need to add a 'new' parameter to the URL (i suppose?).

I am unable to leverage the getUrlVars() code snippet as window.location.href object doesn't have browser URL parameters (see below).

window.location.href:

https://hostname:8443/sap/bc/gui/sap/its/webgui;~sysid=ED1;~loginGroup=SPACE;~messageServer=XXXX?%7e...

-Thanks/Sai

cris_hansen
Advisor
Advisor
0 Kudos

Hello Sai,

You can try using the syntax from the WEBGUI service to prefill fields, by following this wiki page.

Regards,

Cris

0 Kudos

Hi Cristiano,

Thanks for your reply. I saw the thread earlier but couldn't find anything that can-be-used/works in personas flavor scripting. 😞

Is there any specific Syntax or API that I can try?

-Cheers