cancel
Showing results for 
Search instead for 
Did you mean: 

Pop Up window in Webdynpro ABAP

Former Member
0 Kudos

Dear All,

I want to show the pop up message with the user action, if the user presses 'Yes' then corresponding coding to be executed in the same event itself. i.e. When the ALV event is triggered, on selection of the particular row, a pop up need to be triggered. Based on the user input the same event need to be continued. will it be possible.Please throw some light on this.

I tried with the window manager its bringing the popup but before the popup comes to the screen all the event method is getting executed.

Thanks

Yogesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Yogeswaran,

You can display popup to confirm window with two buttons YES and NO.

Please check this code to create popup to confirm window.

data lo_window_manager type ref to if_wd_window_manager.
  data lo_api_component  type ref to if_wd_component.
  data lo_window         type ref to if_wd_window.
  data lo_view_controller type ref to if_wd_view_controller.
  data :  lt_text TYPE string_table,
          ls_text TYPE string.
 
  ls_text = 'You want to cancel changes...Are you sure?'.
  INSERT ls_text INTO TABLE lt_text.
 
* Get Window manager
  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
 
  lo_window = lo_window_manager->create_popup_to_confirm( text = lt_text
  button_kind     = if_wd_window=>co_buttons_yesno
  message_type    = if_wd_window=>CO_MSG_TYPE_WARNING
  window_title    = 'Information to Confirm...'
  window_position = if_wd_window=>co_center ).
 
  lo_view_controller = wd_this->wd_get_api( ).
 
* creating ok button
  lo_window->subscribe_to_button_event(
             button = if_wd_window=>co_button_yes
             action_name = 'YES'
             action_view = lo_view_controller
             is_default_button = abap_false ).
 
  lo_window->subscribe_to_button_event(
             button = if_wd_window=>co_button_no
             action_name = 'NO'
             action_view = lo_view_controller
             is_default_button = abap_true ).
 
* Set the height and width here
  lo_window->set_window_size( width = '40%' height = '5%' ).
 
  lo_window->open( ).

create two actions with names YES and NO.

On YES onaction write your desired code.

you want to display this popup on selection of row, means write this code ONLEADSELECTION of ALV.

Hope it solves.

Cheers,

Kris.

Former Member
0 Kudos

Hi Kris,

Thanks for your reply. I have written this code already, my problem is I am trying to call the Pop up in the ALV event (ON_CELL_ACTION), when the user presses 'Yes' i need to proceed further in the ALV event itself.. there are some fields need to be hide based on the user input which cannot be written in the ALV...

When i use this Code, its completing all the event method and then a pop up comes.

Hope you understood my problem.

Thanks

Yogesh

Former Member
0 Kudos

Hi Kris,

I have used your cod e for popup in WD but am getting an error like 'WD_COMP_CONTROLLER" is not defined.

+"loapi_component = wdcomp_controlle_r->wd_get_api( )."+_

Can you please tell me how to solve that problem.

Thanks and regards,

Vijay Vikram

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Where are you placing this code? In a method of a view controller or in the component controller itself? From the component contorller itself, the object variable for the component controller is WD_THIS, not WD_COMP_CONTROLLER

former_member205842
Participant
0 Kudos

Hi Krishna,

                 Am able to show custom buttons in popup window but am not getting where i have to add my window name to display my custom window  ...this is my code which i used to add custom buttons....Please reply me ...

DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component  TYPE REF TO if_wd_component.
DATA lo_window         TYPE REF TO if_wd_window.
*DATA lt_buttons        TYPE  wdr_popup_button_list.
*DATA ls_buttons LIKE LINE OF lt_buttons.
*DATA ls_canc_action    TYPE wdr_popup_button_action.
DATA w TYPE REF TO if_wd_window.
DATA:L_TEXT TYPE STRING_TABLE,
      ls_text LIKE LINE OF l_text.
DATA:l_api TYPE REF TO if_wd_view_controller.

lo_api_component           = wd_comp_controller->wd_get_api( ).
lo_window_manager          = lo_api_component->get_window_manager( ).

move 'Do you want to generate certificate ?' TO ls_text.
APPEND ls_text to l_text.

lo_window = lo_window_manager->create_popup_to_confirm(
     text                 = l_text
     button_kind          = if_wd_window=>co_buttons_yesno
     message_type         = if_wd_window=>co_msg_type_question
     close_button         = ABAP_TRUE
     window_title         'Create Installation Certificate'
*    window_name            = 'SALES_DETAILS'
     window_position      = if_wd_window=>co_center
).

l_api = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
   EXPORTING
     button            = if_wd_window=>co_button_yes
*    button_text       =
*    tooltip           =
     action_name       'YES'
     action_view       = l_api     " Web Dynpro: View Controller
     is_default_button = ABAP_FALSE
).

lo_window->subscribe_to_button_event(
   EXPORTING
     button            = if_wd_window=>co_button_no
*    button_text       =
*    tooltip           =
     action_name       'NO'
     action_view       = l_api     " Web Dynpro: View Controller
     is_default_button = ABAP_FALSE
).

lo_window->open( ).

Regards

Syed

0 Kudos

Hi,

in method 'create_popup_to_confirm' you have to set the parameter 'window_name' with your window name. In the example you have posted, this parameter is commented.

Regards,

Dora

former_member205842
Participant
0 Kudos

Hi TEODORA,

                 I used that code but am getting syntax error ...saying that  "window_name" not exists ...


Please let me know what is the solution...



Regards

Syed

0 Kudos

Hi,

so, if I understand correctly, you want to create the popup without creating the window. Then your code seems OK.

Where have you put your code for creating the popup?

Dora

former_member205842
Participant
0 Kudos

HI Teodora,

                  Actually my req is i want to create popup with window ..i have written code on action button.

0 Kudos

Hi,

for your requirementd you have to create a view where you have to put your text message, then create the window (e.g. W_POPUP) and embed the view in it. On the view, also create the actions for buttons Yes and No .

After that, on the action you want to call the popup, put this code:

   DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component  TYPE REF TO if_wd_component.
DATA lo_window         TYPE REF TO if_wd_window.
*DATA lt_buttons        TYPE  wdr_popup_button_list.
*DATA ls_buttons LIKE LINE OF lt_buttons.
*DATA ls_canc_action    TYPE wdr_popup_button_action.
DATA w TYPE REF TO if_wd_window.
DATA:L_TEXT TYPE STRING_TABLE,
      ls_text LIKE LINE OF l_text.
DATA:l_api TYPE REF TO if_wd_view_controller.

lo_api_component           = wd_comp_controller->wd_get_api( ).
lo_window_manager          = lo_api_component->get_window_manager( ).

lo_window = lo_window_manager->CREATE_WINDOW(
window_name = 'W_POPUP'
title = 'Error'
message_display_mode = if_wd_window=>co_msg_display_mode_selected
close_button = abap_true
button_kind = if_wd_window=>CO_BUTTONS_YESNO
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
lo_window->open( ).

l_api = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
   EXPORTING
     button            = if_wd_window=>co_button_yes
*    button_text       =
*    tooltip           =
     action_name       'YES'
     action_view       = l_api     " Web Dynpro: View Controller
     is_default_button = ABAP_FALSE
).

lo_window->subscribe_to_button_event(
   EXPORTING
     button            = if_wd_window=>co_button_no
*    button_text       =
*    tooltip           =
     action_name       'NO'
     action_view       = l_api     " Web Dynpro: View Controller
     is_default_button = ABAP_FALSE
).

lo_window->open( ).

Hope it helps,

Dora

former_member205842
Participant
0 Kudos

Hi Teodora,

                 Thanks for replying . I tried this code but am getting error that default button coluld not set . Please check this error.

Error while processing your query


What has happened?

The URL call http://erpdev.tatahousing.com:8000/sap/bc/webdynpro/sap/zsample01 was terminated because of an error.

 
Note
  • The following error occurred in system TRD : The default button could not be set, as it has not been specified as a popup button
  • The error occurred on application server ERPDEV_TRD_00 and in work process 9 .
  • The termination type was: RABAX_STATE
0 Kudos

Maybe you have set the parameter i_button_kind with wrong value. Or the parameters   button from   subscribe_to_button_event. Please check.

Answers (4)

Answers (4)

S0007171991
Participant
0 Kudos

Hello team.

I need create a popup to confirm into the ALV Webdynpro once press a toll bar button.

To solve this I create an Enhancenment into the

WebDynpro: SALV_WD_TABLE.

View: VIEW_TABLE

Method: ONACTIONTOOLBAR_FUNCTION_APP

Y create the Actions for ok and cancell button.

For the OK I need the process continue and go to change the trip.

With NO or Cancell button no actions.

Into the ONACTIONTOOLBAR_FUNCTION_APP, the code to call the action is this

    WD_COMP_CONTROLLER->R_COMPONENT->IF_SALV_WD_COMPONENT~VIEW_GET( WD_THIS->NAME )->ON_ACTION(

      NAME         = IF_SALV_WD_COMP_TABLE_UI=>CS_ACTION-TOOLBAR_FUNCTION_APP

      T_PARAMETERS = WDEVENT->PARAMETERS ).

But I try used the same code in the Ok Action and not work, because de WDEVENT->PARAMETERS has the popup event.

do you ahve any idea

0 Kudos

Hi,

did you resolve your problem?

I have the same problem with popup window as you do.

If yes, please tell how did you do it.

Thank you.

Former Member
0 Kudos

Hi Experts,i want to delete those ok,cancel buttons in popup window in standard component.

i uncoment the subscribe_button evevnts method in wd_do_init method.But it was not works.please help me out.

Former Member
0 Kudos

Hi Yogesh,

place the code in WDBEFOREACTION method.

Here in this method you can cancel the event navigation as well.. I guess thats what you want.

Regards,

Kunjal

Former Member
0 Kudos

I think it is not possible for what you are asking. THE moment popup statement come across doesnot mean THE runtime executes it immediately. Phase model is not completed on THE first event itself. So THE best what you can do is keep THE popup Call as last in THE event handler and rest of THE Logic code it in the popup ok button handler.

0 Kudos

Wow, I've been spoiled by other languages. Usually, if you prompt the user for a response via a pop-up it make sense that the program (STOPS) and wait for their response. Oh well....Plan B.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Wow, I've been spoiled by other languages.

It doesn't have anything to do with the language, but the fact that you are doing server side eventing in a web page. You can't stop in the middle of the server side phase model and wait for user input becuase you haven't completed the client response yet.