cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the name of action in Modify view of webdynpro?

vimal
Active Participant
0 Kudos

i have created a view in which i have 3 buttons . now i wish to know which button is pressed in modifyview , on the basis of which a particular code will be executed. Any suggestions on how can we achieve it.?

Accepted Solutions (1)

Accepted Solutions (1)

former_member397547
Discoverer
0 Kudos

Hi,

you can use following:

data lo_api_controller type ref to if_wd_view_controller.

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

case lo_action->name.

when 'OK'

....

endcase.

Regards

Evgeniy

Answers (3)

Answers (3)

NagaPrakashT
Contributor
0 Kudos

Hi Varma,

  You can get the ID of the button in Event Handler of the button by using below code, once you get the button ID pass this attribute of the Context and in the MODIFYVIEW you can the get this attribute value.

DATA : lv_button_id type string.

CALL METHOD wdevent->get_string

     EXPORTING

       name  = 'ID'

     RECEIVING

       value = lv_button_id.

Thanks,

Naga

Former Member
0 Kudos

just create an attribute as gv_btn_id type string  in your view.

every button action method will have the ID as import parameter and assign the ID to the View attribute as

wdthis->gv_btn_id = ID.

and in your  MODIFYVIEW, wdthis->gv_btn_id cotains the ID of the button pressed.

proceede with your code.

Thanks.

Uma

Former Member
0 Kudos

Hi,

When you click on any of your 3 button, it will go to your button event handler first then MODIFY View. In each button event handler, you will have parameter WDEVENT, keep the reference of WDEVENT in your view attribute in a variable. If you read WDEVENT, you will be getting ID of your button which you clicked.

Thank you.

-Siddharth

sergiu_popa
Participant
0 Kudos

Hi Vimal,

One option would be to have 3 boolean attributes in the view, one for each button. Once a button is pressed, in the handler method of the action, set the corresponding attribute in the view to true and check for this value in WDDOMODIFYVIEW.

OR

Have a single variable in the Attribute tab of the view, that will hold the name of the button that was pressed. Once a button is pressed, in the handler method of the action, set the attribute in the view and check for his value in WDDOMODIFYVIEW.

Best regards,

Sergiu