cancel
Showing results for 
Search instead for 
Did you mean: 

How get button ID from WDDOBEFOREACTION?

Former Member
0 Kudos

Hi

I have a popup windows with default button. In WDDOBEFOREACTION I need get button ID. When I use

LR_ACTION = LR_API->GET_CURRENT_ACTION( ) - i got a NULL reference.


That I create reference  LR_API = WD_THIS->WD_GET_API( ).

In LR_API I have this information, but in:

{O:605*\CLASS=CL_WDR_DELEGATING_VIEW}-ACTION_ACCESSOR

{O:721*\CLASS-POOL=CL_WDR_WINDOW_PHASE_MODEL\CLASS=LCL_BEFORE_ACTION}-IF_WDR_BEFORE_ACTION~CURRENT_ACTION

{O:593*\CLASS=CL_WDR_ACTION}-PARAMETERS

How get "WD_OK" information directly?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Use subscribe_to_button_event( ) method of window and pass the action name for your button.

If you still want to read the button ID in dobeforeaction, use the below code:


DATA lo_api_controller TYPE REF TO if_wd_view_controller.

   DATA lo_action         TYPE REF TO if_wd_action.

   DATA ls_action TYPE wdr_name_value.

   lo_api_controller = wd_this->wd_get_api( ).

   lo_action = lo_api_controller->get_current_action( ).

READ TABLE lo_action->parameters INTO ls_action WITH KEY name = 'ID'.


ls_action-value will contain the button ID.



hope this helps u,

Regards,

Kiran

Former Member
0 Kudos

Hi

I have in MAIN view a subscribe_to_button_event( ), but in POPUPview I don't have. (I read where was describe use subscribe_to_button_event in POPview, not a MAIN view).

Is possible from path of debug view create syntax for read variabble?

Thank you

former_member184578
Active Contributor
0 Kudos

Hi,

subscribe_to_button_event( ) in MAIN View only, before opening popup.

Is possible from path of debug view create syntax for read variabble?

Could you be more specific on this?

Regards,

Kiran

Former Member
0 Kudos

Hi

In my question I attach a pictures. This pictures is from debug mode. I only create

LR_API = WD_THIS->WD_GET_API( ).

and from LR_API in debug view clicking to variable (picture show how) get desired value.


When I debug in c# and I reach desired value (clicking like SAP debug), I only click RMB and use options "Add watch". And whole path to desired value automatically create.


Best regards

former_member184578
Active Contributor
0 Kudos

Hi,

From the path it's the below code. lo_action contains the instance of cl_wd_action and in that am accessing parameters which is public attribute.

DATA lo_api_controller TYPE REF TO if_wd_view_controller.

   DATA lo_action         TYPE REF TO if_wd_action.

   DATA ls_action TYPE wdr_name_value.

   lo_api_controller = wd_this->wd_get_api( ).

   lo_action = lo_api_controller->get_current_action( ).

READ TABLE lo_action->parameters INTO ls_action WITH KEY name = 'ID'.


ls_action-value will contain the button ID (WD_OK or other).



hope this helps,



Regards,

Kiran

Former Member
0 Kudos

Hi

Problem is when I have subscribe_to_button_event in MAIN view and NOT in POPUP view.

When I have subscribe_to_button_event in MAIN view - I give get_current_action only in MAIN view.

When I have subscribe_to_button_event in POPUP view - I give get_current_action only in POPUP view.

In my case I have subscribe_to_button_event in MAIN view, but get_current_action in POPUP view give a NULL reference.

This case is desribed in http://scn.sap.com/docs/DOC-48455

But I can't edit cl_wdr_delegating_view class.


Best regards

ramakrishnappa
Active Contributor
0 Kudos

Hi Smoula,

For your case, you need to save the main view reference of main view in component controller and then get current action of MAIN view

Proceed as below

  • Create an attribute go_main_view of type IF_WD_VIEW_CONTROLLER in component controller's attributes tab
  • Go to WDDOINIT( ) method MAIN view & write the below code to save main view reference

               wd_comp_controller->go_main_view ?= wd_this->wd_get_api( ).

  • Now you get the view's current action in WDDOBEFOREACTION( ) method of POPUP view as below

                    lr_action = wd_comp_controller->go_main_view->get_current_action( ).

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hi Ramakrishnappa Gangappa

It is work

Thank you.

Answers (0)