cancel
Showing results for 
Search instead for 
Did you mean: 

check which button were pressed

Former Member
0 Kudos

Hallo all,

I want to check which button the user pressed.

I do this:

DATA:

LR_VIEW_CONTROLLER TYPE REF TO IF_WD_VIEW_CONTROLLER,

LF_ACTION TYPE REF TO IF_WD_ACTION.

LR_VIEW_CONTROLLER ?= wd_this->wd_get_api( ).

CALL METHOD LR_VIEW_CONTROLLER->GET_CURRENT_ACTION

RECEIVING

RESULT = LF_ACTION.

IF LF_ACTION->NAME = 'GO'.

  • do something

ENDIF.

It's ok. But when the user no button pressed, then i become a dump:

Access via 'NULL' object reference not possible

The problem is: LF_ACTION->NAME is initial.

Is there any otherv way to check were button pressed?

I know this:

data: lv_event_name type string.

lv_event_name = wdevent->get_name( ).

The problem here ist, it gos only in the event-handler-method. I will check it in another method.

Thanks for help.

greetings

Rainer

Accepted Solutions (1)

Accepted Solutions (1)

mohammed_anzys
Contributor
0 Kudos

Hi

Use if initial check, it will solve your problem

Thanks

Anzy

Former Member
0 Kudos

Hi Anzy,

Thanks. It solves my problem.

Bevor I do this:

IF LF_ACTION->NAME = 'TEXT'.

ENDIF.

Thats wrong. I become a dump, when it was inital.

Now after your help i do this:

IF LF_ACTION IS INITIAL.

  • some action

ENDIF.

It works.

Regards

Rainer

Answers (1)

Answers (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

To avoid the Error

put all your code inside

if lf_action is not initial.

endif.

Regards

Abhimanyu L

Message was edited by:

Abhimanyu Lagishetti