cancel
Showing results for 
Search instead for 
Did you mean: 

message with ok button

Former Member
0 Kudos

Hi,

i have a main window and pop-up window, based on a click on first screen iam displaying the pop-up message with ok button.now when i will click on ok button that perticular records in alv of the first screen have to get released.and that status have to be updated in the corresponding table.for this we have bapi now once i click on ok then i need to call the bapi which can update the table.

so please let me know the views...........

Inadvance,

thanks

satti

Accepted Solutions (0)

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

You need to subscribe to the OK button of your popup and create an event handler for the same. So in other words this method would get triggered when you click up on the button. Within this method you can call your BAPI and pass the information pertaining to the desired row. Below is how you subscribe to the OK button of your popup. In this snippet I am specifying that up on clicking my popups OK button I would like to trigger the action ON_ACTION. So you would also have to keep in mind to create this action in the "Actions" tab of your view or else you would end up in a runtime error saying that the specified action does not exist. And yes its not possible to create actions dynamically. You would have to do them statically at design time itself.

Regards,

Uday

* Popup
  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.
 
  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' " your window name 
    message_display_mode = if_wd_window=>co_msg_display_mode_selected
    button_kind          = if_wd_window=>co_buttons_ok
    message_type         = if_wd_window=>co_msg_type_none
    default_button       = if_wd_window=>co_button_ok
    ).
  DATA:  l_api TYPE REF TO if_wd_view_controller.
 
  l_api = wd_this->wd_get_api( ).
 
  lo_window->subscribe_to_button_event(
               button            = if_wd_window=>co_button_ok
               action_name       = 'ON_OK
               action_view       = l_api
               is_default_button = abap_true ).
 
  lo_window->open( ).

Former Member
0 Kudos

hi,

This iam able to get the pop-up with ok button.now i would like to get the value updated by using the bapi.here when i click ok then the text should be saved as "rel" in the corresponding table by using bapi.if i wil say cancel then the control have to move to the intial screen.

1.i need to get two buttons in my requirement as ok and cancel.

2. i need to call a bapi from the action ok so how can i procede........

if possible give me a step wise .....please suggest me your views on the same.

Thanks,

satti

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

hi,

This iam able to get the pop-up with ok button.now i would like to get the value updated by using the bapi.here when i click ok then the text should be saved as "rel" in the corresponding table by using bapi.if i wil say cancel then the control have to move to the intial screen.

1.i need to get two buttons in my requirement as ok and cancel.

2. i need to call a bapi from the action ok so how can i procede........

if possible give me a step wise .....please suggest me your views on the same.

Thanks,

satti

Hi Satish,

step1:to get 2 buttons ok and cancel.

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_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( ).

CALL METHOD lo_window_manager->create_popup_to_confirm

EXPORTING

text = 'MODIFICATION'

button_kind = ifwd_window=>co_buttons_OKCANCEL

message_type = if_wd_window=>co_msg_type_warning

RECEIVING

result = lo_window.

You can get the diff button kinds by changing the paramter BUTTON_KIND accordingly.

Step2: to call a BAPI on OK button

lo_view_api = wd_this->wd_get_api( ).

CALL METHOD lo_window->subscribe_to_button_event

EXPORTING

button = if_wd_window=>co_button_OK

action_name = 'CONFIRM_OK'

action_view = lo_view_api.

before calling this method go to ACTIONS Tab and declare an action CONFIRM _OK.

To perform any action on cancel button also follow the same procedure .

Regards,

Priya

Former Member
0 Kudos

hi udaya,

by using the following code iam able to get the pop-up window, but i need one more button called cancel.

*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.

*

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 = 'POPUP_WINDOW'

title = 'ST'

close_in_any_case = abap_true

MESSAGE_DISPLAY_MODE = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED

close_button = abap_true

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OK

MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE

DEFAULT_BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK

).

LO_WINDOW->OPEN( ).*

in this pop-up message if i click on ok button then i need call a bapi.for this i have created an action and i called the service call to get make bapi in component controller.then i made mapping with pop-up view and then i called a execute method in an action ok.but it's not updating my database .

let me know any suggesions on this...

inadvance,

thanks,

satti

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

In order to get even the CANCEL button in your popup you would have to make a small change. In your present call to the CREATE_WINDOW you were passing the parameter value as:

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OK

Instead of that you would need to pass it as:

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Just for your further reference

The various other combinations which are possible for the buttons are:

CO_BUTTONS_NONE 		- No Buttons
CO_BUTTONS_ABORTRETRYIGNORE	- Buttons for 'Cancel', 'Repeat', 'Ignore'
CO_BUTTONS_OK			- Buttons for 'O.K.'
CO_BUTTONS_CLOSE		- Buttons for 'Close'
CO_BUTTONS_OKCANCEL 		- Buttons for 'O.k.', 'Cancel'
CO_BUTTONS_YESNO 		- Buttons for 'Yes', 'No'
CO_BUTTONS_YESNOCANCEL 		- Buttons for 'Yes', 'No', 'Close'
	
CO_BUTTON_ABORT 		- Button for 'Cancel'
CO_BUTTON_RETRY 		- Button for 'Repeat'
CO_BUTTON_IGNORE 		- Button for 'Ignore'
CO_BUTTON_OK 			- Button for 'Ok.'
CO_BUTTON_CLOSE 		- Button for 'Close'
CO_BUTTON_CANCEL 		- Button for 'Cancel'
CO_BUTTON_YES 			- Button for 'Yes'
CO_BUTTON_NO 			- Button for 'No'

Similarly the various other options which are possible for the MESSAGE_TYPE parameter are;

CO_MSG_TYPE_NONE 		- No message type
CO_MSG_TYPE_WARNING 		- Warning
CO_MSG_TYPE_INFORMATION 	- Information
CO_MSG_TYPE_QUESTION 		- Question
CO_MSG_TYPE_ERROR 		- Error
CO_MSG_TYPE_STOPP 		- Cancel

Former Member
0 Kudos

Hi,

You can use this

IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL this button kind to have cancel button also.

Include CANCEL action in actions tab and subscribe to the CANCEL event.

Regards,

Lekha.

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

After finishing with the execution of the BAPI's EXECUTE method try coding the ABAP statement COMMIT WORK or call the function module BAPI_TRANSACTION_COMMIT . Many BAPI's need an explicit commit work to be performed for the changes to get reflected on to the database. This should help have the changes reflected on to the database. If even that doesn't work then you should just try debug and see if the values are bing passed properly to the BAPI.

Regards,

Uday

Former Member
0 Kudos

hi udaya,

thanks, i have done with cancel button.but my bapi is not getting trigger.here in my requirement i have a input fileld in the first view based on this iam displaying alv.user need to select all records in alv once he click on the release button it has display the pop up with two buttons (ok cance->this is done).then i went to component controller and a called a bapi using service call.and i mapped this to the context of pop-up view then in ok of the pop-up i have called a execute method.

please let me know is this is the right.....if i call this bapi(zbapi) then i need to get the message as data changes have been updated if it's cancel then my pop-up has to disaaper.

give me an idea.....

thanks,

satti.

Former Member
0 Kudos

HI,

In the OK button you are calling the BAPI execute method. It will return the messages right.

Based on those messages, You need to explictily throw the mesasges using the mesasge manager instance.

On the CANCEL button close the propup.

data:
lr_window type ref to  IF_WD_WINDOE.

call method lr_window->close.

Regards,

Lekha.

Former Member
0 Kudos

hi,

iam not able to get done with bapi.just now i observed one thing in my pop-view on ok iam calling the execute method.for this i need to get the input field value which has enterd in the first view...suggest me how can i procede here.but basedd on that input iam able to get alv dispaly.

thanks,

satti

Former Member
0 Kudos

hi ,

iam using the following code to get read the values to alv.this input value i need to send to pop-up view on ok action before the execution method.is this is correct if yes how can i change my code in the execute method:

**DATA: lr_node TYPE REF TO if_wd_context_node,

lv_PN_NR TYPE wd_this->element_input_node-draw_no,

lt_qprs TYPE wd_this->elements_alv_table.

lr_node = wd_context->get_child_node( name = wd_this->wdctx_input_node ).

" Read the VBELN value from input field into a local variable lv_vbeln

lr_node->get_attribute( EXPORTING name = 'DRAW_NO'

IMPORTING value = lv_PN_NR ).

" Use the obtained pn_nr value to fetch corresponding qprs details

SELECT * FROM qprs INTO CORRESPONDING FIELDS OF TABLE lt_qprs WHERE PN_NR = lv_PN_NR.

" Check if there are any records in qprs for the entered pn_nr. If yes only then bind to the 2nd table & show ALV

" Or else keep the ALV as hidden & throw an message to the user informing him about the same

IF lt_qprs IS NOT INITIAL.

lr_node->set_attribute( EXPORTING name = 'SHOW_ALV'

value = 'X' ).

lr_node = wd_context->get_child_node( name = wd_this->wdctx_alv_table ).

lr_node->bind_table( lt_qprs ).

ELSE.

" Use your message manager logic to throw a message that no item details exist for this document number!

ENDIF. *

*

called in ok of the pop-up :my execute method:

DATA LO_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .

LO_COMPONENTCONTROLLER = WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

LO_COMPONENTCONTROLLER->EXECUTE_Z_QPR4_RELEASE(

).

thanks

satti

Former Member
0 Kudos

Hi,

You might have deisgned a node for the Input field right.

In the popup view, useing the GET_ATTRIBUTE method of IF_WD_CONTEXT_NDOE get the value of the input field.

And pass the same to the BAPI method which returns the table data.

I think you are quite confused.

Is this clear?.

Regards,

Lekha.

Former Member
0 Kudos

hi,

by the code i was unable to get close my pop-up msg.i went to debug mode also , so once iam reacing to call method then it's coming out throwing an error like: null object reference. could you please suggest me any idea on this..

Thanks,

Satti

Former Member
0 Kudos

Hi,

Can you paste the error and also breif me exaclty what you want to do.

Regards,

Lekha.

Former Member
0 Kudos

hi,

here iam able to display the pop-up box with the two buttons.if once i will click on cancel button on pop-up then that pop-up box has to get closed.if i will click on ok then i need to get a message like done(this message iam able to display in that pop-up itself.)is there any chance to get out of the pop-up box.

thanks,

satti

Former Member
0 Kudos

Hi,

You mean after displaying that message, then you want to close the popup (OK) button.

But, There is no point in displaying the message and closing the popup immediatley. Then this message will be shown in MAIN view if you dont clear the message when you close the popup.

Regards,

Lekha.

Former Member
0 Kudos

hi,

at least on my cancel button iam not able to get to close the pop-up box.

thanks,

satti

Former Member
0 Kudos

Hi,

Create a attribute lr_widnow type ref to if_wd_window in the view's attribute.

When you get the WINDOW reference store it in the view's attribute globally in that view.

*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.
*
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 = 'POPUP_WINDOW'
title = 'ST'
close_in_any_case = abap_true
MESSAGE_DISPLAY_MODE = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
close_button = abap_true
BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL
MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
DEFAULT_BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK
).

wd_this->lr_window = lo_window. -----------global to view
LO_WINDOW->OPEN( ).*

Then implement the CANCEL action, in that

call method wd_this->lr_window->close.

Regards,

Lekha.

former_member40425
Contributor
0 Kudos

Hi,

Suppose You are using report_sucess then Pass the name of View in which you want to show the messae then it will show only in that view in which you want, not in the popup

* get message manager
DATA lo_api_controller     TYPE REF TO if_wd_controller.
DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
 
lo_api_controller ?= wd_this->wd_get_api( ).
 
CALL METHOD lo_api_controller->get_message_manager
  RECEIVING
    message_manager = lo_message_manager
    .
 
* report message
CALL METHOD lo_message_manager->report_success
  EXPORTING
    message_text              =   'Done' " Give your error text here
*    params                    =
*    msg_user_data             =
*    is_permanent              = ABAP_FALSE
*    scope_permanent_msg       = CO_MSG_SCOPE_CONTROLLER
*    view                      =
*    show_as_popup             =  'VIEW_NAME' "    Give Your View Name Here
*    controller_permanent_msg  =
*    msg_index                 =
*    cancel_navigation         =
*    enable_message_navigation =
* receiving
*    message_id                =
    .

Regards,

Rohit

Former Member
0 Kudos

hi,

i need the message watever iam displaying (ex: done) any possibility that i can disaplay this message in the main view isted of in the pop-up messge.as well as if i click on cancel button in the pop-up message it's not getting disappear(closed).

please let me know any idea on the same...

regards,

satti

Former Member
0 Kudos

Hi,

In the OK button also close the window and donot clear the mesages. When you press OK then those messages are automatically shown in the MAIN view itself.

Is that clear.

Regards,

Lekha

Former Member
0 Kudos

Hi ,

iam getting the following error for which i have implemented the code in cancel action to close the pop-up window.here in my requirement iam calling the pop-up window in the first i.e main view it self on action rel.(ihave created a button for rel).

Access via 'NULL' object reference not possible.

The error occurred on the application server CDNSRV_CDN_00 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: ONACTIONCANCEL of program /1BCWDY/6AX9D8Q5EN2UME1QIPRG==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/6AX9D8Q5EN2UME1QIPRG==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: HANDLE_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP

please suggest me that how can i procede.

regards,

satti

Former Member
0 Kudos

Hi,

Check in St22 for more on error details.

In the BUTTON handler i guess you are opening a popup right.

Create a view attribute lr_window type ref to if_wd_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.
*
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 = 'POPUP_WINDOW'
title = 'ST'
close_in_any_case = abap_true
MESSAGE_DISPLAY_MODE = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
close_button = abap_true
BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL
MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
DEFAULT_BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK
).

Implement ACTION CANCEL ire using SUBSCRIBE method. "Refer UDAY's code
 
wd_this->lr_window = lo_window. -----------global to view
LO_WINDOW->OPEN( ).*

In the CANCEL button.

if wd_this->lr_window is not initial.

call method wd_this->lr_winodw.close.

endif.

Regards,

Lekha.

former_member40425
Contributor
0 Kudos

Hi,

data: l_cmp_api          type ref to if_wd_component,
        l_window_manager   type ref to if_wd_window_manager,
        l_popup            type ref to if_wd_window,
        l_text             type string_table,
        l_api              type ref to if_wd_view_controller.
 
 
  l_cmp_api        = wd_comp_controller->wd_get_api( ).
  l_window_manager = l_cmp_api->get_window_manager( ).
  insert `Message which you wanna display.` into table l_text. 
 
  l_popup = l_window_manager->create_popup_to_confirm(
                text            = l_text
                button_kind     = if_wd_window=>co_buttons_ok
                message_type    = if_wd_window=>co_msg_type_information
                window_title    = 'Title of the window'
                window_position = if_wd_window=>co_center ).
 
  l_api = wd_this->wd_get_api( ).
  l_popup->subscribe_to_button_event(
               button            = if_wd_window=>co_button_ok
               action_name       = 'OK'
               action_view       = l_api
               is_default_button = abap_true ).
 
  l_popup->open( ).

In the onAction of OK write your code to display table.

Regards,

Rohit

Former Member
0 Kudos

hi,

by using the given code iam getting an error saying action and object id does not exist.

Thanks,

satti

former_member40425
Contributor
0 Kudos

Hi,

You have to create action with name OK which you paasing in the method subscribe_to_button_event.

Regards,

Rohit

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

I guess you didnt even completely go through what I had written earlier. I had clearly said in there that you would need to go to your "Actions" tab and create an action in there and that you would otherwise end up in an error. Paying close attention to your threads replies would not only mean respecting others time but also ensure faster solutions for yourself. Am once again pasting what I had said in my first posting...

"In this snippet I am specifying that up on clicking my popups OK button I would like to trigger the action ON_ACTION. So you would also have to keep in mind to create this action in the "Actions" tab of your view or else you would end up in a runtime error saying that the specified action does not exist. And yes its not possible to create actions dynamically. You would have to do them statically at design time itself."

Regards,

Uday