on 03-07-2012 8:17 PM
From ERPH/HeaderDetail_ view, on click on a field, I should navigate user to a new window using the HTTP link I have.
For this, I've created a newfield and redefined GET_P method to make the field type 'event_link' and a On-click even handler. Now field is showing as a link on UI, what should I do in even handler method to navigate user to a external http link. I generate this link depending on some conditions and it is a dynamic link - not same always .
please advice.
I know the solution how to do it on clicking a Button i.e. can open a webpage, let’s say www.google.com on click of a Button by calling the java script as seen in the code below.
ls_button-ON_CLIENT_CLICK = 'javascript:window.open( "http://www.google.com" );'.
ls_button-page_id = me->component_id.
ls_button-enabled = abap_true.
APPEND ls_button TO rt_buttons.
I want to achieve the same clicking a field ( not BUTTON) ??
For this, I've redefined GET_P method to make the field type 'event_link' and now here there is no ON_CLIENT_CLICK property in GET_P method, but just Onclick .
If I write this code in GET_p method
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = 'javascript:window.open( "http://www.google.com");'.
Java script is not working for onclick , how can i achieve this??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One way is to define in get_p...
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = 'ZPOPUP'.
Then create new event ZPOPUP in which you can for example fill global attribute (e.g. ZURL =
'http://www.google.com') of that view.
Then in htm layout of that view add the codding...
<% if not controller->zurl is initial.%>
<script type="text/javascript">
window.open("<%=controller->zurl%>").focus();
</script>
<% clear controller->zurl.
endif.
Hey Robert Kunstelj
I have used the the java script as mentioned by you, the link works fine.
Here I have a problem, if I click on the field for the first time, it opens the Google link. Now I close the google tab and click the field again i.e second time, the Google link is not opened again. Only for the first time this thing is working.
I'm I missing something?
Thank you.
Aday,
I believe that is what the problem is with hyperlink, you are actually setting the URL on roundtrip in event handler, once window is closed - there is no round trip again, so URL would be empty and link would not work again - whereas in case of button, URL is there due to onclientclick.
Thanks,
Rohit
Hi Aday,
if you were able to solve your issue : The window opens for the first time on click, not for the second time.
Please suggest we have also the same issue.
In My Dev system the Link opens as many times i click on hyperlink, but in Quality system this link opens only for the first time, all code is same evry thing is same.
and i checked every time the URL gets created and it calls the Window.open( "url").
Please share if your problem is resolved.
Regards,
VD
Hi,
You can achieve this by implementing the following.
1.Create a new form view.
2.Add an iframe to the htm page.
3.Prepare the dynamic url and provide it to the iframe.
4.Call this new view on click of your link.
This will open your external url in the BSP view.
Regards,
Leon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.