cancel
Showing results for 
Search instead for 
Did you mean: 

Get pushed button

Former Member
0 Kudos

I'm try this in wddobeforeaction() with the code:

DATA: lo_api_controller TYPE REF TO if_wd_view_controller,
         lo_action         TYPE REF TO if_wd_action.

lo_api_controller ?= wd_this->wd_get_api( ).
lo_action = lo_api_controller->get_current_action( ).


IF lo_action IS BOUND.
     IF lo_action->name EQ 'SEND'.

     "code

ENDIF.

ENDIF.


But not works. lo_action->name is initial and lo_action is not bound.


Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alberto,

Check this thread if it helps you.

Thanks

KH

Former Member
0 Kudos

I have same code, but not works.

When I push a button, during debug lo_action value is not bound and lo_action->name is initial 

harsha_jalakam
Active Contributor
0 Kudos

Hi Alberto,

Is the event specific to same view or the other view, if the event is triggered from other view, like closing the pop up window,or similar to that we will get action name to be initial.

Regards,

Harsha

Former Member
0 Kudos

The button and the wddobeforeaction() are in distinct view.

I have VIEW2 embebed into VIEW1.

I push any button in VIEW1. And I need get what button was pushed in wddobeforeaction() of VIEW2

harsha_jalakam
Active Contributor
0 Kudos

Hi Alberto,

With the code you have used, it is not possible to get the desired action , since wd_this->wd_get_api( ) refers to current view.

Instead a node can be used which can store the value of the button pressed, so that the button value can be passed  from one view to another, through context mapping,.

Regards,

Harsha

ramakrishnappa
Active Contributor
0 Kudos

Hi Alberto,

Here, you need to store the action name/ action reference in the component controller, so that it can be accessed in any view.

Let us say, you have embedded the VIEW2 inside the VIEW1 and VIEW1 has buttons SUBMIT, RESET, etc

Whenever an action occurs, the method WDDOBEFOREACTION( ) of  VIEW1 gets triggered first and then of VIEW2.

So, the action of VIEW1 can be saved in component controller and then can be accessed in VIEW2.

Example:


  • Create an attribute GV_VIEW1_ACTION_NAME in component controller
  • write the below code in wddobeforeaction( ) of VIEW1

       

            DATA: lo_api_controller TYPE REF TO if_wd_view_controller,
         lo_action         TYPE REF TO if_wd_action.

          lo_api_controller ?= wd_this->wd_get_api( ).
          lo_action = lo_api_controller->get_current_action( ).

         

          clear wd_comp_controller->gv_view1_action_name.


          IF lo_action IS BOUND.

           wd_comp_controller->gv_view1_action_name = lo_action->name.
          ENDIF.

  • now, access the current action of view1 inside VIEW2 as below

          if wd_comp_controller->gv_view1_action_name = 'SEND'.

         

          " do your logic

          endif.

Hope this helps you.

Regards,

Rama

Answers (1)

Answers (1)

Former Member
0 Kudos

Ok!

Thank you for your answers!