cancel
Showing results for 
Search instead for 
Did you mean: 

How to find function codes of the buttons in ABAP Webdynpro

Former Member
0 Kudos

I had 2 buttons in my input screen of the WebDynpro, for both buttons some piece of logic is common. So i wrote that common logic in the default method 'WDDOBEFOREACTION', which will be triggered always before the corresponding methods got triggered.

Now my problem is the method 'WDDOBEFOREACTION' triggering even when user hits ENTER in the input screen, to prevent the common logic not to execute need to write some condition based on the user action. But unfortunately was not able to find the way. Could any one suggest me on this.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

For your specific requirement :

you should first determine the current action which triggered this WDDOBEFOREACTION method,

as this method triggers for every action performed on the webdynpro view.

For that below is the code

DATA lo_api_view_controller TYPE REF TO if_wd_view_controller.

DATA lo_action TYPE REF TO if_wd_action.

lo_api_view_controller = wd_this->wd_get_api( ).

lo_action = lo_api_view_controller->get_current_action( ).

IF lo_action IS NOT BOUND.

IF lo_action->name EQ 'BUTTON1' OR lo_action->name EQ 'BUTTON2'.

  • Where BUTTON1 and BUTTON2 are the actions associated with both the buttons.

  • Write your common logic here and now it would get executed only for both these button cliks only

ENDIF.

ENDIF.

Edited by: Avasarala Sampath on Oct 28, 2011 7:26 AM

Edited by: Avasarala Sampath on Oct 28, 2011 7:29 AM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There are no OK Codes or Function Codes in WDA. The event handling is all OO based. If you have shared logic between two event handlers, you should create a separate method for this logic and call it from both button event handlers. Of if the two events are very similiar you can tie both buttons to the same event handler action/method.

Former Member
0 Kudos

Can't you check the OK code in that method and only execute the common logic for the OK codes you want?

Rob

Former Member
0 Kudos

no its blank.