cancel
Showing results for 
Search instead for 
Did you mean: 

Browser button back ,refresh event trigger message in webdynpro applicaiton

former_member193460
Contributor
0 Kudos


Hi Experts,

     i have a requirement to catch the broser button (back,refresh ) in my webdynpro applicaiton, so that when user click on any of these buttons i want to display a warning message .. that user may loose his or her data if continues..

Please let me know if this is possible in webdynpro.

Thanks & Regards,

Tashi

Accepted Solutions (0)

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Tashi,

This can be done by using work protect mode in WDA

Please refer the below documents

Work Protect Mode (SAP Library - Web Dynpro for ABAP)

Also, search in Google by term "work protect mode in webdynpro abap", you may find some examples.

Hope this helps you.

Regards,

Rama

former_member193460
Contributor
0 Kudos

Hi Rama,

     How are you !! i included the code in the init method of component controller,but i dont get any warning message when i click on refresh or back button.

Please help

former_member184578
Active Contributor
0 Kudos

Hi,

It(the mentioned SAP Help) works if your WDA application integrated in Portal. If you are using FPM, you can use IF_FPM_WORK_PROTECTION interface to achieve this.

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi Tashi,

I am doing great Hope the same from your end.

As suggested by Mr. Kiran, the work protect mode works when we integrate our applications in enterprise portal.

Regards,

Rama

former_member193460
Contributor
0 Kudos

my application is a standalone webdynpro applicaiton, my client requires me to give a warning message when user click "back/forward/refresh" button on the browser. if this cant be done through work protect mode, is there any other way of achieving this.

Thanks & Regards,

Tashi

former_member184578
Active Contributor
0 Kudos

Hi,

No. As mentioned in my earlier reply, either you have to Integrate your Application in Portal or use FPM where there is a provision to set work protect using IF_FPM_WORK_PROTECTION interface.

Regards,

Kiran

former_member193460
Contributor
0 Kudos

so there is no other way than the "work protect mode" concept. i am thinking if we could catch the browser events in applicaiton and execute a message for the same. will that be possible , if so, how ?

Thanks & Regards,

tashi

former_member184578
Active Contributor
0 Kudos

Unfortunately the answer again is No! you have to follow the one mentioned in my earlier replies

Regards,

Kiran

former_member193460
Contributor
0 Kudos


Hi Kiran,

     i am trying to implement the fpm work protect using IF_FPM_WORK_PROTECTION . For now i have used the OIF approach of FPM.

i dont know how to do the coding for the IF_FPM_WORK_PROTECTION . Please can you write a brief code.

Thanks & Regards,

Tashi

Former Member
0 Kudos

Hi Tashi,

Check my similar posting regarding IF_FPM_WORK_PROTECTION.

Hope it helps you.

Thanks

KH

former_member193460
Contributor
0 Kudos


Hi Katrice,

     I checked your thread and its definitely the same end solution i want to implement.However i am not sure how to use this interface.

i have implemented it in my component and i saw a method is_dirty added into the controller.

But from here onwards.. i dont know how to set the dirty flag and how the whole implementation is done. I will really appreciate if you can help me out on the implementation part (sample code will be very useful).

Thanks & Regards,

Tashi

former_member193460
Contributor
0 Kudos

Hi Katrice,

     i have used this code in view init method:

data L_COMPONENTCONTROLLER type ref to IG_COMPONENTCONTROLLER .

data L_API_COMPONENTCONTROLLER type ref to IF_WD_COMPONENT.
data L_PORTAL_MANAGER type ref to IF_WD_PORTAL_INTEGRATION.

L_COMPONENTCONTROLLER =   WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

L_API_COMPONENTCONTROLLER = L_COMPONENTCONTROLLER->WD_GET_API( ).

L_PORTAL_MANAGER = L_API_COMPONENTCONTROLLER->GET_PORTAL_MANAGER( ).

call method L_PORTAL_MANAGER->SET_WORK_PROTECT_MODE

  exporting

    MODE   =  'BOTH'  .

then i have a button to make data dirty (button for trial sake) and i have included this code.

data L_COMPONENTCONTROLLER type ref to IG_COMPONENTCONTROLLER .

data L_API_COMPONENTCONTROLLER type ref to IF_WD_COMPONENT.

data L_PORTAL_MANAGER type ref to IF_WD_PORTAL_INTEGRATION.

L_COMPONENTCONTROLLER =   WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

L_API_COMPONENTCONTROLLER = L_COMPONENTCONTROLLER->WD_GET_API( ).

L_PORTAL_MANAGER = L_API_COMPONENTCONTROLLER->GET_PORTAL_MANAGER( ).

call method L_PORTAL_MANAGER->SET_APPLICATION_DIRTY_FLAG

  exporting

    DIRTY_FLAG = abap_true .

i have included the code in your thread for method need_confirmation generated by implementing IF_FPM_UI_BUILDING_BLOCK.

CASE io_event->mv_event_id.

     WHEN 'FPM_CLOSE'. "
        eo_confirmation_request = cl_fpm_confirmation_request=>go_data_loss.

   ENDCASE.

Please help.

Tashi

Former Member
0 Kudos

Is your issue resolved ?.

Thanks

KH

former_member193460
Contributor
0 Kudos

Hi Katrice,

     i am not getting the "unsave data" message when i close my browser. i have implemented it as mentioned above. Please let me know what i have missed.

Regards,

Tashi

former_member193460
Contributor
0 Kudos

Hi,

     The applicaiton i am working on is a stand alone webdynpro application. Its not implemented in portal.

i wanted to know if FPM alone with webdynpro, i will be able to achieve the "work protect" functionality.

Thanks & Regards,

Tashi

Former Member
0 Kudos

Hi,

Following is the code which i've written for dataloss popup.

Thanks

KH

former_member193460
Contributor
0 Kudos

Hi Katrice,

     Thanks for your reply. i have the same code in my method but still i am not getting any pop up.

Are you closing the browser with browser close

i have used fpm type OIF. Please let me know if you have done anything different.

REgards,

Tashi

Former Member
0 Kudos

Hi,

You cannot control the close functionality by using because these buttons are browser buttons and you cannot have control on that buttons. Instead, you can give one FPM button by name Close in FPM Toolbar with event id and on click of that button, write the code which i've shown in my earlier post.

Thanks

Katrice

former_member193460
Contributor
0 Kudos

Hi Katrice,

     i am getting the pop up by using the buttons in the applicaiton, however i want to clarify the following doubts i have:

1) Is it possible to catch browser button events in webdynpro applicaiton

2) i cant see "Close" button in the tool bar element, though i can rename the buttons but i cant change the event ID.

Please help me understand .

Your help is always appreciated !

Regards,

Tashi

Former Member
0 Kudos

Hi Tashi,

AFAIK

1) we cannot catch browser button events in wdp appln.

2) In configuration editor, in global tool bar schema->insert tool bar element of type button with event id as shown below

Thanks

KH

former_member193460
Contributor
0 Kudos

Hi Katrice,

     Thanks for all your help. i am not getting the close button probably becoz of the system version.

User had requested to handle the browser events, so it looks like i have to tell them its not possible.

Thanks for all your hlep again.

Regards,

Tashi

Former Member
0 Kudos

Hi,

Choose other function button and rename that button name to close.

Thanks

KH

former_member193460
Contributor
0 Kudos


how do i change the event ID ?

Former Member
0 Kudos

When you add toolbar element, its FPM Event ID = EVENT_ID, just rename it as FPM Event ID field is an input field, you can give your own event id else you can choose it from F4 help.

Thanks

KH

former_member193460
Contributor
0 Kudos


i dont see any column for Event_ID. Following are the options i see.

i dont see the column for event_id to change it.

Regards,

Tashi

Former Member
0 Kudos

Check this.

Thanks

KH

Former Member
0 Kudos

Hi Tashi,

Is you issue resolved?

Thanks

KH

former_member193460
Contributor
0 Kudos

Hi KH,

     i wanted a solution to handle browser events (browser close, refresh buttons), but it looks like FPM can handle only the FPM toolbar events. However i thank you for your help.

Thanks & Regards,

Tashi

Former Member
0 Kudos

Hi Tashi,

As i mentioned earlier in my reply " We cannot handle browser button events in Webdynpro/FPM". Pls close the thread if your issue has been addressed.

Thanks

KH