cancel
Showing results for 
Search instead for 
Did you mean: 

Opening a new window from an event handler in IC WebUI

Former Member
0 Kudos

Hello ,

I want to open a new browser window on the click of a button (through the event handler) .This can be done using javascript ,but I ideally want it to be triggered from the event handler .The URL is dynamically

generated . Please do let me know if there are ways to achieve this .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the place where you declare your button write this code.

ls_button-id = xx.

lv_string1 = 'javascript:window.open( "'.

lv_string2 = '" );'.

ls_button-on_client_click = 'javascript:window.open( "lv_url");'

CONCATENATE lv_string1

lv_url

lv_string2

INTO lv_string3.

ls_button-on_client_click = lv_string3.

ls_button-enabled = abap_true.

APPEND ls_button TO gt_editbutton.

pass your dynamic URL here to lv_url. Dont Pass anything to ls_button-on_click.

You can do this coding in DO_PREPARE_OUTPUT or IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS wherever your button is present.

Regards,

Masood Imrani S.

Former Member
0 Kudos

If you use this, there is no need to create the event handler even !

Former Member
0 Kudos

Hi Masood ,

Thanks a lot for your input . Actually, I was trying to put the javascript code in on the on_click event instead of on_client_click, so was facing some problems. The new window opened everytime the page loaded. Your suggestion works fine now.But, I have another issue. The method to generate the url should be called only on the client click , that is the reason I wanted to process that url processing code in the event handler and then open the new window from there. Please let me know how this can be achieved .

Edited by: Shakuntala1980 on Apr 3, 2009 2:22 AM

Edited by: Shakuntala1980 on Apr 3, 2009 2:24 AM

Former Member
0 Kudos

There is no need to create an event handler of we use the code I said and it works only the button click

i.e ., the window opens only if you click teh button.

You can include the logic to dynamically change the URL at the place where the button is declared itself. There are certain places too where you can maintain your URLs like table CRMC_IC_LTX_URL.

You can make a select and then pass the URL to On Cleint Click.

The dynamic changing of URL should happen before the button is displayed, if you want to make the URL dynamically change after button click then you can Transaction Launcher or something like HTML coding.

Former Member
0 Kudos

Hi Masood,

Thanks a lot for your answer. It helped!!

robert_kunstelj
Active Contributor
0 Kudos

Hi.

Can you please tell me how you solved your problem. Sample code would be appreciated.

Thank you.

Answers (0)